我一直在为这事而挣扎,我需要一些帮助。我正在尝试创建我的python应用程序的对接图像。我的应用程序使用奥尔森,这是用于python的快速JSON库。这个库的一部分是用铁锈建造的,所以我需要铁锈工具链。现在的关键是,我使用阿尔卑斯的小足迹,所以它没有任何标准的工具包括在内。我需要自己安排好一切。
这里是我的Dockerfile来模拟这个问题。
FROM python:3.7-alpine
# for orjson in requirements.txt
RUN apk add rust cargo
RUN pip install orjson这是我面临的错误信息。
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM python:3.7-alpine
---> 6a5ca85ed89b
Step 2/3 : RUN apk add rust cargo
---> Running in b86315a52e50
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/19) Installing rust-stdlib (1.43.1-r1)
(2/19) Installing libgcc (9.3.0-r2)
(3/19) Installing libstdc++ (9.3.0-r2)
(4/19) Installing binutils (2.34-r1)
(5/19) Installing gmp (6.2.0-r0)
(6/19) Installing isl (0.18-r0)
(7/19) Installing libgomp (9.3.0-r2)
(8/19) Installing libatomic (9.3.0-r2)
(9/19) Installing libgphobos (9.3.0-r2)
(10/19) Installing mpfr4 (4.0.2-r4)
(11/19) Installing mpc1 (1.1.0-r1)
(12/19) Installing gcc (9.3.0-r2)
(13/19) Installing musl-dev (1.1.24-r8)
(14/19) Installing libxml2 (2.9.10-r4)
(15/19) Installing llvm10-libs (10.0.0-r2)
(16/19) Installing rust (1.43.1-r1)
(17/19) Installing nghttp2-libs (1.41.0-r0)
(18/19) Installing libcurl (7.69.1-r0)
(19/19) Installing cargo (1.43.1-r1)
Executing busybox-1.31.1-r16.trigger
OK: 334 MiB in 54 packages
Removing intermediate container b86315a52e50
---> 07671da6f533
Step 3/3 : RUN pip install orjson
---> Running in 9c72ff2b2e3e
Collecting orjson
Downloading orjson-3.0.2.tar.gz (649 kB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxhkdxsol
cwd: /tmp/pip-install-0x1gorur/orjson
Complete output (14 lines):
maturin failed
Caused by: Cargo metadata failed. Do you have cargo in your PATH?
Caused by: Error during execution of `cargo metadata`: error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Z mutable-noalias --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: the option `Z` is only accepted on the nightly compiler
Checking for Rust toolchain....
Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-7txy00_d --manylinux=off --strip=on`
Error: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-7txy00_d', '--manylinux=off', '--strip=on']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxhkdxsol Check the logs for full command output.
The command '/bin/sh -c pip install orjson' returned a non-zero code: 1我有点不知所措,我应该安装什么,以获得一个铁锈环境在阿尔卑斯山。任何帮助都将不胜感激。
发布于 2020-06-16 16:48:45
多亏了@nitishkumar-singh的回应,我才能让它发挥作用。这篇文章中有一些错误,如果有人遇到这个问题,这里是我的Dockerfile。
FROM python:3.7-alpine3.11
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.11/main" >> /etc/apk/repositories
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.11/community" >> /etc/apk/repositories
RUN apk add --no-cache python3 gcompat patchelf
RUN patchelf --add-needed libgcompat.so.0 /usr/bin/python3
RUN echo 'manylinux1_compatible = True' > /usr/local/lib/python3.7/_manylinux.py &&\
pip3 install orjson &&\
rm /usr/local/lib/python3.7/_manylinux.py发布于 2020-06-16 03:24:58
请遵循这个github问题讨论,以获得更多的清晰度。
Dockerfile
FROM alpine:3.10
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.10/main" >> /etc/apk/repositories
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.10/community" >> /etc/apk/repositories
RUN apk add --no-cache python3 gcompat patchelf
RUN patchelf --add-needed libgcompat.so.0 /usr/bin/python3.7
RUN echo 'manylinux1_compatible = True' > /usr/lib/python3.7/_manylinux.py &&\
pip3 install orjson &&\
rm /usr/lib/python3.7/_manylinux.py发布于 2021-07-24 04:20:06
大多数发行版使用glibc,阿尔卑斯使用musl,这就是您必须重新编译所有内容的原因。如果您真的需要构建一个生产级容器,那么您就注定要找到并安装所有的依赖项。
如果你和我一样,你只需要运行你的dev env,就从高山切换到伸展,你的所有问题都会消失。
这是消息来源:
https://github.com/ijl/orjson/issues/98#issuecomment-643248331
https://stackoverflow.com/questions/62207959
复制相似问题