-
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
Up-to-date packages are re-installed if virtualenvs.create is false #4358
Comments
Recent releases of poetry do not install any packages in docker system packages if this is set:
|
Good point, I experienced this as well! I also re-tested this issue and could reproduce the bug with the current commit 82459bd. |
Re-tested this again with the current commit 0b8ef3a, the issue still persists. |
@jstriebel the root cause here is the
root@413fb0865efc:/# python3 -m site
sys.path = [
'/',
'/usr/lib/python38.zip',
'/usr/lib/python3.8',
'/usr/lib/python3.8/lib-dynload',
'/root/.local/lib/python3.8/site-packages',
'/usr/local/lib/python3.8/dist-packages',
'/usr/lib/python3/dist-packages',
]
USER_BASE: '/root/.local' (exists)
USER_SITE: '/root/.local/lib/python3.8/site-packages' (exists)
ENABLE_USER_SITE: True
You can work around this issue by setting ENV PYTHONPATH=/usr/lib/python3.8/site-packages Poetry could try passing Personally, I would always recommend using a virtual environment, even in containers. A lot less volatility. Additionally, you can verify that this scenario works without issue in another image like shown here. podman run --rm -i --entrypoint bash python:3.10 <<EOF
set -xe
python -m pip install -q git+https://github.com/python-poetry/poetry.git@master
poetry config virtualenvs.create false
poetry new foobar
pushd foobar
poetry add pycowsay
poetry install
poetry install
EOF + python -m pip install git+https://github.com/python-poetry/poetry.git@master
+ poetry config virtualenvs.create false
+ poetry new foobar
Created package foobar in foobar
+ pushd foobar
/foobar /
+ poetry add pycowsay
Skipping virtualenv creation, as specified in config file.
Using version ^0.0.0.1 for pycowsay
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
• Installing pycowsay (0.0.0.1)
+ poetry install
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: foobar (0.1.0)
+ poetry install
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: foobar (0.1.0) |
@abn Thanks a lot for the detailed answer, and sorry for my late reply. I agree, that this seems to be a bug in the configuration. Should
How about simply not providing
Only the dist-packages directory, not for site-packages, right? I'm very grateful that you are helping to deal with the package installation chaos! Thanks a ton for your work 🙏 The only "fix"/"workaround" I could see atm is removing the |
Re-opening #4254, which was closed wrongly, #4329 does not fix this bug.
I am on the
latestcurrent master (22c3aad) 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 20.04
Poetry version: current master (22c3aad) (also tested with version
1.2.0a2
)Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/jstriebel/6e804c769e2075be390496e68474a36c
Issue
Packages that were already installed (by poetry itself) are re-installed if
virtualenvs.create
is false. This bug only appears on v1.2, it does not occur on the1.1
branch or the latest v1.1 releases. I added a reproducible case via a Dockerfile in the linked gist.When running
docker build .
on those files, this produces:The packages are not installed twice if
virtualenvs.create
is true (tested by commenting out theCOPY poetry.toml /
line).Possibly related previous issues: #1711, #1882 (solved in previous releases, but re-introduced in v1.2)
Given that this was broken multiple times in different ways now, and was not fixed by #4329 as intended, would it be possible to add some tests for this case as well? I'd be happy to help here, but have no experience with the poetry code-base.
The text was updated successfully, but these errors were encountered: