web-dev-qa-db-ja.com

pythonにモジュールをインストールするためにpipを使用すると失敗する

python pipを使用したモジュールのインストールに問題があります。以下は、コマンドウィンドウからの出力です。

GDALモジュールをインストールする直前にpipをインストールしたことに注意してください。

python 2.7を実行しているw7 64ビットマシンを使用しています

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

C:\Users\jnunn\Desktop>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:\Python26\ArcGIS10.1\Scripts
Installing pip.exe script to C:\Python26\ArcGIS10.1\Scripts
Installing pip.exe.manifest script to C:\Python26\ArcGIS10.1\Scripts
Installing pip-2.7-script.py script to C:\Python26\ArcGIS10.1\Scripts
Installing pip-2.7.exe script to C:\Python26\ArcGIS10.1\Scripts
Installing pip-2.7.exe.manifest script to C:\Python26\ArcGIS10.1\Scripts
Successfully installed pip
Cleaning up...

C:\Users\jnunn\Desktop>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.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/ -I
C:\Python26\ArcGIS10.1\include -IC:\Python26\ArcGIS10.1\PC -IC:\Python26\ArcGIS1
0.1\lib\site-packages\numpy\core\include /Tpextensions/gdal_wrap.cpp /Fobuild\te
mp.win32-2.7\Release\extensions/gdal_wrap.obj
gdal_wrap.cpp
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(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.0\VC\BIN\c
l.exe"' failed with exit status 2
Complete output from command C:\Python26\ArcGIS10.1\python.exe -c "import se
tuptools;__file__='c:\\users\\jnunn\\appdata\\local\\temp\\pip-build\\gdal\\setu
p.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'
))" install --record c:\users\jnunn\appdata\local\temp\pip-f7tgze-record\install
-record.txt --single-version-externally-managed:
running install

running build

running build_py

creating build

creating build\lib.win32-2.7

copying gdal.py -> build\lib.win32-2.7

copying ogr.py -> build\lib.win32-2.7

copying osr.py -> build\lib.win32-2.7

copying gdalconst.py -> build\lib.win32-2.7

copying gdalnumeric.py -> build\lib.win32-2.7

creating build\lib.win32-2.7\osgeo

copying osgeo\gdal.py -> build\lib.win32-2.7\osgeo

copying osgeo\gdalconst.py -> build\lib.win32-2.7\osgeo

copying osgeo\gdalnumeric.py -> build\lib.win32-2.7\osgeo

copying osgeo\gdal_array.py -> build\lib.win32-2.7\osgeo

copying osgeo\ogr.py -> build\lib.win32-2.7\osgeo

copying osgeo\osr.py -> build\lib.win32-2.7\osgeo

copying osgeo\__init__.py -> build\lib.win32-2.7\osgeo

running build_ext

building 'osgeo._gdal' extension

creating build\temp.win32-2.7

creating build\temp.win32-2.7\Release

creating build\temp.win32-2.7\Release\extensions

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/ -IC:\P
ython26\ArcGIS10.1\include -IC:\Python26\ArcGIS10.1\PC -IC:\Python26\ArcGIS10.1\
lib\site-packages\numpy\core\include /Tpextensions/gdal_wrap.cpp /Fobuild\temp.w
in32-2.7\Release\extensions/gdal_wrap.obj

gdal_wrap.cpp

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(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.0\VC\BIN\cl.ex
e"' failed with exit status 2

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

C:\Users\jnunn\Desktop>

以前にもeasy_installを使用しようとしましたが、これには一般的なエラーが発生しました:

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(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.0\VC\BIN\cl.ex
e"' failed with exit status 2

さらに、次の追加のpip.log:

    Exception information:
Traceback (most recent call last):
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\basecommand.py", line 107, in main
status = self.run(options, args)
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\commands\install.py", line 261, in run
requirement_set.install(install_options, global_options)
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\req.py", line 1166, in install
requirement.install(install_options, global_options)
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\req.py", line 589, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\util.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command C:\Python26\ArcGIS10.1\python.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:\users\jnunn\appdata\local\temp\pip-f7tgze-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\jnunn\appdata    \local\temp\pip-build\gdal
12
James N

この問題は、 Python GDALパッケージがpip を介してインストールするときにヘッダーファイルが欠落しているように見えますが、 solution

python CPython拡張機能を持つライブラリの通常の問題について説明します こちら )解決策は次のとおりです:

windowsバイナリパッケージをダウンロードして実行することにより、ライブラリをインストールします。

6
Robert Lujo

最も簡単な方法(J.F. Sebastianが推奨)は http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal からインストールすることです

4
ajsmith007

問題は、PythonはC:\ Python \にインストールされると考えられていますが、portablepythonディレクトリ内にあるため、これは当てはまりません。リンクを使用して解決しました。

たとえば、私のportablepythonディレクトリ(または例ではkivyディレクトリ)は次のとおりです。

C:\Users\blabla.KMS\kivy-1.8.0-py3.3-win32\Python33

dosプロンプトを入力し、次のように入力します。

mklink /d c:\Python33\ C:\Users\blabla.KMS\kivy-1.8.0-py3.3-win32\Python33\ 

c:\ Python33\Scripts内に移動してPIPまたはeasy_installを使用するよりも、最後に次を使用してリンクを削除できます。

rmdir Python33

涼しい!私はDjangoをkivyにインストールしました!

2
piertoni

これはPython問題ではありませんが、Windowsでのソースのコンパイルに関する問題です。

インストール手順 に従い、最初にGDALバイナリをヘッダーファイルと共にインストールしたと思いますか?

さらに、あなたは this SO question への回答をチェックして、あなたを助けることができる buntuフォーラム を指し示すことができます。

1
Pierre GM

Anacondaなしでipythonをインストールしようとすると、同様の問題が発生しました。最初のpipは、pip install jupyterを実行するときに「cl.exe」を見つけることができず、PATHに追加した後、終了ステータス2エラーで失敗しました。

あなたはそれを機能させるためにVSファイルで遊んでみることができますが、私にとってそれを回避する最も簡単な方法は次のことでした:

1) https://pypi.python.org/pypi から.tar.gzファイルをダウンロードします2)フォルダーに抽出します3)cmdから抽出したフォルダーでsetup.pyを実行します:

c:\> cd <wherever your extracted folder is from .tar.gz that contains setup.py>
c:\<yourcdhere>>python setup.py install

私と同じように、PATHにpythonがない場合、python 32bと64bが異なるため、次のように指定する必要があります。 python手動で(2番目のコマンドを変更)):

c:\<yourcdhere>>pythoninstallpath\python setup.py install

ライブラリが自動的にコピーされ、依存関係がすべてpythonインストール場所の適切なlibフォルダーにインストールされます。

それがどのように機能したかを見ることができるように、ここでそれは私のためです。しかし、使用しているものに一致するようにディレクトリを変更します。

"L:\ python\py27_32b\ipython-5.3.0"にipythonのsetup.pyがあり、python "L:\ python\py27_32b\install"にインストールされている

c:\users\vlox>L:
L:\>cd "python\py27_32b\ipython-5.3.0"
L:\python\py27_32b\ipython-5.3.0>L:\python\py27_32b\install\python setup.py install

そして出来上がり!

お役に立てれば

0
Vlox

私は同じ問題を抱えていましたが、 http://www.lfd.uci.edu/~gohlke/pythonlibs にあるモジュールのリストにない「ebooklib」モジュールをインストールする必要がありました。同時に、このモジュールをダウンロードしてもらいました。しかし、ebooklibのsetup.pyによるインストールはerror: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex e"' failed with exit status 2で失敗しました。最後に、依存するすべてのモジュールをlfd.uci.eduから個別にインストールしました。その後、setup.pyによるインストールは成功しました。

0
montie