<p>install_requiresディレクティブの問題によるnumpyインストール(Trac#18​​41)</p>

作成日 2012年10月20日  ·  39コメント  ·  ソース: numpy/numpy

_unknownに割り当てられたtracユーザーoheによる2011-05-25の元のチケットhttp://projects.scipy.org/numpy/ticket/1841。_

こんにちは、

virtualenvでは、python v2.7.1を使用して、setuptools / distributeのinstall_requiresディレクティブを介してnumpyをインストールできません。

from setuptools import setup
setup(...
      install_requires=['numpy'],
      ...)

python setup.py installは、次のトレースバックを提供します。

running install
running bdist_egg
running egg_info
writing requirements to UNKNOWN.egg-info/requires.txt
writing UNKNOWN.egg-info/PKG-INFO
writing top-level names to UNKNOWN.egg-info/top_level.txt
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build/bdist.macosx-10.6-intel
creating build/bdist.macosx-10.6-intel/egg
creating build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying UNKNOWN.egg-info/PKG-INFO -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying UNKNOWN.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying UNKNOWN.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying UNKNOWN.egg-info/requires.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying UNKNOWN.egg-info/top_level.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/UNKNOWN-0.0.0-py2.7.egg' and adding 'build/bdist.macosx-10.6-intel/egg' to it
removing 'build/bdist.macosx-10.6-intel/egg' (and everything under it)
Processing UNKNOWN-0.0.0-py2.7.egg
Copying UNKNOWN-0.0.0-py2.7.egg to /Users/olivier/tc/karmatest/lib/python2.7/site-packages
Adding UNKNOWN 0.0.0 to easy-install.pth file

Installed /Users/olivier/tc/karmatest/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg
Processing dependencies for UNKNOWN==0.0.0
Searching for numpy
Reading http://pypi.python.org/simple/numpy/
Reading http://numpy.scipy.org
Reading http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103
Reading http://numeric.scipy.org
Best match: numpy 1.6.0
Downloading http://sourceforge.net/projects/numpy/files/NumPy/1.6.0/numpy-1.6.0.tar.gz/download
Processing download
Running numpy-1.6.0/setup.py -q bdist_egg --dist-dir /var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/egg-dist-tmp-Zr2lMr
Running from numpy source directory.Warning: distutils distribution has been initialized, it may be too late to add a subpackage commandWarning: distutils distribution has been initialized, it may be too late to add a subpackage fcompilernon-existing path in '/private/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils': 'site.cfg'
Warning: distutils distribution has been initialized, it may be too late to add a subpackage distutilsWarning: distutils distribution has been initialized, it may be too late to add a subpackage testingWarning: distutils distribution has been initialized, it may be too late to add a subpackage f2pyWarning: distutils distribution has been initialized, it may be too late to add an extension _sortWarning: distutils distribution has been initialized, it may be too late to add an extension multiarrayWarning: distutils distribution has been initialized, it may be too late to add an extension umathWarning: distutils distribution has been initialized, it may be too late to add an extension scalarmathWarning: distutils distribution has been initialized, it may be too late to add an extension _dotblasWarning: distutils distribution has been initialized, it may be too late to add an extension umath_testsWarning: distutils distribution has been initialized, it may be too late to add an extension multiarray_testsWarning: distutils distribution has been initialized, it may be too late to add a subpackage coreWarning: distutils distribution has been initialized, it may be too late to add an extension _compiled_baseWarning: distutils distribution has been initialized, it may be too late to add a subpackage libWarning: distutils distribution has been initialized, it may be too late to add a subpackage oldnumericWarning: distutils distribution has been initialized, it may be too late to add an extension _capiWarning: distutils distribution has been initialized, it may be too late to add a subpackage numarrayWarning: distutils distribution has been initialized, it may be too late to add an extension fftpack_liteWarning: distutils distribution has been initialized, it may be too late to add a subpackage fftWarning: distutils distribution has been initialized, it may be too late to add an extension lapack_liteWarning: distutils distribution has been initialized, it may be too late to add a subpackage linalgWarning: distutils distribution has been initialized, it may be too late to add an extension mtrandWarning: distutils distribution has been initialized, it may be too late to add a subpackage randomWarning: distutils distribution has been initialized, it may be too late to add a subpackage maWarning: distutils distribution has been initialized, it may be too late to add a subpackage matrixlibWarning: distutils distribution has been initialized, it may be too late to add a subpackage compatWarning: distutils distribution has been initialized, it may be too late to add a subpackage polynomialWarning: distutils distribution has been initialized, it may be too late to add a subpackage docWarning: distutils distribution has been initialized, it may be too late to add a subpackage numpyCould not locate executable f95
Could not locate executable f90
Could not locate executable f77
Could not locate executable xlf90
Could not locate executable xlf
Could not locate executable ifort
Could not locate executable ifc
Could not locate executable g77
Found executable /usr/local/bin/gfortran
_configtest.c:1: warning: conflicting types for built-in function ‘exp’
_configtest.c:1: warning: conflicting types for built-in function ‘exp’
_configtest.c:1:20: error: Python.h: No such file or directory
_configtest.c:1:20: error: Python.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-//ccLgEqLk.out
_configtest.c:1:20: error: Python.h: No such file or directory
_configtest.c:1:20: error: Python.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-//ccLgEqLk.out
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    install_requires=['numpy']
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 76, in run
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/install.py", line 104, in do_egg_install
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 211, in run
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 427, in easy_install
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 478, in install_item
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 519, in process_distribution
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 563, in resolve
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 799, in best_match
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 811, in obtain
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 476, in install_item
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/sandbox.py", line 62, in run_setup
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/sandbox.py", line 105, in run
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/sandbox.py", line 64, in <lambda>
  File "setup.py", line 196, in <module>

  File "setup.py", line 189, in setup_package

  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/core.py", line 186, in setup
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/olivier/tc/karmatest/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/bdist_egg.py", line 167, in run
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/command/egg_info.py", line 8, in run
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/command/build_src.py", line 152, in run
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/command/build_src.py", line 169, in build_sources
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/command/build_src.py", line 328, in build_extension_sources
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/command/build_src.py", line 385, in generate_sources
  File "/private/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/core/setup.py", line 410, in generate_config_h

  File "/private/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/core/setup.py", line 41, in check_types

  File "/private/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/core/setup.py", line 271, in check_types

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/misc_util.py", line 251, in clean_up_temporary_directory
ImportError: No module named numpy.distutils
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/var/folders/Iy/Iyse1OVUE38-IcPmyTb65E+++TI/-Tmp-/easy_install-W5KwbN/numpy-1.6.0/numpy/distutils/misc_util.py", line 251, in clean_up_temporary_directory
ImportError: No module named numpy.distutils

virtualenvの内部または外部にpip install numpyまたはeasy_install numpyを使用してnumpyをインストールすることに問題はありません。

OS:Mac OS 10.6.7

00 - Bug Other

最も参考になるコメント

この問題が発生している人のための参考として、最新バージョンのsetuptoolsでは、回避策はNumPyをsetup_requiresに追加することです。 私はまだinstall_requiresに保管しているので、 setup.pyは次のようになります。

setup(
...
    setup_requires=["numpy"],
    install_requires=["numpy"],
)

これは機能し、Mac OS XとLinuxの両方にNumPyを1回だけインストールします(Windowsではテストされていません)。

なぜ私には手がかりがないの

全てのコメント39件

_ @rgommersは2011-05-27_に書き込みました

問題が正確に何であるかはわかりませんが、最初にnumpyをインストールし、次にパッケージをインストールするインストールスクリプトを実行するだけで、問題を回避できますか? これらの不適切に文書化されたsetuptools機能に依存することは、回避できるのであれば良い考えではありません。

推測しなければならないのであれば、setuptools.setup()を初めて呼び出すと、numpy.distutilsの何かを台無しにする一連の魔法が呼び出されるため、次のようになります。

Running from numpy source directory.Warning: distutils distribution has been
initialized, it may be too late to add a subpackage commandWarning: distutils
distribution has been initialized, it may be too late to add a subpackage

その警告はdistutils / misc_util.pyから来ています。

_tracユーザーijstokesは2011-06-08_に書き込みました

これと同じエラーが発生しましたが、依存関係の問題が原因のようです。 他のモジュールでeasy_installを再試行すると、2回目は動作します。 私の推測では、easy_installセッションが終了した後にのみ、一部の依存関係が「表示」されます。

イアン

ある時点でこれを修正することは可能ですか? これにより、IHMO以外が存在するはずの回避策が発生します。 setup.pyのinstall_requiresオプションでnumpyを指定できるようになりたいです。

もちろん、誰かが問題を本当に理解するために時間を費やし、クリーンな修正を提出すれば、それは可能です。 それは私にとって個人的な優先事項ではありません- install_requiresは私見では避けるべきです(少なくともパッケージをアップグレードするときにpipとeasy_installが依存関係のアップグレードを停止するまで)。

最新のdistutils / setuptools / pipでも同じ問題が発生することを確認できますか?

します。

私のiPadから送信されました

2013年11月29日、7時22分で、njsmith [email protected]書きました:

現代でも同じ問題が発生していることを確認できますか
distutils / setuptools / pip?


このメールに直接返信するか、
Gi tHubhttps://github.com/numpy/numpy/issues/2434#issuecomment -29485806

この問題に遭遇したので、そこにあることを確認できます。 オプションinstall_requiresは、実際には必要ないときにカスタムインストールスクリプトを作成するよりも優先する必要があります。

OS:Mac 10.8.3

この問題をに当てる。 ショーが止まったわけではありませんが、間違いなく迷惑です。 特に、それがユーザー/環境の問題ではなくバグであることは決して明らかではないためです。

次のように作成された2.7virtualenvにパンダ( install_requiresを使用)をインストールして、これを再現しようとしました。

$ virtualenv --no-site-packages nonumpy
$ source nonumpy/bin/activate
$ cd $PANDAS_DIR
$ pip install cython # needed for pandas
$ python setup.py install

誰かがこれを再現する簡単な方法を与えることができれば、それは助けになるでしょう。

2.7仮想環境でもこの問題が発生します。 os ubuntu wheezy

@zethraeusこれを再現するための一連のコマンドを提供できますか(上記の私のコメントのように)? 問題を再現できない場合、修正するのは困難です。

こんにちは! 時間がかかりすぎて申し訳ありませんが、こちらが再生機です。

参照: https

@ kejbaly2の例をありがとう、私は今それを再現することができます。

SOに関する同じ問題:
http://stackoverflow.com/questions/20356725/error-installing-numpy-via-setup-tools-in-virtualenv-on-ubuntu
http://stackoverflow.com/questions/19904957/installing-numpy-as-a-dependency-in-setup-py

そして、Red Hatバグトラッカー: https

pipが正しく行うことは他にもありますが、 setuptoolsなくinstall_requireshttps

install_requiresとnumpyを使おうとすると非常によく似た問題が発生します

Red Hat6.5でエラーを再現する方法は次のとおりです。
https://gist.github.com/necrolyte2/530e9b39dcb0259b69d4

この問題が発生している人のための参考として、最新バージョンのsetuptoolsでは、回避策はNumPyをsetup_requiresに追加することです。 私はまだinstall_requiresに保管しているので、 setup.pyは次のようになります。

setup(
...
    setup_requires=["numpy"],
    install_requires=["numpy"],
)

これは機能し、Mac OS XとLinuxの両方にNumPyを1回だけインストールします(Windowsではテストされていません)。

なぜ私には手がかりがないの

Astropy自体が別のパッケージのsetup_requiresとしてインストールされているときに、NumpyのビルドがAstropyでsetup_requires=['Numpy']を介して実行されているときに発生する可能性がある、同様の問題を追跡しようとしています。 (私はこれを「setupception」と呼んでいます)。

私はそれをこの古代の(しかし原則としてまだわずかに関連していますか?)ビットのコードまで追跡しました: https

ほとんどの場合、Numpyのsetup.pyを実行すると、 configurationという関数がnumpy.distutils.core.setup kwargsに押し込まれます。 numpy.distutils.core.setup順番にポップ'configuration'セットアップkwargsからオフキーは、その後でいくつかの"魔法"のグローバル変数設定distutils.coreして、再帰的に_itself_呼び出します。 この再帰呼び出しの目的は、distutils機構を使用して、コマンドライン引数でエラー/ -helpをチェックすることです。

次にすべてのNumpyサブパッケージを構成するプロセスを開始setup()関数を再度呼び出します。

これがすべてうまくいかないのは、 ConfigurationマネージャーDistributionオブジェクトに何かをアタッチするために、 get_distributionユーティリティを呼び出す必要がある場合があるということです。 これの必要性は議論の余地があります。 内のコードのいくつかの部分がありながら、実際には、 Configurationこれを行うことができるはずだと思う、すでにそこにあるかと思い、他の部分があるDistributionに添付インスタンスdistutils.core._setup_distribution次に、何かが間違っている可能性があります(したがって、「distutilsディストリビューションが初期化されているため、サブパッケージを追加するには遅すぎる可能性があります」という警告がこのスレッドで報告されています)。

少しバックアップして、うまくいけば明確にするために、distutils(またはsetuptools)からsetup()関数を実行すると、 setup() kwargsからDistributionオブジェクトが初期化され、結果としてDistributionがグローバル変数distutils.core._setup_distributionます。 現在のPythonインタープリターで実行されるのは_only_セットアップであると想定しているため、実際にこの変数をクリーンアップすることはありません。 setupception用に設計されていません。 (pipは、各パッケージを独自のサブプロセスからインストールすることにより、複数のパッケージをインストールするときにこの問題や同様の問題を回避します)。 ただし、 setup_requiresなどの他のケースでは、ルートパッケージのDistributionインスタンスがdistutils.core._setup_distributionぶら下がっている可能性があります。 したがって、NumpyのConfigurationクラスが_Numpy自体_のDistributionオブジェクトに何かをアタッチしようとすると、場合によっては間違ったDistributionをいじってしまう可能性があります。 これにより、一部のビットが欠落しているため、Numpyビルドが破損します。

これには、setuptools側および/またはNumpy側の両方から、いくつかの可能な回避策があります。 私は最善のアプローチが何であるかを決めていませんが、全体は間違いなく混乱しています:)

価値があるものとして、setuptoolsの終わりから考えられる回避策の1つは、setuptoolsがsetupceptionを実現するために使用する関数、 setuptools.sandbox.run_setupで、セットアップの実行前/実行後にすべてのdistutils.coreグローバル変数を保存/復元することです。問題のスクリプト。

たまたま、setuptoolsの現在のバージョンでは、子のsetup.pyスクリプトを呼び出す前に、元のdistutils.coresys.modulesから削除する)ことで、すでに修正されていると思います。 それはそれを処理する必要があります。 しかし、私はこれを再確認していません。

更新:確認済み、上記の問題はsetuptools> = 10.0で回避されています(多少は偶然です)。

@embrayそれはちょっとした探偵の仕事です! (そしてそれは私の頭を少し傷つけます:))

あなたは正しいです、 easy_install -そしてそれ故に私が推測するget_distribution() -はまだ十分に関連しているので、私たちはそれを壊すべきではありません。

@rgommers問題は、

@embrayはいいですね。 パッチの準備ができて、2週間以内にレビューされない場合は、私を(穏やかに)蹴ってください。

setup_requires = ["numpy"]が機能しませんでした。 このエラーメッセージが表示されました:

AttributeError: 'モジュール'オブジェクトに属性 'get_include'がありません。

しかし、「python setup.py install」をもう一度実行すると、問題が修正されました。 http://stackoverflow.com/questions/21605927/why-doesnt-setup-requires-work-properly-for-numpyも参照して

@asmaierによって報告された問題に遭遇しました。

その価値については、この問題を修正するためのアイデアを決して忘れませんでしたが、今は他のことに集中する必要がありました。 他の誰かがそれを突き刺したいのであれば、私は彼らがどこを見に行くかもしれないかについていくつかの高レベルの推奨をしました、ここからいくつかのコメント。

したがって、この問題は__builtins__.__NUMPY_SETUP__ = Trueが設定されているという事実によるものです
依存関係としてnumpyを必要とする依存関係をインストールする場合、 __NUMPY_SETUP__はsetuptoolsによってリセットされません。
ここで__NUMPY_SETUP__ = Falseを設定しようとしているようです
https://github.com/numpy/numpy/blob/055056a3108ab19883e50ac125ab9974823498c7/numpy/distutils/misc_util.py#L2195
しかし、前の行に戻ったため、このコードに到達することはありません。

実際、ここではisbootstrapping関数全体が__builtins__を悪用/悪用していると思います。これは、依存関係としてnumpyがあり、依存関係としてnumpyがある依存関係がある場合に機能しなくなります。

@JensTimmermanこれはhttps://github.com/matplotlib/matplotlib/issues/6928にも関連していると思い

これを修正する適切な方法の提案は大歓迎です。

@rgommersの考え?

ここでNUMPY_SETUP = Falseを設定しようとしているようです
https://github.com/numpy/numpy/blob/055056a3108ab19883e50ac125ab9974823498c7/numpy/distutils/misc_util.py#L2195
しかし、前の行に戻ったため、このコードに到達することはありません。

そのis_bootstrapping関数は、見た目はどこにも使用されていないため、関係ありません。

実際に、私は、全体isbootstrapping機能がブレークはあなたが依存関係としてnumpyのを持っており、依存関係としてnumpyのを持っている依存関係を持っているような方法で、ここで組み込みコマンドを乱用/誤用されると信じています。

__builtins__の唯一の使用法は、ここのメインのsetup.pyです

それは醜いですが、それをより堅牢な方法で書くことも難しいです。 現時点では私の推測では、これで問題があるなら、それだけのために表示されますということですsetup_requires='numpy'で、いくつかの状況下ではなくinstall_requires 。 それらの違いは、 pipがまだそれを処理する方法を知らないため、前者がsetuptools呼び出すことです。 Scipyではsetup_requires='numpy'使用していますが、これで問題が発生したことはありません。 だから、それはそれに加えて、matplotlibのセットアップスクリプトのファンキーさかもしれません。

https://github.com/numpy/numpy/issues/2434#issuecomment -77898051をもう一度読んで、問題の原因をよく説明しているようですが、 __NUMPY_SETUP__とは何の関係もないと思います

編集:または場合によってはそうなるかもしれませんが、別の方法で対処するのは難しいです。 pipは、十分に分離された方法でビルド/インストールすることができるため、通常、ここでは問題はありません。

setup.py最後にdel builtins.__NUMPY_SETUP__を使用して、この理論が正しいか間違っているかを証明するのはそれほど難しいことではありません。

gh-7956で試してみました

https://github.com/numpy/numpy/issues/2434#issuecomment -49156521の要点がいつか消えた場合に備えて、この問題を再現する方法のコピーを次に示します。

cd /tmp

cat > ./setup.py <<DELIM
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: "Chris Ward" <[email protected]>

from setuptools import setup

default_setup = dict(
    name='numpy_install_test',
    description='https://github.com/numpy/numpy/issues/2434',
    provides=['numpy_install_test'],
    install_requires=['pandas'],
    requires=['pandas'],
    license='GPLv3',
    author='Chris Ward',
    author_email='[email protected]',
)   

setup(**default_setup)

DELIM


virtualenv --no-site-packages ~/virtenvs/nonumpy
source ~/virtenvs/nonumpy/bin/activate
python setup.py install

pip install -Rrequirements.txtを使用してpython2.7.16にパンダをインストールするのに苦労している

https://files.pythonhosted.org/packages/b2/4c/b6f966ac91c5670ba4ef0b0b5613b5379e3c7abdfad4e7b89a87d73bae13/pandas-0.24.2.tar.gz(11.8MB
コマンドpythonsetup.py egg_infoからの完全な出力:
トレースバック(最後の最後の呼び出し):
ファイル ""、1行目、
ファイル "/tmp/pip-install-WznqHc/pandas/setup.py"、行746、
setuptools_kwargs)ファイル "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py"、144行目、セットアップ_install_setup_requires(attrs)_install_setup_requiresのファイル "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py"、139行目dist.fetch_build_eggs(dist.setup_requires)fetch_build_eggsのファイル "/usr/local/lib/python2.7/site-packages/setuptools/dist.py"、行724replace_conflicting = True、ファイル "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py"、行782、解決中replace_conflicting = replace_conflictingファイル "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py"、行1065、best_matchself.obtain(req、installer)を返しますファイル "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py"、行1077、取得中インストーラーを返す(要件)fetch_build_egg内のファイル "/usr/local/lib/python2.7/site-packages/setuptools/dist.py"、791行目cmd.easy_install(req)を返しますeasy_installのファイル "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py"、行679self.install_item(spec、dist.location、tmpdir、deps)を返しますinstall_itemのファイル "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py"、行705dists = self.install_eggs(spec、download、tmpdir)install_eggsのファイル "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py"、行890self.build_and_install(setup_script、setup_base)を返しますbuild_and_installのファイル "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py"、1158行目self.run_setup(setup_script、setup_base、args)run_setupのファイル「/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py」、1144行目run_setup(setup_script、args)run_setupのファイル「/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py」、253行目上げる__exit__のファイル "/usr/local/lib/python2.7/contextlib.py"、35行目self.gen.throw(type、value、traceback)setup_context内のファイル "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py"、行195産出__exit__のファイル "/usr/local/lib/python2.7/contextlib.py"、35行目self.gen.throw(type、value、traceback)save_modules内のファイル「/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py」、166行目saved_exc.resume()ファイル "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py"、141行目、履歴書six.reraise(type、exc、self._tb)save_modules内のファイル「/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py」、154行目歩留まりの節約setup_context内のファイル "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py"、行195産出run_setupのファイル "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py"、行250_execfile(setup_script、ns)_execfile内のファイル "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py"、45行目exec(コード、グローバル、ローカル)**ファイル "/tmp/easy_install-2M8B7z/numpy-1.17.0rc1/setup.py"、31行目

**RuntimeError: Python version >= 3.5 required.**

python2をサポートしていないnumpy-1.17.0rc1を探す理由がわからない

助けていただければ幸いです、ありがとう

requirements.txt共有してください

要件ファイルには次のものが含まれます。

フラスコ== 1.0.2
フラスコ-jwt == 0.3.2
フラスコスクリプト== 2.0.6
フラスコ-scrypt == 0.1.3.6
PyJWT <1.5.0
ブリンカー== 1.4
電話番号== 8.9.12
フランカー== 0.9.0
bugsnag == 3.4.3
pickledb == 0.7.2
リクエスト== 2.19.1
python-dateutil == 2.8.0
gunicorn == 19.9.0
gevent == 1.3.6
webargs == 4.0.0
ply == 3.10
bson == 0.5.7
セロリ== 4.2.1
redis == 3.2.1
雇う
numpy == 1.16.4

最後に、numpyを要件ファイル内に保持し、後でパンダをインストールするように管理します

Dockerでコマンドを実行します。

実行pipインストールhttps://github.com/pydata/pandas/releases/download/v0.24.2/pandas-0.24.2.tar.gz

ただし、パンダをコンパイルするにはcythonをインストールする必要があるという、コンパイルに別の問題があります。

エラー:

例外:Cythonで生成されたファイル 'pandas / io / sas /sas.c'が見つかりません。
Cythonは、開発ブランチからパンダをコンパイルする必要があります。
Cythonをインストールするか、パンダのリリースパッケージをダウンロードしてください。

何か案が?

install_requires内でのsetup.py install_requires使用に関するこの問題とは関係ありません。 新しい号を開いてください。 あなたは本当にソースからパンダをインストールする必要がありますか? なぜpip install pandas==0.24.2ないのですか?

はい、パンダライブラリでこの問題を開きます。 ただし、パンダを直接インストールできないため、numPyに関連する前述の投稿は、Dockerenvの下のPython2.7に正しくインストールされています。
なぜpipinstall pandas == 0.24.2ではないのですか? Dockerの下で実行すると、それが表示されるためです。

例外:Cythonで生成されたファイル 'pandas /msgpack.c'が見つかりません。
Cythonは、開発ブランチからパンダをコンパイルする必要があります。
Cythonをインストールするか、パンダのリリースパッケージをダウンロードしてください。

だから私はtarballからインストールされるパンダのリリースバージョンを使用する必要があります

閉鎖。 Pythonの世界はsetup_requiresからrequirements.txtまたはpyproject.toml向かっていると思います。 まだsetup_requiresを使用したい場合の回避策は、以下のとおりです。

setup(
...
    setup_requires=["numpy"],
    install_requires=["numpy"],
)

python2にnumpyをインストールしようとしている@omeryounusに関しては、これはこれに関連しない別の問題です。 一部のユーザーは、pipとsetuptoolsを最新バージョンにアップグレードするとその問題が解決したと報告しています。

setup_requiresについてさらに話し合うことがある場合は、再開してください。

このページは役に立ちましたか?
0 / 5 - 0 評価