Pip/pipenv 在 Docker 容器中找不到包裹?
Pip/pipenv not finding package inside Docker container?
我正在尝试使用 py-spy on my Python application who's development and deployment primarily happens in a Docker container, namely, python:3.7-alpine. When I run pip install py-spy
locally in a virtualenv, it succeeds. Additionally, pypi has a listing for it。
奇怪的是,当我将它包含在我的 Pipfile 中时,pipenv install
无法在 Docker 容器中找到它并且在尝试构建时失败。 但它会正确找到并安装其他 Pipenv 内容。
Docker文件如下所示:
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 依赖项,有没有办法检查它是否 "invisible" 对某些架构?
是this:
Alpine python opts out of the manylinux wheels: pypa/pip#3969 (comment). Before installing py-spy on Alpine docker containers do:
echo 'manylinux1_compatible = True' > /usr/local/lib/python3.7/site-packages/_manylinux.py
我正在尝试使用 py-spy on my Python application who's development and deployment primarily happens in a Docker container, namely, python:3.7-alpine. When I run pip install py-spy
locally in a virtualenv, it succeeds. Additionally, pypi has a listing for it。
奇怪的是,当我将它包含在我的 Pipfile 中时,pipenv install
无法在 Docker 容器中找到它并且在尝试构建时失败。 但它会正确找到并安装其他 Pipenv 内容。
Docker文件如下所示:
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 依赖项,有没有办法检查它是否 "invisible" 对某些架构?
是this:
Alpine python opts out of the manylinux wheels: pypa/pip#3969 (comment). Before installing py-spy on Alpine docker containers do:
echo 'manylinux1_compatible = True' > /usr/local/lib/python3.7/site-packages/_manylinux.py