我的Dockerfile使用pypy基失败,出现FileNotFoundError:[Errno 2]没有这样的文件或目录:'llvm-config'安装llvmlite时,numba的依赖项列在我的requirements.txt中
我试着按照这里的说明进行更新Python numba / llvmlite on Debian 8 - i can't build llvmlite
我的错误更详细:
Building wheels for collected packages: llvmlite
Building wheel for llvmlite (setup.py): started
Building wheel for llvmlite (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/pypy3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ux49fegr/llvmlite/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ux49fegr/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 /tmp/pip-wheel-8s6wwump --python-tag pp371
cwd: /tmp/pip-install-ux49fegr/llvmlite/
Complete output (26 lines):
running bdist_wheel
/usr/local/bin/pypy3 /tmp/pip-install-ux49fegr/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-install-ux49fegr/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/local/lib-python/3/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/local/lib-python/3/subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/lib-python/3/subprocess.py", line 722, in __init__
restore_signals, start_new_session)
File "/usr/local/lib-python/3/subprocess.py", line 1354, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
我不想要conda安装的沉重负担。有没有办法在没有它的情况下实现pypy的numba安装?
FROM pypy:3.6-slim-stretch
RUN apt-get update && apt-get install -y gnupg wget software-properties-common
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 15CF4D18AF4F7421
RUN apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-6.0 main"
RUN apt-get update
RUN apt-get -y install cython python-llvm build-essential libedit-dev
RUN apt-get -y install libllvm6.0 llvm-6.0-dev llvm-dev
RUN pip install enum34
ENV LLVM_CONFIG=/usr/lib/llvm-6.0-dev/bin/llvm-config pip install llvmlite
ENV LLVM_CONFIG=/usr/lib/llvm-6.0-dev/bin/llvm-config pip install numba
# ENV LD_LIBRARY_PATH /usr/lib/llvm-6.0-dev/lib/
#... other stuff
RUN apt-get clean && apt-get -y update
RUN apt-get -y install python3-dev \
&& apt-get -y install build-essential
# Add requirements
COPY requirements.txt /tmp/
# Install sphinx first as it does not work inside requirements
RUN pip install -U pip && pip install -U sphinx && pip install numpy && pip install cython && \
pip install -r /tmp/requirements.txt
我期望在pypy上用numba干净地构建docker镜像
8条答案
按热度按时间f3temu5u1#
变通方法如果错误出现在4月17日之后(他们发布了新版本,请参阅历史记录)。作为变通方法,请尝试安装以前的版本
vltsax252#
目前numba不会安装在python 3.9上。
我将我的基本docker镜像从
python:3.9-slim
更改为python:3.8-slim
,然后pip install numba
成功7xllpg7q3#
它帮我修好了-
使用版本8,因为在最新的llvm版本中得到了一个错误-
参考-https://apt.llvm.org/
au9on6nz4#
“真实的”的解决方案是鼓励llvmlite和/或numba为pypy发布一个轮子。但是对于眼前的问题...
不知怎么的,你错过了一个llvm安装,至少根据apt-file:
jv2fixgn5#
要在macOS上的Python 3.9上安装
numba
,请执行以下操作:以上是与:
llvmlite
,以及numba
at commit ca8132ba5e43fc3f79767046ed55217aeeabb35e.x3naxklr6#
根据https://askubuntu.com/questions/1286131/how-do-i-install-llvm-10-on-ubuntu-18-04我添加到Dockerfile的行
它工作了(
llvmlite
已安装)xkrw2x1b7#
这是解决方案,从这个github issues thread获得,对我有用!本质上,
pip
只需要在安装库之前在Dockerfile中升级。我所需要做的就是在我的Dockerfile中添加这行:下面是我的Dockerfile示例:
这是针对python3.6的
t8e9dugd8#
我在使用python3.8时遇到了这个问题,但最终的解决方案只是将我的PIP更新到23.0.1版本,它解决了这个问题。