PyCharm can't install/import a package/library/module

Note: Having installed something from the system terminal/cmd prompt doesn't always mean it will appear in PyCharm.

Troubleshooting:

Try installing/importing a package from the system terminal (outside of PyCharm) using the same interpreter/environment.

In case you are using a virtualenv/conda environment as your Project Interpreter in PyCharm, it is enough to activate that environment in the system terminal and then do the test.
Example for virtualenv and conda environment:

a) Go to File | Settings | Project: <project_name> | Project Interpreter (Preferences | Project: <project_name> | Project Interpreter for macOS) to find where your environment/interpreter is located;

b) Open your system terminal/cmd prompt and activate the same environment;

E.g. source .virtualenvs/<environment_name>/bin/activate or conda activate <environment_name>

Docs about virtualenv activation.

Docs about conda environment activation.

c) Depending on what isn't working:

    - run python <path_to_script> if you have problems importing some package in PyCharm

You may as well copy the executed by PyCharm command from Run window, paste it to the terminal and run. Example of such command:

mceclip0.png

    - run pip install <package_name> or conda install <package_name> accordingly if you have problems installing a package in PyCharm;

Note: be sure your terminal is not activating some environment by default. It is a common case with the base environment after Anaconda/Miniconda installation.

Understanding results:

If it fails with the same error as in PyCharm - the problem is most likely not related to PyCharm. Search the web for similar problems and possible solutions (StackOverflow, python forums, etc.). It is likely to be related to pip, your environment or some compatibility issue.

If it is installed/executed successfully - just to be sure, check one more time that you are using the same environment/interpreter and if so, file an issue to PyCharm issue tracker providing the information as described in the paragraph below.

Reporting to PyCharm issue tracker:

The following information will help us investigate the issue in depth. We kindly ask you to provide it when reporting an issue.

Problem importing a package:

1. The whole console output including the executed command in PyCharm.

2. A screenshot of your Project Interpreter including the list of installed packages. If it's not possible to capture all of the installed packages in one picture, it's better to provide a text file (pip list or pip freeze > requirements.txt will do the trick https://pip.pypa.io/en/stable/user_guide/)

3. A screenshot showing the successful import of the package in the system terminal with the same environment/interpreter.

4. idea.log file from Help | Show Log in...

Problem installing a package:

1. A screenshot of the whole window with the error message.

2. A screenshot showing the successful installation of the package in the system terminal with the same environment/interpreter.

3. idea.log file from Help | Show Log in... 

Please sign in to leave a comment.

Have more questions?

Submit a request