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 be available 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 or a text 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... 

Tip about package installation issue:

In case you can successfully install and use a package with another interpreter in the system terminal (not the one you are using in IDE), you may consider configuring it as your Project Interpreter.

34 out of 224 found this helpful
2 comments

Hi, I am completely new to the Pycharm & coding. I want to start using Pycharm to extract data from a pdf file & so I want to install a package. I tried to follow the steps mentioned by some nice people on youtube where they asked me to File>Settings>Projectname>Project Interpreter & follow the next steps he telling me but on this screen I see an error as Non-zero exit code (103). Above someone said below. What does that mean?

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

0

It seems to be a "known" issue of Pycharm with x64 OS.

Tried without any success both Win10 latest version, and Ubuntu latest version.

Win 10, I'm now stuck, after trying to install it without pre-installing any python environment (now 3.9.2). So it said "no interpreter".

Then installing both x86 and x64 versions of python, and running Pycharm again, it does not recognize any, and after deleting "main.py" it sent the following screen:wing attached screen.

0

Please sign in to leave a comment.

Have more questions?

Submit a request