How to Fix "PyCharm Unable to Find Installed Packages" on Windows and macOS
If PyCharm is unable to find installed Python packages, it can disrupt your development process, especially when you rely on third-party libraries for your project.
This issue could be related to incorrect interpreter settings, missing packages, or virtual environment configuration.
Here’s a comprehensive guide to fix the problem: First, ensure that the package is installed in the correct Python environment.
Open a terminal window and use the following command to check if the package is installed: pip show <package-name>
.
If the package isn’t listed, you’ll need to install it using pip install <package-name>
.
If the package is installed but PyCharm cannot find it, the issue is likely related to the interpreter configuration.
In PyCharm, go to File > Settings > Project: <your project name> > Python Interpreter
and make sure the correct interpreter is selected.
If you’re using a virtual environment, ensure it’s activated and selected in this menu.
If the correct interpreter is selected and PyCharm still can’t find the package, try refreshing the interpreter’s package list.
Click the Refresh
button (a circular arrow icon) in the Python Interpreter settings to force PyCharm to update the list of installed packages.
If refreshing doesn’t work, try manually adding the package to the interpreter.
In the Python Interpreter settings, click the +
icon, search for the package, and click Install Package
.
PyCharm should then detect and install the package.
If PyCharm still cannot detect the installed packages, check your system’s environment variables.
Ensure that the PYTHONPATH
variable is set correctly.
On Windows, go to Control Panel > System > Advanced System Settings > Environment Variables
and check if PYTHONPATH
includes the directory where your packages are installed.
On macOS and Linux, check the ~/.bash_profile
or ~/.zshrc
files to make sure the correct Python directory is included.
Restart PyCharm after making any changes to the environment variables.
Another potential solution is to invalidate PyCharm’s cache.
If PyCharm’s cache is outdated or corrupted, it might not detect installed packages properly.
Go to File > Invalidate Caches / Restart
and select Invalidate and Restart
.
After PyCharm restarts, it will rebuild the cache and might correctly detect the installed packages.
If none of these solutions resolve the issue, consider reinstalling PyCharm and Python.
Perform a clean installation by uninstalling both, removing all configuration files, and downloading the latest versions of both PyCharm and Python from the [official websites](https://www.jetbrains.com/pycharm/download/ and https://www.python.org/).
This should resolve any lingering configuration issues and restore the proper detection of installed packages.