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 re-installs up-to-date packages when virtualenvs.create is false #1711

Closed
3 tasks done
jstriebel opened this issue Dec 12, 2019 · 8 comments · Fixed by #1786
Closed
3 tasks done

poetry re-installs up-to-date packages when virtualenvs.create is false #1711

jstriebel opened this issue Dec 12, 2019 · 8 comments · Fixed by #1786
Labels
kind/bug Something isn't working as expected

Comments

@jstriebel
Copy link
Contributor

  • I am on the latest Poetry version. (1.0.0b9)

  • 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: Debian buster

  • Poetry version: 1.0.0b9

Issue

Thanks for the great work! With current releases we experience that already up-to-date packages (with the correct versions) are reinstalled by poetry, as it tries to update them. This seems to happen because we don't use poetry's virtualenv feature (using poetry config virtualenvs.create false).

Here's a part of the poetry install output, when running it the second time:

  - Updating humanfriendly (4.18 /usr/local/lib/python3.6/dist-packages -> 4.18)
  - Updating imageio (2.6.1 /usr/local/lib/python3.6/dist-packages -> 2.6.1)
  - Updating importlab (0.5.1 /usr/local/lib/python3.6/dist-packages -> 0.5.1)

It seems that dist-packages can never match the version, so poetry tries to upgrade them, even when the version actually matches.

Output of poetry debug info:

Poetry
Version: 1.0.0b9
Python:  3.6.8

Virtualenv
Python:         3.6.8
Implementation: CPython
Path:           NA

System
Platform: linux
OS:       posix
Python:   /usr
@jstriebel jstriebel added the kind/bug Something isn't working as expected label Dec 12, 2019
@jstriebel
Copy link
Contributor Author

Just tested this again with poetry 1.0.0, this behavior did not change.

#1732 seems to be a duplicate of this one.

@etijskens
Copy link

a similar problem:
I would like to deploy my projects on a HPC cluster. On this system Python versions are made available by loading modules, and they come with a number of pre-installed python packages that are optimised for our hardware, e.g. numpy 1.17.0. I create a virtual environment in the project root directory like this:

python -m venv .venv --system-site-packages

In this way the optimised Numpy is visible in the virtual environment. My project has a dependency
numpy = "^1.17.0" specified in the pyproject.toml file. When running poetry install it updates to the latest numpy 1.17.4. The newly installed numpy is not optimised for our hardware and in addition it consumes a lot of my file quota on the machine. This is certainly not desired behaviour, at least not in my case. Is there a way to tell poetry not to update if there is a version available that satisfies the version specification?

@etijskens
Copy link

On the other hand pip install my_project does exactly what I need - with exactly the same requirements. It looks to me that poetry install behaves rather as poetry update.

Still I would expect poetry install not to install dependencies if they are already present in the
virtual environment and satisfy the requirements, or at least to have a switch available to make it do so, although I do not see the need for a poetry update command in that case

@simoncoulton
Copy link

simoncoulton commented Dec 17, 2019

Noticing this here as well. This is particularly an issue with docker multistage builds and anything that requires psycopg2 (since you want your containers to be small, you're doing any build from source related tasks in the build stage, but then Poetry tries to reinstall it and it crashes and burns).

EDIT: Works fine with 0.12.17

@jstriebel
Copy link
Contributor Author

@etijskens This issue is about re-installing exactly the same version. One part of your issue can be solved by fixing the exact version in the pyproject.toml, e.g. numpy = "1.17.0". Unfortunately you will then run into the problem this issue is about, because even then the package will be re-installed, which should not be the case. If you don't need the poetry 1.0.0 features using an older poetry version (e.g. 0.12.17) might be a viable workaround for you.

@jstriebel
Copy link
Contributor Author

Thanks @sdispater, I can confirm that this is fixed in the current master 👍

@jstriebel
Copy link
Contributor Author

@sdispater Unfortunately the same issue is happening now with poetry 1.0.1 and 1.0.2 for site-packages. I opened a seperate issue for this, #1882.

Copy link

github-actions bot commented Mar 3, 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 3, 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.

3 participants