-vvv option).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
( )...
I had to update jsonschema manually to get it to work.
pip install --upgrade jsonschema --pre
That's strange since when poetry is installed with get-poetry.py it uses vendored dependencies so pip install should not change anything.
Are you sure that poetry points to the proper $HOME/.poetry/bin?
I had this failure. I removed then reinstall the venv and it was ok
Other developers on our team had the issue with jsonschema, we use pyenv for managing the versions if that changes anything.
You can recreate the PATH issue with the following Dockerfile. Notice the commented out ENV line that is now required after poetry 0.12
FROM python:3.6.5
RUN pip install --upgrade pip
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/5 : FROM python:3.6.5
---> 9a58cce9b09f
Step 2/5 : ARG GEMFURY_PYPI_AUTH
---> Using cache
---> 4c59a99ef8f5
Step 3/5 : RUN pip install --upgrade pip
---> Using cache
---> 6b89bebd2f4d
Step 4/5 : RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - -y
---> Using cache
---> 1a3258a4a4c3
Step 5/5 : RUN which poetry
---> Running in 5f3bf311dd42
The command '/bin/sh -c which poetry' returned a non-zero code: 1
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.
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
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
```Dockerfile
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
PATHenvironment 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
@jordanhamill The installer also tells you that to configure the current shell you have to source $HOME/.poetry/env since it can't update the PATH itself.
And what the installer actually does is add EXPORT PATH="/root/.poetry/bin:$PATH"聽to the profiles it finds. However if they are not sourced by the shell the PATH will not be updated.
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.
@jordanhamill The old installer was relying on pip to install Poetry putting it in the PATH since python Docker images already have the correct PATH. I changed the installer because this required to install Poetry for every single Python version you wanted to use which was not good fro a user experience standpoint.
This is not a regression per se, just a change of behavior that helps a lot in installing Poetry in an isolated way.
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.
I seeing module 'jsonschema' has no attribute 'Draft7Validator' resulting from pip install poetry on Travis CI: https://travis-ci.org/jacebrowning/datafiles/builds/447468404
@jacebrowning The issue you have is that you install Poetry inside the Travis virtualenv. So, the Poetry's dependencies are properly installed first (Successfully installed jsonschema-3.0.0a3).
However, your project has jsonschema pinned to 2.6.0 (see https://github.com/jacebrowning/datafiles/blob/master/poetry.lock#L297) which makes Poetry downgrade jsonschema and in turn triggers the error since Draft7Validator does not exist.
You might want to consider using the recommended installer. This will resolve the issue and make the Poetry's installation faster. For an example see here: https://github.com/sdispater/pendulum/blob/master/.travis.yml#L67
@sdispater Do I still need to do
RUN $HOME/.poetry/env
if I am installing poetry with pip in Docker?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stephanebruckert - what's the intention of your comment?
Sorry I think I posted that in the wrong issue, deleted it.
Most helpful comment
Poetry will not be available in the current shell after installation you have to execute:
For the
jsonchemaproblem, you best bet is to uninstall the currently installed Poetry version, especially if you come from0.11.5, and reinstall it usingget-poetry.py.