-
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
Ubuntu 22.04, Python 3.10, and broken virtual environment layouts #6371
Comments
N.b. I hadn't even run
|
I appear to be unable to tell poetry which Python to use, either:
|
I think this is actually the old |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
We're still trying to fully understand how we can work around the regression in Debian/Ubuntu as they don't appear willing to walk back the changes. I am not sure why you're having that issue with It is important to note that the issue is not in Poetry, but is in the virutualenv package which we consume. It is still considered unsolved there, as the changes made by Debian/Ubuntu result in an invalid virtual environment according to the spec: pypa/virtualenv#2350 |
OK. To confirm, does |
From a practical standpoint, it's the known workaround right now. Fundamentally this is unsolved and upstream seems intransigent or indifferent (see: https://bugs.launchpad.net/ubuntu/+source/python3.10/+bug/1967920). The deadsnakes PPA solves this with a patch on top of the Debian 3.10 patches. Ideally this would get solved in The best solution is to use a Python.org Python (aka a build from source installed into |
Thanks for the expansion. I understand now. I encountered this problem while trying Poetry 1.2.0 in a container to test how installation of plugins would work (globally at Poetry level or per-project), as I eventually went to Discord to discuss! Thanks for your time on this, I really appreciate it. |
I should add that my team's normal way of managing our Pythons is through pyenv for our workstations and conda for our production containers. So, this issue isn't a major blocker for us! |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi! Is there a workaround to this issue? I've tried using Thanks! |
You should ideally set it before ever installing Poetry -- however, I am reasonably sure that setting it during env creation (e.g. |
Use https://github.com/jedie/manageprojects and the CookieCutter Template: https://github.com/jedie/cookiecutter_templates/tree/main/poetry-python to modernize the project setup. But use only a few ideas from the origin template: * set min. Python version to v3.9 * Add `mypy` (But don't include it in tests/CI) * Bugfix poetry bootstrap by call `python3 -m venv .venv` first, see: python-poetry/poetry#6371 * Use the official way to install poetry, see: https://python-poetry.org/docs/#installing-with-the-official-installer (Personally i prefere using pipx) * Remove hardcoded version number from `bx_py_utils/__init__.py`, so we must only change the version in `pyproject.toml`
Use https://github.com/jedie/manageprojects and the CookieCutter Template: https://github.com/jedie/cookiecutter_templates/tree/main/poetry-python to modernize the project setup. But use only a few ideas from the origin template: * set min. Python version to v3.9 and add 3.11 to tests * Add `mypy` (But don't include it in tests/CI) * Bugfix poetry bootstrap by call `python3 -m venv .venv` first, see: python-poetry/poetry#6371 * Use the official way to install poetry, see: https://python-poetry.org/docs/#installing-with-the-official-installer (Personally i prefere using pipx) * Remove hardcoded version number from `bx_py_utils/__init__.py`, so we must only change the version in `pyproject.toml`
I also ran into this problem and didn't know about the The first "poetry error" (by which I don't mean that poetry is doing anything wrong) in the trace comes from the This seems very weird because when I create the venv myself the bin directory does exist so I'm not sure what's happening internally for this bin directory to not get made. Like I say I hope this is helpful to others and helps any debugging/patching effort either here or in Ubuntu upstream. Will try the environment variable setup now |
I found that installing Debian's |
I have been trying for weeks to get Poetry working with Ubuntu 22.04: Tried:
Running anything related to poetry simply fails, this is a brand new Ubuntu 22.04 VM |
Had this issue as well inside VSCode's integrated terminal. It seems VSCode does some kind of venv activation automatically when starting up the integrated terminal, which you can get out of with the The end result in my case was that removing Poetry (1.6.1) and then reinstalling Poetry (1.7.1) with the install script solved my issue. After I had done so, however, I noticed I was still in the venv in VSCode's integrated terminal. I wonder what would have happened if I had used |
Tried many things suggested here and in other places, but nothing worked. Eventually removing the cache as suggested in this comment did the trick: rm -r ~/.cache/pypoetry |
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: Ubuntu Jammy
Poetry version: 1.2.0
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/colindean/27d36dcc7cf78f722f374ebd5bfd970f (also contains log output and a brief description of env setup steps)
Issue
I believe the problem is in here:
poetry/src/poetry/utils/env.py
Lines 1231 to 1248 in f1af3f8
Ubuntu doesn't provide a
python
command anymore, justpython3
:Seeing as though all supported versions of Python on which Poetry runs should also provide a
python3
executable, perhaps the fallback here should bepython3
?poetry/src/poetry/utils/env.py
Line 1178 in f1af3f8
The text was updated successfully, but these errors were encountered: