-
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 removes it's own dependencies with install --no-dev
when it manages the environment it is installed in
#3957
Comments
This is expected, since you are asking poetry to manage the system site, the same that you have installed poetry into. I suspect here the case is because Honestly, creating a virtual environment for the project does not save any meaningful amount of resources and it causes more problems than it solves. And with upcoming release of poetry you can even create virtual envs without any packages (incl. pip, setuptools). Alternatively, you can also just do |
If this is expected, it's for sure not documented properly. Both in the documentation and when just using But even if the
|
I ran into a similar issue on Travis where The issue only arises with Python 3.6 and PyPy (see https://travis-ci.com/github/AlexandreDecan/portion/builds/223762003) but I think it's a consequence of I agree with @gbdlin that ideally, something should be done about this (esp. since I also did not expect |
@gbdlin I agree that poetry's behaviour is invalid but for now you can avoid the problem by installing poetry in isolated environment: |
Duplicate of #3139? (at least that one is older, and covers removal of |
|
I am just hitting this issue myself now. It seems like the behaviour that I am after is pretty much for poetry to be treated like a runtime dependency of the project, but NOT added as an actual dependency of any packages built and pushed to a PyPi repo. Is there any clean way to get that behaviour? I get that the |
Yes, we have been hitting this issue as well (we call it the "suicide" behaviour) Could simply the behavior of |
I think a better approach would be to have a |
I feel like this is the right answer. (I only found this by accident because of something related, but I too use poetry in a Docker image with edited.. Wait, is it impossible? Maybe I'm trying to make a distinction without a difference. |
This has change with poetry 1.2.0a2: Poetry wan't remove installed packages unless the However, if a dependency will be removed due to a version change e.g. on fin swimmer |
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. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
Well... This issue is mentioned by @sontek in Poetry install removes packages that are necessary #3139 (comment)_ but the response below advises to create a new issue, so here I am.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: Docker image based on
python:3.9.1
Poetry version: 1.1.6
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/gbdlin/311dda3cd34672370cd97bf07f306a61
Issue
When you specify a package in the
dev-dependencies
that is either a dependency of the poetry itself or it depends on one of the poetry dependencies, and you've installed poetry inside an environment that poetry is supposed to manage, poetry will uninstall this mentioned dependency after invokingpoetry install --no-dev
, making itself unusable in the future.I'm aware that it is advised to install poetry outside of the environment it should manage, but this is very often seen inside docker images (such example provided in the gist linked above) to save on the resources.
Example output presenting mentioned issue (without
-vvv
ands):As you can see,
appdirs
, which is required by the poetry, was uninstalled by poetry. Full log, with the-vvv
and the attempt to run poetry again, available hereThe text was updated successfully, but these errors were encountered: