Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pipenv uninstall doesn't uninstall dependencies

See original GitHub issue

When 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
  1. OS Type: Linux
  2. Python version: $ python -V Python 3.6.4
  3. 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- (64kB)
Collecting cloudpickle (from distex)
  Downloading cloudpickle-0.5.2-py2.py3-none-any.whl
Building wheels for collected packages: dill
  Running bdist_wheel for dill: started
  Running 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- 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

uranusjrcommented, Feb 22, 2018

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 to apt 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).

il6commented, Mar 31, 2020
pipenv --rm
pipenv install

This process will work but very slow as it delete the full virtual environment and reinstall all the main dependencies.

Read more comments on GitHub >

github_iconTop 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] -
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found