-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- 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 (
-vvvoption).
Possibly related: - Incorrect Python version installed in virtual environment #6051
- Poetry not using specified virtual environment #6141
- The specified Python version (3.8) is not supported by the project (^3.7). #1735 (maybe, bit of a stretch, but I am having issues with poetry env)
- OS version and name: macOS catalina 10.15.7 (19H1922)
- Poetry version: 1.2.0rc.1
- Link of a Gist with the contents of your pyproject.toml file:
[tool.poetry]
name = "test-project"
version = "0.1.0"
description = ""
authors = <redacted>
readme = "README.md"
packages = [{include = "test_project"}]
[tool.poetry.dependencies]
python = "^3.8" # also tried this process with ">3.8,<3.9" to try to force it not to use 3.9
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
- config
❯ cat ~/Library/Preferences/pypoetry/config.toml
[virtualenvs]
create = false
[experimental]
new-installer = true
[installer]
parallel = true
Issue
Apologies in advance if this is a PEBCAK, but I'm following the docs as closely as possible and it's not conforming with my expectations, so I think there is a mismatch somewhere. I've been experimenting with the 1.2 rc because I'm super excited for it, and running into some friction. I'm interested in running poetry-version-plugin
I've just installed poetry 1.2.0rc1 via https://install.python-poetry.org (md5sum 6687215717deb5c6d8b86bbca2c043d8)
❯ python3 ~/install-poetry.py --version 1.2.0rc1 # python3 points to ../Cellar/[email protected]/3.9.12/bin/python3
...
It will add the `poetry` command to Poetry's bin directory, located at:
/Users/mike/Library/Python/3.9/bin
...
❯ ln -svf /Users/mike/Library/Python/3.9/bin/poetry ~/.local/bin/poetry
/Users/mike/.local/bin/poetry -> /Users/mike/Library/Python/3.9/bin/poetry
❯ poetry --version
Poetry (version 1.2.0rc1)
I've then activated my virtual environment (I have virtualenvs.create=false and like to manage my own venvs). Now, I presume I should be able to run poetry self add poetry-version-plugin or poetry self show plugins and see existing plugins as a baseline (should see none). But instead I see
❯ poetry self show plugins -vvv
Loading configuration file /Users/mike/Library/Preferences/pypoetry/config.toml
Loading configuration file /Users/mike/Library/Preferences/pypoetry/auth.toml
...
InvalidCurrentPythonVersionError
Current Python version (3.8.13) is not allowed by the project (3.9.12).
Please change python executable via the "env use" command.
at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:844 in create_venv
840│ current_python = Version.parse(
841│ ".".join(str(c) for c in env.version_info[:3])
842│ )
843│ if not self._poetry.package.python_constraint.allows(current_python):
→ 844│ raise InvalidCurrentPythonVersionError(
845│ self._poetry.package.python_versions, str(current_python)
846│ )
847│ return env
Mismatch with what poetry env info shows:
❯ poetry env info
Virtualenv
Python: 3.8.13
Implementation: CPython
Path: /Users/mike/.virtualenvs/core38c
Executable: /Users/mike/.virtualenvs/core38c/bin/python
Valid: True
System
Platform: darwin
OS: posix
Python: 3.8.13
Path: /Users/mike/.pyenv/versions/3.8.13
Executable: /Users/mike/.pyenv/versions/3.8.13/bin/python3.8
Python 3.9.12 is my "system" python, managed by homebrew, but I manage all my python versions manually using pyenv and virtualenv. I want my poetry installation completely decoupled from the virtualenvs, but maybe that is not possible with the plugins, and/or with virtualenvs.create=false? I tried setting virtualenvs.create true but I get the same error.
❯ poetry env use /Users/mike/.pyenv/versions/3.8.13/bin/python3
Creating virtualenv test-project-QU_ARkle-py3.8 in /Users/mike/Library/Caches/pypoetry/virtualenvs
Using virtualenv: /Users/mike/Library/Caches/pypoetry/virtualenvs/test-project-QU_ARkle-py3.8
❯ poetry self show plugins -vvv
...
InvalidCurrentPythonVersionError
Current Python version (3.8.13) is not allowed by the project (3.9.12).
Please change python executable via the "env use" command.
at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:844 in create_venv
840│ current_python = Version.parse(
841│ ".".join(str(c) for c in env.version_info[:3])
842│ )
843│ if not self._poetry.package.python_constraint.allows(current_python):
→ 844│ raise InvalidCurrentPythonVersionError(
845│ self._poetry.package.python_versions, str(current_python)
846│ )
847│ return env
If I completely deactivate, and then run it, the command succeeds, but in doing so it creates a 3.9 environment, which I don't want.
❯ deactivate
❯ poetry env use /Users/mike/.pyenv/versions/3.8.13/bin/python3
Using virtualenv: /Users/mike/Library/Caches/pypoetry/virtualenvs/test-project-QU_ARkle-py3.8
❯ poetry self show plugins -vvv
Loading configuration file /Users/mike/Library/Preferences/pypoetry/config.toml
Loading configuration file /Users/mike/Library/Preferences/pypoetry/auth.toml
Creating virtualenv poetry-instance-YN-Fucdl-py3.9 in /Users/mike/Library/Caches/pypoetry/virtualenvs
Using virtualenv: /Users/mike/Library/Caches/pypoetry/virtualenvs/poetry-instance-YN-Fucdl-py3.9
• poetry-plugin-export (1.0.6) Poetry plugin to export the dependencies to various formats
1 application plugin
Dependencies
- poetry (>=1.2.0b3,<2.0.0)
- poetry-core (>=1.1.0b3,<2.0.0)
As soon as I activate my normal env, and run poetry self show, it barfs.
Seems alright if I do everything "by the book" and use fully Poetry-managed virtualenvs, but I'd really like to keep my existing workflow with external virtualenvs.