Skip to content
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 always updates packages when installed to system python #2079

Closed
3 tasks done
artslob opened this issue Feb 24, 2020 · 7 comments · Fixed by #2360
Closed
3 tasks done

Poetry always updates packages when installed to system python #2079

artslob opened this issue Feb 24, 2020 · 7 comments · Fixed by #2360
Labels
kind/bug Something isn't working as expected
Milestone

Comments

@artslob
Copy link

artslob commented Feb 24, 2020

  • 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).

Issue

In gist link I attached Dockerfile, pyproject.toml and poetry.lock files. Issue is when building docker image I used poetry config virtualenvs.create false to install dependencies to current system python interpreter. It works, but executing poetry install several times always updates some packages, which already installed:

Step 6/7 : RUN poetry install
 ---> Running in 482dd5a533eb
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file


Package operations: 0 installs, 13 updates, 0 removals

  - Updating six (1.14.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.14.0)
  - Updating pycparser (2.19 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.19)
  - Updating webencodings (0.5.1 /root/.poetry/lib/poetry/_vendor/py3.7 -> 0.5.1)
  - Updating zipp (1.1.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.2.0)
  - Updating certifi (2019.11.28 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2019.11.28)
  - Updating cffi (1.13.2 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.14.0)
  - Updating chardet (3.0.4 /root/.poetry/lib/poetry/_vendor/py3.7 -> 3.0.4)
  - Updating idna (2.8 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.9)
  - Updating importlib-metadata (1.1.3 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.5.0)
  - Updating pyparsing (2.4.6 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.4.6)
  - Updating urllib3 (1.25.8 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.25.8)
  - Updating attrs (19.3.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 19.3.0)
  - Updating requests (2.22.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.23.0)
Removing intermediate container 482dd5a533eb
 ---> 925b32fada09
Step 7/7 : RUN poetry install
 ---> Running in e32deef3d215
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file


Package operations: 0 installs, 13 updates, 0 removals

  - Updating six (1.14.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.14.0)
  - Updating pycparser (2.19 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.19)
  - Updating webencodings (0.5.1 /root/.poetry/lib/poetry/_vendor/py3.7 -> 0.5.1)
  - Updating zipp (1.1.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.2.0)
  - Updating certifi (2019.11.28 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2019.11.28)
  - Updating cffi (1.13.2 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.14.0)
  - Updating chardet (3.0.4 /root/.poetry/lib/poetry/_vendor/py3.7 -> 3.0.4)
  - Updating idna (2.8 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.9)
  - Updating importlib-metadata (1.1.3 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.5.0)
  - Updating pyparsing (2.4.6 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.4.6)
  - Updating urllib3 (1.25.8 /root/.poetry/lib/poetry/_vendor/py3.7 -> 1.25.8)
  - Updating attrs (19.3.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 19.3.0)
  - Updating requests (2.22.0 /root/.poetry/lib/poetry/_vendor/py3.7 -> 2.23.0)
Removing intermediate container e32deef3d215
 ---> 8b888f67dd60

But if set poetry config virtualenvs.create to default (to true) and create and activate virtualenv, then several poetry install works as expected and exit fast, because all packages already installed:

Installing dependencies from lock file

No dependencies to install or update
@artslob artslob added the kind/bug Something isn't working as expected label Feb 24, 2020
@danmur
Copy link

danmur commented Mar 3, 2020

I have this problem too, but in my case I'm not using the system Python, it seems to be to do with private repos. I'll mention it here since the symptom is the same. I fixed it by removing type = "legacy" from all the package references in my poetry.lock since a new project I checked didn't have the same problem, and it didn't have that.

@flokno
Copy link

flokno commented Mar 10, 2020

I see the same in a self created venv created via python -m venv venv with poetry 1.0.5.
Repeated poetry install always updates all packages although they are already up to date:
image

@artslob
Copy link
Author

artslob commented Apr 11, 2020

Looks like it was solved in #1981 (issue #1883) and relesead in 1.0.4. I tested in 1.0.5 and repeated install command now prints No dependencies to install or update as expected.

Do not close issue because of @flokno message.

