我正在尝试在自己的Python应用程序上使用py-spy,该应用程序的开发和部署主要发生在Docker容器即python:3.7-alpine中。当我在virtualenv中本地运行pip install py-spy
时,它会成功。此外,pypi has a listing for it。
奇怪的是,当我将其包含在Pipfile中时,pipenv install
无法在Docker容器中找到它,并且在尝试构建时失败。 但是它会正确找到并安装其他Pipenv内容。
Dockerfile看起来像这样:
FROM python:3.7-alpine3.8
RUN mkdir -p /opt/app
WORKDIR /opt/app
RUN set -ex \
&& apk add libpq shadow \
&& apk add --no-cache --virtual .build-deps \
gcc \
git \
bash \
tmux \
make \
libcurl \
curl-dev \
libc-dev \
musl-dev \
linux-headers \
pcre-dev \
postgresql-dev \
postgresql-libs \
libffi-dev \
ncurses-dev \
python3-dev
RUN pip install pipenv
COPY Pipfile Pipfile.lock ./
RUN pipenv install --system --deploy --dev
# This is where we fail
没有py-spy
,整个过程就会建立。使用py-spy = "*"
,运行pipenv lock && docker-compose build
,我们得到了
An error occurred while installing py-spy==0.2.0.dev1 --hash=sha256:27f318826cb99a3cc4a089d8991e08ba8c86743ed9191799f39bc02cf1964a05 --hash=sha256:9e3d3f199c360dee58dbc9ce82e4dd9cb5ae3356466b25a8276bb972fdced2d9 --hash=sha256:c7c07b1557f372701ca3096582d487a19dd5ee7d0143c2c8dd3bdb0ec37c9450! Will try again.
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1874, in do_install
[pipenv.exceptions.InstallError]: keep_outdated=keep_outdated
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting py-spy==0.2.0.dev1 (from -r /tmp/pipenv-jxl1heir-requirements/pipenv-8_kalqyx-requirement.txt (line 1))']
[pipenv.exceptions.InstallError]: ['ERROR: Could not find a version that satisfies the requirement py-spy==0.2.0.dev1 (from -r /tmp/pipenv-jxl1heir-requirements/pipenv-8_kalqyx-requirement.txt (line 1)) (from versions: none)', 'ERROR: No matching distribution found for py-spy==0.2.0.dev1 (from -r /tmp/pipenv-jxl1heir-requirements/pipenv-8_kalqyx-requirement.txt (line 1))']
ERROR: ERROR: Package installation failed...
这会响吗? py-spy
具有Rust依赖关系,有没有办法检查它在某些架构中是否“不可见”?
答案 0 :(得分:0)
是this:
高山python退出了许多Linux轮子:pypa/pip#3969 (comment)。在Alpine Docker容器上安装py-spy之前,请执行以下操作:
echo 'manylinux1_compatible = True' > /usr/local/lib/python3.7/site-packages/_manylinux.py