Pipenv uninstall doesn't uninstall dependencies
See original GitHub issueWhen I run pipenv uninstall, I am counting on uninstalling the package with all it’s dependencies that are not shared with other packages.
Maybe having this behaviour by default is too aggressive, but having at least a flag would be awesome.
Describe your environment
- OS Type: Linux
- Python version:
$ python -V
Python 3.6.4 - Pipenv version:
$ pipenv --version
pipenv, version 9.0.3
Expected result
I would expect pipenv to uninstall all dependencies of distex (dill, cloudpickle).
Actual result
(mos-bot-NUxJbKoW) javier@sam> pipenv install distex
Installing distex…
Collecting distex
Downloading distex-0.5.6-py3-none-any.whl
Collecting dill (from distex)
Downloading dill-0.2.7.1.tar.gz (64kB)
Collecting cloudpickle (from distex)
Downloading cloudpickle-0.5.2-py2.py3-none-any.whl
Building wheels for collected packages: dill
Running setup.py bdist_wheel for dill: started
Running setup.py bdist_wheel for dill: finished with status 'done'
Stored in directory: /.../.cache/pip/wheels/e5/88/fe/7e290ce5bb39d531eb9bee5cf254ba1c3e3c7ba3339ce67bee
Successfully built dill
Installing collected packages: dill, cloudpickle, distex
Successfully installed cloudpickle-0.5.2 dill-0.2.7.1 distex-0.5.6
Adding distex to Pipfile's [packages]…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (8bce4b)!
(mos-bot-NUxJbKoW) javier@sam > pipenv uninstall distex
Un-installing distex…
Uninstalling distex-0.5.6:
Successfully uninstalled distex-0.5.6
Removing distex from Pipfile…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (154010)!
Steps to replicate
pipenv install distex
pipenv uninstall distex
Here all 3 packages should be deleted
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
pipenv uninstall doesn't remove dependencies from virtualenv
I'm not sure if this is intentional, but pipenv uninstall only removes the package, not it's dependencies from the venv.
Read more >How to autoremove dependent Python packages within a ...
Uninstalling that package with pipenv uninstall will not remove the dependent packages automatically. How to get the equivalent functionality of ...
Read more >How to Uninstall Python Packages - ActiveState
How to Uninstall Package Dependencies with Pipenv · Open a command or terminal window · cd into the project directory · pipenv uninstall...
Read more >pipenv uninstall [package] - Fig.io
Uninstalls a provided package and removes it from Pipfile.
Read more >Basic Usage of Pipenv - Read the Docs
The three primary commands you'll use in managing your pipenv environment are $ pipenv install , $ pipenv uninstall , and $ pipenv...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Pipenv uses pip underneath to install/uninstall packages, and is therefore not able to do well here because pip does not have a dependency resolver, and has no way to know whether a dependency is no longer needed. Pipenv, therefore, cannot do this at the moment.
It is technically possible to implement a
pipenv clean
command, that functions similar toapt autoremove
. The command would compare the current environment to the lock file, and remove all packages not in it. I’m not sure if anyone is interested in implementing this, or if it would be accepted (although I’m personally +1 to this).This process will work but very slow as it delete the full virtual environment and reinstall all the main dependencies.