下面是报错信息
Collecting numpy
Downloading https://files.pythonhosted.org/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip (5.1MB)
Collecting pandas
Downloading https://files.pythonhosted.org/packages/81/fd/b1f17f7dc914047cd1df9d6813b944ee446973baafe8106e4458bfb68884/pandas-0.24.1.tar.gz (11.8MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 357, in get_provider
module = sys.modules[moduleOrReq]
KeyError: 'numpy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-8c3o0ycd/pandas/setup.py", line 732, in <module>
ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
File "/tmp/pip-install-8c3o0ycd/pandas/setup.py", line 475, in maybe_cythonize
numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1142, in resource_filename
return get_provider(package_or_requirement).get_resource_filename(
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 359, in get_provider
__import__(moduleOrReq)
ModuleNotFoundError: No module named 'numpy'
之前的安装方式为,在requirement.txt文件里面设置numpy和pandas安装,如下:
pandas==0.24.2
numpy==1.17.0
查阅资料,行之有效的一个解决方案为:调整Dockerfile中安装numpy和pandas的安装方式如下:
RUN pip install python-dateutil==2.8.1 numpy==1.14.3 -i https://mirrors.aliyun.com/pypi/simple
RUN pip install --no-deps pandas==0.23.0 -i https://mirrors.aliyun.com/pypi/simple
RUN cd / && pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
注意版本号尽量按照上述版本号来,好像是存在兼容性问题。