我向PyPI发布了一个Python 3 package(使用this优秀的cookiecutter模板),这取决于使用Cython编写的C
扩展,使用Numba编写的JIT编译以及依赖于Numpy的其他包和这样
如果我未在requirements.txt
和\或install_requires
setupy.py
内指定任何要求,则包安装成功,表明cookiecutter模板正常工作。此外,AppVeyor和Travis等CI工具可以成功构建我的包并对其进行测试。
但是,当我输入需求列表时,无论其顺序如何,pip install
命令都会失败(在一个天真的虚拟环境中),CI工具也无法构建它(错误日志可见在上面的链接)。如果我在该虚拟环境中预先安装Numba,然后尝试pip install
一切正常。这已在Windows(10)和CentOS上复制。
我怀疑当这个问题得到解决时,CI工具也能够成功构建我的包。
Windows日志:
C:\Users\Hagai\Documents\GitHub\python-pysight>activate py36
(py36) C:\Users\Hagai\Documents\GitHub\python-pysight>pip install pysight
Collecting pysight
Downloading pysight-0.1.6-cp36-cp36m-win_amd64.whl (113kB)
100% |████████████████████████████████| 122kB 460kB/s
Collecting attrs>=1.6 (from pysight)
Using cached attrs-16.3.0-py2.py3-none-any.whl
Collecting tables (from pysight)
Using cached tables-3.3.0-cp36-cp36m-win_amd64.whl
Collecting pandas (from pysight)
Using cached pandas-0.19.2-cp36-cp36m-win_amd64.whl
Collecting numba (from pysight)
Using cached numba-0.31.0.tar.gz
Collecting matplotlib (from pysight)
Using cached matplotlib-2.0.0-cp36-cp36m-win_amd64.whl
Collecting tifffile (from pysight)
Collecting cython (from pysight)
Collecting numpy>=1.8.0 (from tables->pysight)
Using cached numpy-1.12.0-cp36-none-win_amd64.whl
Collecting numexpr>=2.5.2 (from tables->pysight)
Using cached numexpr-2.6.2-cp36-none-win_amd64.whl
Collecting six (from tables->pysight)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting pytz>=2011k (from pandas->pysight)
Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting python-dateutil>=2 (from pandas->pysight)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting llvmlite (from numba->pysight)
Using cached llvmlite-0.16.0.tar.gz
Collecting cycler>=0.10 (from matplotlib->pysight)
Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 (from matplotlib->pysight)
Using cached pyparsing-2.1.10-py2.py3-none-any.whl
Building wheels for collected packages: numba, llvmlite
Running setup.py bdist_wheel for numba ... error
Complete output from command C:\Users\Hagai\Anaconda3\envs\py36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Hagai\\AppData\\Local\\Temp\\pip-build-ry0rxpw8\\numba\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Hagai\AppData\Local\Temp\tmpd75ai9dzpip-wheel- --python-tag cp36:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\numba\setup.py", line 250, in <module>
metadata['ext_modules'] = get_ext_modules()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\numba\setup.py", line 82, in get_ext_modules
import numpy.distutils.misc_util as np_misc
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
Failed building wheel for numba
Running setup.py clean for numba
Complete output from command C:\Users\Hagai\Anaconda3\envs\py36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Hagai\\AppData\\Local\\Temp\\pip-build-ry0rxpw8\\numba\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\numba\setup.py", line 250, in <module>
metadata['ext_modules'] = get_ext_modules()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\numba\setup.py", line 82, in get_ext_modules
import numpy.distutils.misc_util as np_misc
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
Failed cleaning build dir for numba
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command C:\Users\Hagai\Anaconda3\envs\py36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Hagai\\AppData\\Local\\Temp\\pip-build-ry0rxpw8\\llvmlite\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Hagai\AppData\Local\Temp\tmpcioz28cjpip-wheel- --python-tag cp36:
running bdist_wheel
running build
got version from file C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\llvmlite/_version.py {'version': '0.16.0', 'full': '964cf1d6d725b000c769379a5efe11932fcfc551'}
running build_ext
C:\Users\Hagai\Anaconda3\envs\py36\python.exe C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py
Trying generator 'Visual Studio 12 2013 Win64'
Traceback (most recent call last):
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 152, in <module>
main()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 140, in main
main_win32()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 74, in main_win32
generator = find_win32_generator()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 62, in find_win32_generator
try_cmake(cmake_dir, build_dir, generator)
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 27, in try_cmake
subprocess.check_call(['cmake', '-G', generator, cmake_dir])
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
error: command 'C:\\Users\\Hagai\\Anaconda3\\envs\\py36\\python.exe' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Failed to build numba llvmlite
Installing collected packages: attrs, numpy, numexpr, six, tables, pytz, python-dateutil, pandas, llvmlite, numba, cycler, pyparsing, matplotlib, tifffile, cython, pysight
Running setup.py install for llvmlite ... error
Complete output from command C:\Users\Hagai\Anaconda3\envs\py36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Hagai\\AppData\\Local\\Temp\\pip-build-ry0rxpw8\\llvmlite\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Hagai\AppData\Local\Temp\pip-9a1uhuys-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
got version from file C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\llvmlite/_version.py {'version': '0.16.0', 'full': '964cf1d6d725b000c769379a5efe11932fcfc551'}
running build_ext
C:\Users\Hagai\Anaconda3\envs\py36\python.exe C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py
Trying generator 'Visual Studio 12 2013 Win64'
Traceback (most recent call last):
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 152, in <module>
main()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 140, in main
main_win32()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 74, in main_win32
generator = find_win32_generator()
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 62, in find_win32_generator
try_cmake(cmake_dir, build_dir, generator)
File "C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\ffi\build.py", line 27, in try_cmake
subprocess.check_call(['cmake', '-G', generator, cmake_dir])
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\Hagai\Anaconda3\envs\py36\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
error: command 'C:\\Users\\Hagai\\Anaconda3\\envs\\py36\\python.exe' failed with exit status 1
----------------------------------------
Command "C:\Users\Hagai\Anaconda3\envs\py36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Hagai\\AppData\\Local\\Temp\\pip-build-ry0rxpw8\\llvmlite\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Hagai\AppData\Local\Temp\pip-9a1uhuys-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Hagai\AppData\Local\Temp\pip-build-ry0rxpw8\llvmlite\
CentOS日志:
File "/tmp/easy_install-x7jp8trx/numba-0.31.0/setup.py", line 250, in <module>
File "/tmp/easy_install-x7jp8trx/numba-0.31.0/setup.py", line 82, in get_ext_modules
'matplotlib',
ModuleNotFoundError: No module named 'numpy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-qkv60_2c/pysight/setup.py", line 104, in <module>
for root, _, _ in os.walk('src')
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/dist.py", line 315, in __init__
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/dist.py", line 361, in fetch_build_eggs
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 851, in resolve
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1123, in best_match
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1135, in obtain
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/dist.py", line 428, in fetch_build_egg
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/command/easy_install.py", line 664, in easy_install
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/command/easy_install.py", line 694, in install_item
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/command/easy_install.py", line 875, in install_eggs
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/command/easy_install.py", line 1114, in build_and_install
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/command/easy_install.py", line 1100, in run_setup
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 249, in run_setup
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/contextlib.py", line 100, in __exit__
self.gen.throw(type, value, traceback)
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 197, in setup_context
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/contextlib.py", line 100, in __exit__
self.gen.throw(type, value, traceback)
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 168, in save_modules
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 143, in resume
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/six.py", line 685, in reraise
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 156, in save_modules
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 197, in setup_context
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 246, in run_setup
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 276, in run
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 245, in runner
File "/opt/anaconda/anaconda2/envs/py36/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/setuptools/sandbox.py", line 47, in _execfile
File "/tmp/easy_install-x7jp8trx/numba-0.31.0/setup.py", line 250, in <module>
File "/tmp/easy_install-x7jp8trx/numba-0.31.0/setup.py", line 82, in get_ext_modules
'matplotlib',
ModuleNotFoundError: No module named 'numpy'