poetry: Poetry 0.12.2 installer doesn't modify PATH or install required jsonschema

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macOS 10.13.4 / Docker (FROM python:3.6.5)
  • Poetry version: 0.12.2
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

When performing a fresh install using get-poetry.py $HOME/.poetry/bin doesn’t get added to the PATH like in previous releases.

Secondly, after running poetry self:update (or a fresh install using the get-poetry.py) poetry crashes with any command.

[AttributeError]
module ‘jsonschema’ has no attribute ‘Draft7Validator’

run <args> (<args>)…

I had to update jsonschema manually to get it to work.

pip install --upgrade jsonschema --pre

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 15
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Poetry will not be available in the current shell after installation you have to execute:

source $HOME/.poetry/env

For the jsonchema problem, you best bet is to uninstall the currently installed Poetry version, especially if you come from 0.11.5, and reinstall it using get-poetry.py.

Building a docker image doesn’t use a single shell instance across RUN commands so the $HOME/.poetry/env wont work, nor will RUN bash -c "EXPORT PATH='/root/.poetry/bin:$PATH'.

I’m happy with the work around of explicitly modifying the PATH but that would indicate that the installer isn’t doing what it says it is doing in all scenarios. I haven’t dug through the difference between the installers but I’m curious as to why it worked pre 0.12.0. It seems like a regression as the change log doesn’t mention this being intentional.

Thanks for clarifying. Is there a reason poetry doesn’t get installed to /usr/local/bin on linux? It’s pretty standard behaviour for locally built (setup.py) tools to go there (e.g. pip, pyvenv, etc). This would make them available without any PATH modification.

Each RUN step in a Dockerfile is not executed in the same shell instance so RUN bash -c "source $HOME/.poetry/env" will not work (or RUN source $HOME/.poetry/env, as source is not a regular command).

This docker file with Poetry 0.11.5 shows the installer correctly modifying the PATH.

FROM python:3.6.5
RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/0.11.5/get-poetry.py | python - --version 0.11.5
RUN which poetry
$ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM python:3.6.5
 ---> 9a58cce9b09f
Step 2/3 : RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/0.11.5/get-poetry.py | python - --version 0.11.5
 ---> Running in 91070fb475a7
Retrieving metadata

Installing version: 0.11.5
  - Getting dependencies
  - Vendorizing dependencies
  - Installing poetry

poetry (0.11.5) successfully installed!
Removing intermediate container 91070fb475a7
 ---> a27fd71f4036
Step 3/3 : RUN which poetry
 ---> Running in ff4835d5021a
/usr/local/bin/poetry
Removing intermediate container ff4835d5021a
 ---> 08ae4ada19ca
Successfully built 08ae4ada19ca

And the following Dockerfile shows that Poetry 0.12.x doesn’t correctly modify the PATH

FROM python:3.6.5
RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - -y
RUN which poetry
$ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM python:3.6.5
 ---> 9a58cce9b09f
Step 2/3 : RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - -y
 ---> Running in 72744ce5b5fc
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

$HOME/.poetry/bin

This path will then be added to your `PATH` environment variable by
modifying the profile file located at:

$HOME/.profile

You can uninstall at any time with `poetry self:uninstall`,
or by executing this script with the --uninstall option,
and these changes will be reverted.

Installing version: 0.12.4
  - Downloading poetry-0.12.4-linux.tar.gz (8.31MB)

Poetry (0.12.4) is installed now. Great!

To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run `source $HOME/.poetry/env`

Removing intermediate container 72744ce5b5fc
 ---> 31b4a448b14f
Step 3/3 : RUN which poetry
 ---> Running in 2f1a7d5fdaea
The command '/bin/sh -c which poetry' returned a non-zero code: 1

I have to explicitly configure the PATH variable with the 0.12.x installer in the Dockerfile, which goes against what the installer script prints

This path will then be added to your PATH environment variable by modifying the profile file located at: … Next time you log in this will be done automatically.

FROM python:3.6.5
RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - -y
ENV PATH="/root/.poetry/bin:$PATH"

RUN which poetry
$ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM python:3.6.5
 ---> 9a58cce9b09f
Step 2/4 : RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - -y
 ---> Using cache
 ---> 31b4a448b14f
Step 3/4 : ENV PATH="/root/.poetry/bin:$PATH"
 ---> Running in 17ba1cdb2975
Removing intermediate container 17ba1cdb2975
 ---> c2ff17f3e2f8
Step 4/4 : RUN which poetry
 ---> Running in ffc863c35e25
/root/.poetry/bin/poetry
Removing intermediate container ffc863c35e25
 ---> 0d860f9b1749
Successfully built 0d860f9b1749