-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Old dependency from install_requires not removed from env after removal from manifest #1890
Comments
I've just spotted the Is there anywhere I can read up on why |
Yes. Search the issues for the thoroughly outlined discussion about the Pipenv is not magic. It doesn’t confirm that the accumulated resolved dependencies are all that is installed. |
Ok, that mostly makes sense. The word You say that nothing pipenv does is secretly destructive - but does that mean It would be useful to future users if the documentation contained an overview of the commands and the scenarios they're expected to be used. The same behaviour is seen if a dependency is removed from the |
If re-resolving dependencies results in a lower version being put in the lockfile, So does pipenv refuse to downgrade something that was explicitly resolved to a lower version? No. That is not a secret action. It is a strict pin in the lockfile. Things in the lockfile always get installed in the environment. Just imagine as if we iterate over the list of things we determined need to be installed and for each of those we It may not have been obvious to you, but I would be interested in seeing an example of dependency management software that behaves the way you expect pipenv to behave. |
@techalchemy - In the sense of "deleting things that are no longer specified?". NPM 5 in the JS world, or Gradle/Maven in the Java world. |
@tsiq-oliverc can you link an example of how that works? I'm not sure that makes sense here given the above use cases but I want to be sure (for instance what happens if the user is working in the global namespace with the npm usecase?) |
This is the piece of information which I was missing makes everything else fall into place. Because
The Bundler behaviour is also similar, although because it works by assembling a complicated load path pointing to centrally stored depdendencies the comparison isn't quite the same - removing things from your lockfile removes them from your bundle - but the files themselves stay intact. I believe this is pretty much what maven and gradle do too. I wonder if it would be possible for pipenv to mark the virtualenvs it creates in some way as "fully managed", which could default to the I see that the |
@techalchemy - Basically what @glenjamin said. NPM/Yarn's global thing is a bit of a special snowflake, which one generally tries to avoid if trying to construct a repo with reproducible build results. And you get this behaviour by default in the Java world (with Maven/Gradle/etc.) - the Gradle cache is not affected by removing deps in your build files, but the classpath exposed to your compiler/app is. Coming from these worlds, the current behaviour of More generally, ignoring the global/system issue, the idea of a virtualenv that's not fully managed is going to lead to all sorts of issues - there are a bunch of beneficial invariants that one has to give up. Is that really a tax that Pipenv wants to endure? |
Our documentation definitely needs a good update. We can consider removing dependencies, but I feel like we did discuss it at some point. I will try to find the discussion. I get the usability perspective....will need to consider the possible consequences |
@tsiq-oliverc I don’t object your point, just want to add a note.
Unfortunately this is not how Python (and Node, for this particular matter) packages work. If it’s installed, it is visible for import. That is probably why NPM and Yarn don’t do it by default as well. |
I think there are two related discussion points here.
As a point of comparison, npm < 5 didn’t use a lock file by default, and has However, whenever a lockfile is present, which is “always” in npm 5, the |
@uranusjr - Indeed. In practice that's achieved by leaving things in the Gradle cache, and dynamically constructing a classpath pointing to each "available" lib in the cache. I suppose a big difference is that Gradle doesn't have to build dependencies from source; once you download a Jar/Pom into the cache you're done. Though naively it doesn't strike me as impossible for Python deps to be cached post-build, as an optimisation for a world where |
@tsiq-oliverc Python already does. I don’t know when it started, but modern pip versions build a wheel when you install from source. That wheel (binary format analogous to Java’s jar) is cached locally, so you don’t have to download/build it again next time you want to install the same package. Wheels, however, generally depends on the Python interpreter’s version (unless it’s pure Python, but in which case the build overhead is minimal anyway), and the cache is global, so the probability of cache misses are much higher. It also does not cache everything (e.g. VCS installations), leaving Pipenv in a strange place. |
No use beating the dead horse though. We should decide whether to go this route based solely on whether it is easy enough to do in Python. How and why Java does this is not really relevant. |
After removing a dependency from
install_requires
in my setup.py, and runningpipenv update
, the removed dependency is still present in the environment.Please run
$ python -m pipenv.help
, and paste the results here.Pipenv version:
'11.8.0'
Pipenv location:
'/usr/local/Cellar/pipenv/11.8.0/libexec/lib/python3.6/site-packages/pipenv'
Python location:
'/usr/local/Cellar/pipenv/11.8.0/libexec/bin/python'
Other Python installations in
PATH
:2.7
:/usr/local/bin/python2.7
2.7
:/usr/local/bin/python2.7
2.7
:/usr/bin/python2.7
3.6
:/usr/local/bin/python3.6m
3.6
:/usr/local/bin/python3.6
2.7.14
:/usr/local/bin/python
2.7.10
:/usr/bin/python
2.7.14
:/usr/local/bin/python2
3.6.4
:/usr/local/bin/python3
PEP 508 Information:
Expected result
I would expect that the dependency is removed from the environment, as nothing depends on it anymore.
Actual result
See detailed steps to replicate below:
Steps to replicate
Create the following simple
setup.py
Create a new pipenv by installing the current directory as editable
pipenv install -e .
Check the dependency graph for the env, all looks good:
Update
setup.py
to comment out the one dependency - this simulates removing a dependencyRun
pipenv update
to update the lockfile and environmentRun
pipenv graph
to view the environmentplain-obj
is still there - although it is no longer present in the lockfile.The text was updated successfully, but these errors were encountered: