question-mark
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.

pip.get_installed_distributions() doesn't check if a package has been uninstalled (or added)

See original GitHub issue

It seems there is no way to ask pip to re-check if his modules are still present. Let suppose I have a module astroid.

# in Python console1
import pip
pip.get_installed_distributions()  # will show `astroid`module

then open another Python console2

# in Python console2
pip uninstall astroid

Python console1 will continue to claim astroid module is there is I redo a

# in Python console1 (that is not closed)
pip.get_installed_distributions()  # will shows wrongfully  `astroid`module

==> Would it be possible to have an option that will force a refresh ?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jaracocommented, Apr 26, 2015

So, for a workaround, you can do this:

import imp, pip
def refresh_packages():
    pip.utils.pkg_resources = imp.reload(pip.utils.pkg_resources)
0reactions
rbtcollinscommented, Apr 26, 2015

Yah - thats one of the reasons reload is rarely the right thing 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get this when using pip WARNING: Ignoring invalid ...
It got fixed by going to site-packages and deleting the folders starting with ~. >pip install pyspark WARNING: Ignoring invalid distribution ...
Read more >
Using Python's pip to Manage Your Projects' Dependencies
Install and uninstall packages with pip; Manage projects' dependencies using requirements files. You can do a lot with pip , but the Python ......
Read more >
Installing scikit-image — skimage v0.19.2 docs
To see whether scikit-image is already installed or to check if an install has worked, run the following in a Python shell or...
Read more >
Notebook-scoped Python libraries | Databricks on AWS
Notebook-scoped libraries do not persist across sessions. ... You can use %pip to install a private package that has been saved on DBFS....
Read more >
Python Package Installation on Windows - ActiveState
Click to learn why the Pip Package Manager is the de facto standard for managing Python distributions, and is recommended for installing ......
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found