-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poetry install
does not pick up Python version set by Pyenv on Debian
#7262
Comments
Hey, you have to set
Could be same reason as in #7158, which will be fixed by #7221. fin swimmer |
Hey, I've set ***@localhost:~/code/***$ poetry install -vvv
Loading configuration file /home/***/.config/pypoetry/config.toml
Trying to detect current active python executable as specified in the config.
Found: /home/***/.pyenv/versions/3.11.0/bin/python
Stack trace:
8 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
7 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/console/application.py:190 in _run
188│ self._load_plugins(io)
189│
→ 190│ exit_code: int = super()._run(io)
191│ return exit_code
192│
6 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
5 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
4 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:454 in _run_command
452│
453│ try:
→ 454│ self._event_dispatcher.dispatch(command_event, COMMAND)
455│
456│ if command_event.command_should_run():
3 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:26 in dispatch
24│
25│ if listeners:
→ 26│ self._do_dispatch(listeners, event_name, event)
27│
28│ return event
2 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:89 in _do_dispatch
87│ break
88│
→ 89│ listener(event, event_name, self)
90│
91│ def _sort_listeners(self, event_name: str) -> None:
1 ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/console/application.py:299 in configure_env
297│
298│ env_manager = EnvManager(poetry, io=io)
→ 299│ env = env_manager.create_venv()
300│
301│ if env.is_venv() and io.is_verbose():
InvalidCurrentPythonVersionError
Current Python version (3.9.2) is not allowed by the project (^3.11).
Please change python executable via the "env use" command.
at ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/utils/env.py:902 in create_venv
898│ current_python = Version.parse(
899│ ".".join(str(c) for c in env.version_info[:3])
900│ )
901│ if not self._poetry.package.python_constraint.allows(current_python):
→ 902│ raise InvalidCurrentPythonVersionError(
903│ self._poetry.package.python_versions, str(current_python)
904│ )
905│ return env
906│ |
Hey again, I guess there is already a venv which contains the wrong Python version. Remove this one and try again. fin swimmer |
Yes! I needed to delete Thank you |
While this solves the problem, this still looks more like a bug. It is perfectly normal to want to upgrade Python to the newest patch release - and when you do so, you hit this error with no clue what to do next. At least the error message could be made more helpful. Or better, Poetry could suggest to re-create venv using the new interpreter. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option) and have included the output below.Issue
My project uses Python 3.11 and I'm trying to install it on a vanilla Debian machine.
Debian 11 comes with Python 3.9.2 as the system version of Python.
It is not recommended to override the system version and jeopardize the tested stability of Debian.
So
PyEnv
comes to the rescue.Install Pyenv and Python 3.11.0
curl https://pyenv.run | bash pyenv install 3.11.0
Compile/Install Python 3.11 and make it the global version of Python:
Now Python 3.11.0 should be the default
Perfect, let's install Poetry and init a project using Python 3.11.0
Ooops, somehow Poetry is still picking up Python 3.9.2
Interesting output for
poetry debug info
:poetry env use 3.11
does not help eitherThe text was updated successfully, but these errors were encountered: