Pip ошибка при установке пакетов

I’m having trouble installing python modules using pip. Below is the output from the command window:

Note that I installed pip immediately before trying to install GDAL module.

I am on a w7 64bit machine running python 2.7

    Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:UsersjnunnDesktop>python get-pip.py
Downloading/unpacking pip
Downloading pip-1.2.1.tar.gz (102Kb): 102Kb downloaded
Running setup.py egg_info for package pip

warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory
'docs_build'
no previously-included directories found matching 'docs_build_sources'
Installing collected packages: pip
Running setup.py install for pip

warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory
'docs_build'
no previously-included directories found matching 'docs_build_sources'
Installing pip-script.py script to C:Python26ArcGIS10.1Scripts
Installing pip.exe script to C:Python26ArcGIS10.1Scripts
Installing pip.exe.manifest script to C:Python26ArcGIS10.1Scripts
Installing pip-2.7-script.py script to C:Python26ArcGIS10.1Scripts
Installing pip-2.7.exe script to C:Python26ArcGIS10.1Scripts
Installing pip-2.7.exe.manifest script to C:Python26ArcGIS10.1Scripts
Successfully installed pip
Cleaning up...

C:UsersjnunnDesktop>pip install gdal
Downloading/unpacking gdal
Downloading GDAL-1.9.1.tar.gz (420kB): 420kB downloaded
Running setup.py egg_info for package gdal

Installing collected packages: gdal
Running setup.py install for gdal
building 'osgeo._gdal' extension
c:Program Files (x86)Microsoft Visual Studio 9.0VCBINcl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/ -I
C:Python26ArcGIS10.1include -IC:Python26ArcGIS10.1PC -IC:Python26ArcGIS1
0.1libsite-packagesnumpycoreinclude /Tpextensions/gdal_wrap.cpp /Fobuildte
mp.win32-2.7Releaseextensions/gdal_wrap.obj
gdal_wrap.cpp
c:Program Files (x86)Microsoft Visual Studio 9.0VCINCLUDExlocale(342) :
warning C4530: C++ exception handler used, but unwind semantics are not enabled
. Specify /EHsc
extensions/gdal_wrap.cpp(2853) : fatal error C1083: Cannot open include file
: 'cpl_port.h': No such file or directory
error: command '"c:Program Files (x86)Microsoft Visual Studio 9.0VCBINc
l.exe"' failed with exit status 2
Complete output from command C:Python26ArcGIS10.1python.exe -c "import se
tuptools;__file__='c:\users\jnunn\appdata\local\temp\pip-build\gdal\setu
p.py';exec(compile(open(__file__).read().replace('rn', 'n'), __file__, 'exec'
))" install --record c:usersjnunnappdatalocaltemppip-f7tgze-recordinstall
-record.txt --single-version-externally-managed:
running install

running build

running build_py

creating build

creating buildlib.win32-2.7

copying gdal.py -> buildlib.win32-2.7

copying ogr.py -> buildlib.win32-2.7

copying osr.py -> buildlib.win32-2.7

copying gdalconst.py -> buildlib.win32-2.7

copying gdalnumeric.py -> buildlib.win32-2.7

creating buildlib.win32-2.7osgeo

copying osgeogdal.py -> buildlib.win32-2.7osgeo

copying osgeogdalconst.py -> buildlib.win32-2.7osgeo

copying osgeogdalnumeric.py -> buildlib.win32-2.7osgeo

copying osgeogdal_array.py -> buildlib.win32-2.7osgeo

copying osgeoogr.py -> buildlib.win32-2.7osgeo

copying osgeoosr.py -> buildlib.win32-2.7osgeo

copying osgeo__init__.py -> buildlib.win32-2.7osgeo

running build_ext

building 'osgeo._gdal' extension

creating buildtemp.win32-2.7

creating buildtemp.win32-2.7Release

creating buildtemp.win32-2.7Releaseextensions

c:Program Files (x86)Microsoft Visual Studio 9.0VCBINcl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/ -IC:P
ython26ArcGIS10.1include -IC:Python26ArcGIS10.1PC -IC:Python26ArcGIS10.1
libsite-packagesnumpycoreinclude /Tpextensions/gdal_wrap.cpp /Fobuildtemp.w
in32-2.7Releaseextensions/gdal_wrap.obj

gdal_wrap.cpp

c:Program Files (x86)Microsoft Visual Studio 9.0VCINCLUDExlocale(342) : war
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc

extensions/gdal_wrap.cpp(2853) : fatal error C1083: Cannot open include file: 'c
pl_port.h': No such file or directory

error: command '"c:Program Files (x86)Microsoft Visual Studio 9.0VCBINcl.ex
e"' failed with exit status 2

----------------------------------------
Command C:Python26ArcGIS10.1python.exe -c "import setuptools;__file__='c:\us
ers\jnunn\appdata\local\temp\pip-build\gdal\setup.py';exec(compile(open(_
_file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record c:u
sersjnunnappdatalocaltemppip-f7tgze-recordinstall-record.txt --single-vers
ion-externally-managed failed with error code 1 in c:usersjnunnappdatalocal
temppip-buildgdal
Storing complete log in C:Usersjnunnpippip.log

C:UsersjnunnDesktop>

I have tried to use easy_install before too, and it came back with a common error to this:

c:Program Files (x86)Microsoft Visual Studio 9.0VCINCLUDExlocale(342) : war
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc

extensions/gdal_wrap.cpp(2853) : fatal error C1083: Cannot open include file: 'c
pl_port.h': No such file or directory

error: command '"c:Program Files (x86)Microsoft Visual Studio 9.0VCBINcl.ex
e"' failed with exit status 2

Plus the following additional pip.log:

    Exception information:
Traceback (most recent call last):
File "C:Python26ArcGIS10.1libsite-packagespipbasecommand.py", line 107, in main
status = self.run(options, args)
File "C:Python26ArcGIS10.1libsite-packagespipcommandsinstall.py", line 261, in run
requirement_set.install(install_options, global_options)
File "C:Python26ArcGIS10.1libsite-packagespipreq.py", line 1166, in install
requirement.install(install_options, global_options)
File "C:Python26ArcGIS10.1libsite-packagespipreq.py", line 589, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "C:Python26ArcGIS10.1libsite-packagespiputil.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command C:Python26ArcGIS10.1python.exe -c "import setuptools;__file__='c:\users\jnunn\appdata\local\temp\pip-build\gdal\setup.py';exec(compile(open(__file__).read().replace('r    n', 'n'), __file__, 'exec'))" install --record c:usersjnunnappdatalocaltemppip-f7tgze-recordinstall-record.txt --single-version-externally-managed failed with error code 1 in c:usersjnunnappdata    localtemppip-buildgdal

Package Installer for Python (PIP) is the preferred package-management system for Python. It’s used to install third-party packages from an online repository called the Python Package Index.

When attempting to install Python packages, you may encounter errors stating PIP is not recognized, command not found, or can’t open the file. In this article, we’ve detailed why such errors occur, as well as how you can fix them.

Why is the PIP Install Not Working?

The most common reasons for issues with PIP installations is either that an incorrect PIP path is added to the PATH system variable, or the PIP path isn’t added at all. This often happens because users forget or don’t know to include PIP during the Python installation. In case of Linux, PIP isn’t included during the Python installation to start with, so you have to install it separately later.

In most cases, you won’t encounter this error if you use a Python IDE instead of CMD. However, if you don’t want to use an IDE, or you face this error despite using an IDE, you can try the fixes from the section below to resolve the issue.

Include PIP During Installation

First, you should make sure that PIP was actually included during the Python installation. Here are the steps to do so:

  1. Press Win + R, type appwiz.cpl, and press Enter.
  2. Select Python from the list and press Change.
  3. Click on Modify. Ensure pip is selected and press Next > Install.
    install-pip-python-optional-features
  4. After the installation completes, check if you can install the Python packages now.

Add PIP to PATH Variable

As stated, the PIP Install path needs to be added to the PATH system variable for it to work. Otherwise, CMD won’t recognize the command and you’ll encounter the not recognized error. First, you should check if this is the issue with the following steps:

  1. Press Win + R, type cmd, and press CTRL + Shift + Enter.
  2. Type echo %PATH% and press Enter.
    echo-path

Depending on your Python version and install location, you may see a path like C:Python36Scripts. This means the PIP path is already added to the PATH variable. If you don’t see it, you can add it via the command line with the following steps:

  1. Execute the following command:
    setx PATH "%PATH%;<PIP Path>"
    setx-path-python
    As stated, the PIP path will differ according to your Python version. We’ve used C:Python36Scripts as an example but in your case, the PIP path maybe different. If you aren’t sure what the PIP path is, check the GUI method below.
  2. Start a new instance of command prompt and check if you can install any packages.

The command-line interface method returns a lot of paths at once, which can get confusing. Instead, you can also check the paths via the GUI. Here are the steps to do so:

  1. Press Win + R, type sysdm.cpl, and press Enter.
  2. Switch to the Advanced tab and click on Environment Variables.
    environment-variables
    As stated, the PIP path will differ according to your Python version. We’ve used C:Python36Scripts as an example but in your case, the PIP path maybe different. If you aren’t sure what the PIP path is, check the GUI method below.
  3. Start a new instance of command prompt and check if you can install any packages.

The command-line interface method returns a lot of paths at once, which can get confusing. Instead, you can also check the paths via the GUI. Here are the steps to do so:

  1. Press Win + R, type sysdm.cpl, and press Enter.
  2. Switch to the Advanced tab and click on Environment Variables.
  3. In the System variables section, select Path and press Edit.
  4. Click on New and add the pip installation path. This differs depending on your Python version but for the current latest version (3.10), the path is:
    C:UsersUsernameAppDataLocalProgramsPythonPython310Scripts.
    add-new-path-variable
  5. Check if you can install a pip package now.

Use Correct PIP and Python Version

The pip install packagename command is generally used to install Python packages. If this command doesn’t work, you can try the commands shown below instead. Don’t forget to replace packagename with the actual package you’re trying to install.

python -m pip install packagename

py -m pip install packagename

pip-install-packagename

  • Check if you can install a pip package now.
  • Use Correct PIP and Python Version

    The pip install packagename command is generally used to install Python packages. If this command doesn’t work, you can try the commands shown below instead. Don’t forget to replace packagename with the actual package you’re trying to install.

    python -m pip install packagename

    py -m pip install packagename

    If you have multiple python versions, specify the version number as shown below:

    py -3 -m pip install packagename

    install-pip-package-version-number

    Manually Install PIP

    Due to failed upgrades and similar issues, your PIP file can get corrupted which can also lead to various problems such as PIP Install Not Working. One easy way to fix this is by removing Python and reinstalling it. You can find the steps to do so in the next section.

    Alternatively, you can also manually install PIP with the following steps:

    1. Download get-pip.py and store it in Python’s installation directory.
    2. Enter cd <above directory> to switch to the installation directory in CMD.
      python-install-directory

      Manually Install PIP

      Due to failed upgrades and similar issues, your PIP file can get corrupted which can also lead to various problems such as PIP Install Not Working. One easy way to fix this is by removing Python and reinstalling it. You can find the steps to do so in the next section.

      Alternatively, you can also manually install PIP with the following steps:

      1. Download get-pip.py and store it in Python’s installation directory.
      2. Enter cd <above directory> to switch to the installation directory in CMD.
      3. Type py get-pip.py and press Enter.
        py-get-pip
      4. Once pip is installed, check if you can install any packages.

      In case of Linux, pip doesn’t come bundled with Python. You have to manually install it first. You can do so by executing the following command in the terminal:

      sudo apt-get -y install python3-pip

      install-python-pip-ubuntu

      Reinstall Python

      The final option is to remove Python entirely and then reinstall it. Any problematic files will be replaced during the process, which should ultimately resolve the issue. Here are the steps to do so:

      1. Press Win + R, type appwiz.cpl, and press Enter.
      2. Select Python from the list, click on Uninstall and follow the on-screen instructions.
      3. Restart your PC and reinstall Python.
      4. Enable the Add Python to Path option and select Customize installation. Also, make sure that PIP is included during the installation.
        install-python-add-python-to-path
      5. After the installation completes, restart your PC once more, then check if you can install any Python packages.

    Это сообщение означает, что система не может найти файл pip, который вы пытаетесь запустить. Возможно, у вас не установлен Python или переменная среды PATH не содержит директорию, в которой находится установленный Python.

    Чтобы установить Python, перейдите на сайт https://www.python.org/ и скачайте и установите самую последнюю версию. Убедитесь, что установка добавит Python в переменную среды PATH.

    После установки Python вы должны быть в состоянии запускать pip, чтобы устанавливать модули. Например, чтобы установить модуль requests, выполните следующую команду:

    pip install requests
    

    Если у вас возникают проблемы с установкой модулей с помощью pip, попробуйте выполнить команду pip install -U pip, чтобы обновить версию pip до самой последней.

    Nolrox

    @Nolrox

    Python-разработчик

    Качаю Python, захожу в консоль, пишу pip install и выдает что «pip» не является внутренней или внешней командой, исполняемой программой или пакетным файлом. Что делать?


    • Вопрос задан

      более двух лет назад

    • 51962 просмотра

    Добавить в PATH.
    Гугли переменные среды

    Или даже будет быстрее переустановить питон и при установке поставить соответствующую галочку.

    Если винда, то тут 99% что при установке не поставил галочку добавить пути в PATH.

    1. Руками прописать
    2. Удалить и поставить заново, не пропустив галочку

    Скорее всего, у вас просто не была установлена галочка на работу пипа со всех директорий, или переустановите пайтон, почтавив эту галочку, илм пробуйте выполнять эту команду с директории где находится пайтон

    Пригласить эксперта

    Нужно обновить pip:
    python -m pip install --upgrade pip
    Скорее всего вы используете Python 3.9. Но многие мейнтейнеры не успели обновить пакеты. Поэтому установите Python 3.8
    Discord.py поддерживается пока питоном 3.5 … 3.8!
    И неплохо бы установить Microsoft C++ Build Tools, пригодится для установки некоторых пакетов.

    если галочка PATH python не сработала можно: настроить ручную.
    здесь объясняют как в ручную настроить PATH для python (для pip достаточно просто указать в PATH адрес к scripts в каталоге python)


    • Показать ещё
      Загружается…

    09 июн. 2023, в 01:21

    10000 руб./за проект

    09 июн. 2023, в 01:06

    50000 руб./за проект

    09 июн. 2023, в 00:36

    1000 руб./за проект

    Минуточку внимания

    Ответ на:

    комментарий
    от t184256 21.10.19 23:21:23 MSK

    не получилось устранить ошибку по поиску в нете.
    вот сама ошибка:
    Traceback (most recent call last):
    File «/usr/bin/pip», line 6, in <module>
    from pkg_resources import load_entry_point
    ModuleNotFoundError: No module named ‘pkg_resources’

    • Показать ответ
    • Ссылка

    Ответ на:

    комментарий
    от cretin00 21.10.19 23:26:31 MSK

    Это модуль из состава setuptools. Есть идеи, как и чем ты сломал setuptools? Переустановить можешь?

    t184256 ★★★★★

    (21.10.19 23:27:54 MSK)

    • Показать ответы
    • Ссылка

    Ответ на:

    комментарий
    от t184256 21.10.19 23:27:54 MSK

    идей нет,сам переставить не смогу.

    • Ссылка

    Ответ на:

    комментарий
    от t184256 21.10.19 23:27:54 MSK

    при установке программ python выходят такие ошибки:
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/__pycache__/easy_install.cpython-37.opt-1.pyc
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/__pycache__/easy_install.cpython-37.pyc
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/easy_install.py
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/__init__.py
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/__pycache__/
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/__pycache__/__init__.cpython-37.opt-1.pyc
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/__pycache__/__init__.cpython-37.pyc
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/__pycache__/py31compat.cpython-37.opt-1.pyc
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/__pycache__/py31compat.cpython-37.pyc
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/pkg_resources/py31compat.py
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/PKG-INFO
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/SOURCES.txt
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/dependency_links.txt
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/entry_points.txt
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/requires.txt
    предупреждение: не удалось получить информацию о файле для usr/lib/python3.7/site-packages/setuptools-41.2.0-py3.7.egg-info/top_level.txt
    предупреждение: не удалось получить информацию о файле для

    • Показать ответ
    • Ссылка

    Ответ на:

    комментарий
    от cretin00 21.10.19 23:43:21 MSK

    В большинстве дистрибутивов Linux pip можно безопасно использовать только в virtualenv или в крайнем случае от пользователя с –user. Запуск pip от root за пределами virtualenv — верный способ заработать конфликты с системным менеджером пакетов. Так что переустанавливай arch полностью.

    AEP ★★★★★

    (22.10.19 09:14:10 MSK)

    • Показать ответ
    • Ссылка

    Ответ на:

    комментарий
    от ei-grad 22.10.19 09:21:14 MSK

    Проблема решается очень просто. Могу рассказать как.

    Да, всё верно. Я с таким уже сталкивался и описанный способ мне помог.

    anonymous

    (22.10.19 09:57:00 MSK)

    • Ссылка

    Ответ на:

    комментарий
    от AEP 22.10.19 09:14:10 MSK

    С менеджером пакетов скорее всего нет, потому что pip кладёт в /usr/local даже при обновлении пакетов, которые через системный менеджер установлены, а вот проблем с совместимостью пакетов между собой огрести можно легко. Сам нарывался.

    Radjah ★★★★★

    (22.10.19 10:42:57 MSK)

    • Показать ответ
    • Ссылка

    Ответ на:

    комментарий
    от t184256 21.10.19 23:50:22 MSK

    командой sudo pacman -Rsccdd namep?

    • Ссылка

    Ответ на:

    комментарий
    от ei-grad 22.10.19 09:21:14 MSK

    Пипка.

    anonymous

    (22.10.19 14:14:49 MSK)

    • Ссылка

    Ответ на:

    комментарий
    от Radjah 22.10.19 10:42:57 MSK

    С менеджером пакетов скорее всего нет, потому что pip кладёт в /usr/local даже при обновлении пакетов, которые через системный менеджер установлены

    Это дистроспецифичный патч. В Debian и Ubuntu это так, в других дистрибутивах — нет.

    AEP ★★★★★

    (22.10.19 16:04:16 MSK)

    • Ссылка

    Всегда используй virtualenv

    • Ссылка

    Ответ на:

    комментарий
    от cretin00 22.10.19 16:12:05 MSK

    Ответ на:

    комментарий
    от t184256 22.10.19 16:15:37 MSK

    Ответ на:

    комментарий
    от cretin00 22.10.19 16:21:07 MSK

    Тебе дали пакетный менеджер, со встроенными средствами починки таких проблем между прочим, а ты насоздавал новых, пойдя ему в обход.

    t184256 ★★★★★

    (22.10.19 16:24:28 MSK)

    • Показать ответ
    • Ссылка

    Ответ на:

    комментарий
    от t184256 22.10.19 16:24:28 MSK

    Ответ на:

    комментарий
    от cretin00 22.10.19 16:12:05 MSK

    Но ведь ты не решил проблему с pacman, а до тех пор у тебя система сломана. Сделай pacman -Qkk python-setuptools.

    Thetan ★★★

    (22.10.19 16:27:29 MSK)

    • Показать ответ
    • Ссылка

    Ответ на:

    комментарий
    от Thetan 22.10.19 16:27:29 MSK

    точно,вот выхлоп:
    python-setuptools: всего 192 файла, 0 измененных файлов

    • Ссылка

    Ответ на:

    комментарий
    от cretin00 22.10.19 16:26:23 MSK

    Ответ на:

    комментарий
    от t184256 22.10.19 16:33:09 MSK

    Ответ на:

    комментарий
    от t184256 22.10.19 16:15:37 MSK

    Ответ на:

    комментарий
    от cretin00 22.10.19 16:33:47 MSK

    https://wiki.archlinux.org/index.php/Python#Package_management

    If you must use pip, use a virtual environment, or pip install --user to avoid conflicts with packages in /usr. It is always preferred to use pacman to install software.

    https://wiki.archlinux.org/index.php/Python_(Русский)#Управление_пакетами

    Если вы собираетесь использовать pip, используйте его в виртуальном окружении или с опцией --user (pip install --user), чтобы избежать конфликтов между пакетами в каталоге /usr. Во всех случаях предпочтительный способ установки программного обеспечения — это использование pacman.

    Примечание: Существуют инструменты, автоматически генерирующие PKGBUILDы для пакетов pip и таким образом интегрирующие его в pacman: pipman-git, pip2arch-git

    greenman ★★★★★

    (22.10.19 17:11:37 MSK)



    Последнее исправление: greenman 22.10.19 17:16:31 MSK
    (всего

    исправлений: 3)

    • Ссылка

    Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.

    Понравилась статья? Поделить с друзьями:
  • Pip install opencv python ошибка
  • Pioneer deh 1600ubg ошибка усилителя
  • Pioneer deh 1600ubb ошибка усилителя
  • Pioneer deh 1500uba ошибка усилителя
  • Pinnacle studio неверный адрес электронной почты код ошибки 20002