Poetry: No instructions on how to "activate a compatible Python version".

Created on 30 Sep 2019  路  4Comments  路  Source: python-poetry/poetry

  • [ x] I am on the latest Poetry version.
  • [ x] I have searched the issues of this repo and believe that this is not a duplicate.

Issue

Despite being installed in Python3.7, poetry insists on using python 2 (which is the result of which python on my system).

[RuntimeError]                                                 
The current Python version (2.7.16) is not supported by the project (^3.7)  
Please activate a compatible Python version.

There are no details or hints in the documentation on _how_ to achieve this.

As a user, I find it quite surprising poetry isn't using the python it's installed in as the default.

Bug

All 4 comments

If you are using the preview version, you can simply issue poetry env use 3.7, and for full environment activation you could then issue $(poetry env info -p)/bin/activate

I am not using the preview version. I had no idea such a thing existed.

"Full environment activation" isn't an option because I can't yet persuade poetry to actually use the right python in the first place.

Well, you can install the preview version by issuing poetry self:update --preview as per the documentation.

From there you can activate the environment by using the command I gave in the above comment.
That being said, the poetry way to run any tool is by using poetry run, e.g. poetry run python.

I tried updating as directed and got this response:

$ poetry self:update --preview

[RuntimeError]                                                            
Poetry was not installed with the recommended installer. Cannot update automatically.  

self:update [--preview] [--] [<version>]

I had installed it with "pip install --user poetry".
(pip 19.2.3)

I have now installed the pre-release version using "pip install --user -pre poetry" and now:
(a) "init" asks which Python I want [nice], and
(b) it provides the env options.

Was this page helpful?
0 / 5 - 0 ratings