Pycharm ошибка при установке модуля

You might encounter a problem when installing a Python package in the project settings or in the Python Package tool window. Eventually, most of the issues are out of IDE control as PyCharm uses the pip package manager to perform the actual installation.

This article provides troubleshooting tips and covers some typical cases.

Install a package using the Terminal

The most viable troubleshooting action is to try installing the problematic package on the selected Python interpreter using the terminal. If you get an identical error message, then the problem is not in the IDE and you should review the rationales and typical cases, or search for a solution on the Internet.

Install a package on a virtual environment

  1. Press Ctrl+Alt+S to open the IDE settings and select .

  2. Expand the list of the available interpreters and click Show All.

    Show all available interpreters

  3. Locate the target interpreter and press edit interpreter.

    Discover the interpreter path for the selected venv

    Copy or memorize the path of the virtual environment and close the dialogs.

  4. Open the terminal and run the following commands:

    source <venv path>/bin/activate
    pip install <package name>

    Installing a Python package on a virtual environment

  5. Inspect and parse the results.

Install a package on a Conda environment

  1. Open the terminal and run the following commands:

    Conda < 4.6

    Conda >= 4.6

    activate <conda env name>
    conda install <package name>

    conda activate <conda env name>
    conda install <package name>

    Conda < 4.6

    Conda >= 4.6

    source activate <conda env name>
    conda install <package name>

    conda activate <conda env name>
    conda install <package name>

    See Conda documentation for more information on how to activate an environment.

    Installing a Python package on a virtual environment

    One of the possible failure cases occurs when the target package is not available in the repositories supported by the Conda package manager.

    Fail to install a package on a Conda environment

  2. Inspect and parse the results.

Install a package on a system interpreter

  1. To check the path of the currently selected system interpreter that you were trying to install a package on, press Ctrl+Alt+S and go to .

  2. Expand the list of the project interpreters and scroll it down, then select the item.

    Selected Python interpreter

  3. Locate the interpreter and press edit interpreter.

    Discover the interpreter path for the selected venv

    Copy or memorize the path of the environment and close the dialogs.

  4. Open the terminal and run the following commands:

    cd <interpreter path>
    -m pip install <package name>

    Installing a Python package on a system environment

    You might need the admin privileges to install packages on a system interpreter.

  5. Inspect and parse the results.

Parse the results

Result

Action

The package cannot be installed because the Python version doesn’t satisfy the package requirement.

Try to create another Python interpreter that is based on the Python version that meets the requirement.

The package cannot be installed because you don’t have permissions to install it.

Try to install the package using super-user privileges, for example, sudo pip install <package name>.

The package cannot be installed because the package is not available in the repository that is supported by the selected package manager. Example: you’re trying to install a package that is not available in the Conda package manager repositories.

Try to configure another type of Python interpreter for your project and install the package on it. See how to add and modify a Python interpreter in Configure a Python interpreter.

The package cannot be installed and it matches one of the typical package installation failure cases.

Check the cases and apply related workarounds.

The package is successfully installed.

File an issue in the PyCharm issue tracker and provide explicit details about the case including all console output, error messages, and screenshots indicating that you tried to install the package on the same interpreter in the terminal and in the project settings or in the Python Packages tool window.

Review typical cases

Last modified: 16 December 2022

I have pycharm community edition(latest stable build) installed on my Ubuntu 16.04 LTS, I am not able to install packages via pycharm, was able to install them before. I can install the packages via pip, but would like to solve this issue.

Below is the Screenshot of the problem

enter image description here

Have googled for this issue, but could not find any fix, I have a windows machine and it does not face the same issue.

asked Oct 15, 2016 at 14:37

penta's user avatar

pentapenta

2,5064 gold badges24 silver badges50 bronze badges

2

I have got a solution, i reffered to https://youtrack.jetbrains.com/issue/PY-20081#u=1468410176856.

Here they have tried to add https://pypi.python.org/pypi as a repository.

To add it as a repository,

1.) Go to Settings
2.) Project interpreter
3.) Click the + sign on top right edge
4.) Go to manage repositories, 
5.) Press the + Sign, then add https://pypi.python.org/pypi
6.) Press Ok

Now all the packages should load.

Thanks Hami Torun & Simon, I was able to solve it by luck.

answered Oct 15, 2016 at 16:23

penta's user avatar

pentapenta

2,5064 gold badges24 silver badges50 bronze badges

3

I had the same issue. It happened suddenly, day ago I was able to perform pip or install packages but on the next day error appeared. However this helped (I used version PyCharm Community Edition 2018):

Go to Settings -> Project Interpreter -> click green «+» icon (on right) -> Manage Repositories (on bottom) -> delete https://pypi.python.org/simple -> add https://pypi.python.org/pypi
then click Ok. Repo will be back again as /simple, but don’t worry, error should disappear and you should be able to install packages again.

answered May 2, 2018 at 14:58

Belloz's user avatar

BellozBelloz

4235 silver badges9 bronze badges

2

For me, it was because of low space in my pc. After I free up space the problem solved. Pycharm did not say anything about this problem. It just shows that «the package installed successfully», but actually package was not installed.

answered Apr 15, 2019 at 19:52

saleh sereshki's user avatar

saleh sereshkisaleh sereshki

2,3823 gold badges16 silver badges18 bronze badges

I just had a similar problem.
My project was created by PyCharm, with venv.
The package I was installing via manager (Ctrl+Alt+S), was showing in the list, but it wasn’t being recognized or imported.

I believe the error happened because I tried to install it before, using pip install into IDE’s own terminal. Also pip version in the manager was a beta version, then I changed it to a stable version.

Had to start a new project in a new folder.

answered Nov 2, 2020 at 0:20

Marcelo Assis's user avatar

Marcelo AssisMarcelo Assis

5,1363 gold badges33 silver badges54 bronze badges

The accepted answer didn’t work for me. I had to update my pip version from the PyCharm terminal:

pip install --upgrade pip

answered Dec 3, 2020 at 23:46

ezra buchla's user avatar

ezra buchlaezra buchla

3192 silver badges6 bronze badges

enter image description here

I installed PyCharm and and Python 3 using the zip file. Now I want to install various libraries but it would not allow me to do so. How should I install the libraries on PyCharm?

asked Jun 19, 2018 at 20:02

JungleDiff's user avatar

i think you need to install setuptools

sudo apt-get install python3-setuptools

answered Jun 19, 2018 at 20:04

Druta Ruslan's user avatar

Druta RuslanDruta Ruslan

7,1212 gold badges28 silver badges38 bronze badges

Important Step:

Open Command Prompt in Windows
And Type pip install python3-setuptools

If First Step is throwing some Error

To solve this,you need to let python know where the pip packages are to do this follow the instructions below

First Go to Settings and select Project interpreter, now Click on Add button and switch to manage repositories option and now again press add button and type
https://pypi.python.org/pypi in the box and save.

Now Restart your pycharm and it will work.

answered Jun 19, 2018 at 20:09

SaiKiran's user avatar

SaiKiranSaiKiran

6,16410 gold badges42 silver badges76 bronze badges

6

Collecting tmtoolkit
  Downloading tmtoolkit-0.1.6-py2.py3-none-any.whl (15.3MB)
Collecting pandas (from tmtoolkit)
  Downloading pandas-0.21.0.tar.gz (11.3MB)
    Complete output from command python setup.py egg_info:
    Running from numpy source directory.
    C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3setup.py:367: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilssystem_info.py:572: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilssystem_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      self.calc_info()
    non-existing path in 'numpy\distutils': 'site.cfg'
    C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilssystem_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilssystem_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
    C:Python34libdistutilsdist.py:260: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "C:Python34libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "C:Python34libdistutilsdist.py", line 955, in run_commands
        self.run_command(cmd)
      File "C:Python34libdistutilsdist.py", line 974, in run_command
        cmd_obj.run()
      File "C:Python34libsite-packagessetuptoolscommandbdist_egg.py", line 161, in run
        self.run_command("egg_info")
      File "C:Python34libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:Python34libdistutilsdist.py", line 974, in run_command
        cmd_obj.run()
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscommandegg_info.py", line 26, in run
      File "C:Python34libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:Python34libdistutilsdist.py", line 974, in run_command
        cmd_obj.run()
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscommandbuild_src.py", line 148, in run
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscommandbuild_src.py", line 159, in build_sources
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscommandbuild_src.py", line 294, in build_library_sources
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscommandbuild_src.py", line 377, in generate_sources
      File "numpycoresetup.py", line 672, in get_mathlib_info
        'pandas.tests',
      File "C:Python34libdistutilscommandconfig.py", line 243, in try_link
        self._check_compiler()
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscommandconfig.py", line 51, in _check_compiler
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilsmsvccompiler.py", line 50, in initialize
      File "C:Python34libdistutilsmsvc9compiler.py", line 371, in initialize
        vc_env = query_vcvarsall(VERSION, plat_spec)
      File "C:Python34libsite-packagessetuptoolsmsvc.py", line 147, in msvc9_query_vcvarsall
        return EnvironmentInfo(arch, ver).return_env()
      File "C:Python34libsite-packagessetuptoolsmsvc.py", line 1228, in return_env
        [self.VCIncludes,
      File "C:Python34libsite-packagessetuptoolsmsvc.py", line 877, in VCIncludes
        return [os.path.join(self.si.VCInstallDir, 'Include'),
      File "C:Python34libsite-packagessetuptoolsmsvc.py", line 556, in VCInstallDir
        raise distutils.errors.DistutilsPlatformError(msg)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 158, in save_modules
        yield saved
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 199, in setup_context
        yield
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 254, in run_setup
        _execfile(setup_script, ns)
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 49, in _execfile
        exec(code, globals, locals)
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3setup.py", line 392, in <module>
        def build_extension(self, ext):
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3setup.py", line 384, in setup_package
        self.check_cython_extensions(self.extensions)
      File "C:Users5A86~1AppDataLocalTempeasy_install-bz49tq70numpy-1.13.3numpydistutilscore.py", line 169, in setup
      File "C:Python34libsite-packagessetuptools__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "C:Python34libdistutilscore.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:Python34libsite-packagessetuptoolscommandeasy_install.py", line 1104, in run_setup
        run_setup(setup_script, args)
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 257, in run_setup
        raise
      File "C:Python34libcontextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 199, in setup_context
        yield
      File "C:Python34libcontextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 170, in save_modules
        saved_exc.resume()
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 145, in resume
        six.reraise(type, exc, self._tb)
      File "C:Python34libsite-packagespkg_resources_vendorsix.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "C:Python34libsite-packagessetuptoolssandbox.py", line 158, in save_modules
        yield saved

      File "C:Python34libsite-packagessetuptools__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "C:Python34libdistutilscore.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
    
 
        ----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:UsersБлаблаблаAppDataLocalTemppycharm-packaging1pandas

проблема: после установки новой версии python(3.5.1) и удаления старой(3.4) pycharm отказывается видить стандартные модули python. всякие sys, os и прочие импортировать в редакторе не получается — подчеркивает красным. print() не работает — подчеркивает красным и нет автодополнения и все в таком духе. При этом команда run или python console из того же pycharm запускаются как надо, импортируется что надо, все ок. а вот в редакторе проблема. интерпретатор указан, куда еще смотреть не знаю, нужна помощь

У меня проблемы с использованием модуля запросов на моем Mac. Я использую python34 и установил модуль запросов через pip. Я могу проверить это, снова запустив установку, и она покажет мне, что модуль уже установлен.

Хотя я могу импортировать модуль «запросы» через интерактивный интерпретатор Python, попытка выполнить «запросы на импорт» в PyCharm приводит к ошибке «Нет модуля с именем запросов». Я проверил свои настройки интерпретатора Python PyCharm и (я считаю) он установлен на тот же python34, что и в моей среде. Однако я также не вижу модуль запросов, указанный в PyCharm.

Настройки интерпретатора Python PyCharm

Очевидно, что мне здесь чего-то не хватает. Ребята, вы можете посоветовать, где мне искать или что я должен исправить, чтобы этот модуль заработал? У меня создалось впечатление, что когда я устанавливаю модуль через pip в свою среду, PyCharm обнаруживает эти изменения. Однако, похоже, с моей стороны что-то сломалось .

]: which -a python / opt / local / bin / python / usr / bin / python

Если вы используете PyCharms CE (Community Edition), нажмите:

File->Default Settings->Project Interpretor

Снимок экрана: настройки переводчика

Посмотрите на знак + внизу, нажмите на него. Откроется еще один диалог с множеством доступных модулей. Выберите свой пакет (например, запросы), а PyCharm сделает все остальное.

В моем случае использование ранее существовавшего virtualenv не работало в редакторе — все модули были отмечены как неразрешенная ссылка (запуск, естественно, работает, так как это находится за пределами конфигурации редактора, просто запускается внешний процесс (не так просто для отладки) ).
Оказывается, PyCharm не добавлял каталог сайтов-пакетов . исправление состоит в том, чтобы добавить его вручную.

Откройте «Файл» -> «Настройки» -> «Интерпретатор проекта», выберите «Показать все . » (для редактирования конфигурации) (1), выберите свой интерпретатор (2) и нажмите «Показать пути выбранного интерпретатора» (3).

На этом экране вручную добавьте каталог «site-packages» виртуальной среды (4) (я также добавил «Lib», для хорошей меры); после завершения и сохранения они появятся в путях интерпретатора.

шаги

Еще одна вещь, которую не помешает сделать, — это выбрать «Связать эту виртуальную среду с текущим проектом» в поле редактирования интерпретатора.

PyCharm не распознает установленный модуль

У меня проблемы с использованием модуля «запросы» на моем Mac. Я использую python34 и установил модуль «запросы» через pip. Я могу проверить это, снова запустив установку, и она покажет мне, что модуль уже установлен.

Хотя я могу импортировать модуль «запросы» через интерактивный интерпретатор Python, попытка выполнить «запросы на импорт» в PyCharm приводит к ошибке «Нет модуля с именем запросы». Я проверил настройки интерпретатора PyCharm Python и (я думаю) установил тот же python34, что и в моей среде. Однако я также не вижу модуля «запросы» в PyCharm.

PyCharm Python interpreter settings

Очевидно, что я что-то упускаю здесь. Не могли бы вы, ребята, посоветовать, где я должен искать или что я должен исправить, чтобы этот модуль заработал? У меня сложилось впечатление, что когда я устанавливаю модуль через pip в своей среде, PyCharm обнаружит эти изменения. Однако, кажется, что-то сломано на моей стороне.

]:what -a python /opt/local/bin/python /usr/bin/python

17 ответов

Если вы используете PyCharms CE (Community Edition), нажмите:

File->Default Settings->Project Interpretor

Screenshot: Interpretor Settings

Увидите знак + внизу, нажмите на него. Откроется другое диалоговое окно с множеством доступных модулей. Выберите свой пакет (например, запросы), а PyCharm сделает все остальное.

В моем случае использование уже существующего virtualenv не работало в редакторе — все модули были помечены как неразрешенные ссылки (запуск естественно работает, так как это вне конфига редактора, просто запуск внешнего процесса (не так просто для отладки) ).
Оказывается, PyCharm не добавил каталог site-packages. исправление состоит в том, чтобы добавить его вручную.

Откройте «Файл» -> «Настройки» -> «Интерпретатор проекта», выберите «Показать все . » (чтобы отредактировать конфигурацию) (1), выберите свой интерпретатор (2) и нажмите «Показать пути выбранного интерпретатора» (3).

На этом экране вручную добавьте каталог «site-packages» виртуальной среды (4) (я также добавил «Lib» для хорошей меры); после того, как они будут выполнены и сохранены, они появятся в путях интерпретатора.

the steps

Еще одна вещь, которую не помешает сделать, это выбрать «Связать эту виртуальную среду с текущим проектом» в поле редактирования интерпретатора.

  • Python try except получить текст ошибки
  • Python логирование всех ошибок
  • Pycharm ошибка при установке библиотеки
  • Python try except печать ошибки
  • Python код ошибки 2503