@trim21
Copy link
Contributor

trim21 commented Apr 12, 2020

I guess they are not same bug. Package in vendor is not recognized as installed packages here. And I can't reproduce it, either.

@abn abn added this to the 1.1 milestone Apr 29, 2020
@abn abn closed this as completed Apr 29, 2020
@abn abn linked a pull request Apr 29, 2020 that will close this issue
2 tasks
@HodeiG
Copy link

HodeiG commented Jul 6, 2020

I was experiencing the same issue with poetry 1.0.9.

I managed to narrow down the issue to some old "export PYTHONPATH" in my .bashrc file. After getting rid of that export, the issue went away.

[optional] Debugging steps:
Basically, in poetry/repositories/installed_repository.py I noticed that one of the entries '/home/hodei/src/my_package' would fail at

path.relative_to(src_path)
:

ValueError: '/home/hodei/src/my_package/my_pakcage.egg-info' does not start with '/home/hodei/src/my_package/.venv/src'

Due to the above, all the packages "source_type" were getting marked as "directory" type. Later on, during the installation because of the different "source_type", at line

elif pkg.source_type and package.source_type != pkg.source_type:
, all the packages were getting marked for an update, causing the problem described in this Issue.

Before removing the export, my sys.path was:

$ echo $PYTHONPATH 
/home/hodei/.local/lib/python/site-packages:/home/hodei/local/lib/python2.7/site-packages:
$ cd src/my_package
$ source .venv/bin/activate
$ python -c "import sys; print(sys.path)"
['', '/home/hodei/.local/lib/python/site-packages', '/home/hodei/local/lib/python2.7/site-packages', '/home/hodei/src/my_package', '/home/hodei/.pyenv/versions/3.7.7/lib/python37.zip', '/home/hodei/.pyenv/versions/3.7.7/lib/python3.7', '/home/hodei/.pyenv/versions/3.7.7/lib/python3.7/lib-dynload', '/home/hodei/src/my_package/.venv/lib/python3.7/site-packages']

After removing the export, my sys.path was:

$ unset PYTHONPATH
$ cd src/my_package
$ source .venv/bin/activate
$python -c "import sys; print(sys.path)"
['', '/home/hodei/.pyenv/versions/3.7.7/lib/python37.zip', '/home/hodei/.pyenv/versions/3.7.7/lib/python3.7', '/home/hodei/.pyenv/versions/3.7.7/lib/python3.7/lib-dynload', '/home/hodei/src/my_package/.venv/lib/python3.7/site-packages', '/home/hodei/src/my_package/.venv/src/trading-ig', '/home/hodei/src/my_package']

@daxartio
Copy link

Poetry always updates dependencies.

I have non root user pyuser.

Dockerfile example:

#...
USER pyuser

RUN pip install poetry==1.1.13 && poetry config virtualenvs.create false

#...

And poetry always updates installed dependencies.

Package operations: 0 installs, 190 updates, 0 removals

  • Updating pyasn1 (0.4.8 /home/pyuser/.local/lib/python3.9/site-packages -> 0.4.8)
  • Updating cachetools (4.2.4 /home/pyuser/.local/lib/python3.9/site-packages -> 4.2.4)
  • Updating certifi (2021.10.8 /home/pyuser/.local/lib/python3.9/site-packages -> 2022.6.15)
  • Updating charset-normalizer (2.0.12 /home/pyuser/.local/lib/python3.9/site-packages -> 2.0.12)
  • Updating idna (3.3 /home/pyuser/.local/lib/python3.9/site-packages -> 3.3)
  • Updating protobuf (3.20.1 /home/pyuser/.local/lib/python3.9/site-packages -> 3.20.1)
  • Updating pyasn1-modules (0.2.8 /home/pyuser/.local/lib/python3.9/site-packages -> 0.2.8)
  • Updating pyparsing (2.4.7 /home/pyuser/.local/lib/python3.9/site-packages -> 2.4.7)
  • Updating rsa (4.8 /home/pyuser/.local/lib/python3.9/site-packages -> 4.8)
  ...

How can i fix it?

Copy link

github-actions bot commented Mar 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants