Closed sburns closed 6 years ago
per #1939 and #1979 you need to include a lockfile -- see https://github.com/pypa/pipenv/issues/1002#issuecomment-381128601
editable vcs dependencies require you to do dependency resolution which always requires a virtualenv
@techalchemy I am a little confused by the statement:
"editable vcs dependencies require you to do dependency resolution which always requires a virtualenv".
We have editable dependencies in our Pipfile, and when we run pipenv install --system --deploy --verbose
in our dockerfile it is creating a virtualenv and a lock file from scratch (even though the lock file is in the image). Is this unavoidable? (it takes an extremely long time...).
This is the output - it happens after it's installed all the editable/local dependencies, and can take 20mins or so.
Creating a virtualenv for this project…
Using /usr/local/bin/python3.6 (3.6.2) to create virtualenv…
Already using interpreter /usr/local/bin/python3.6
Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/slurmfactory-vhvnywio/bin/python3.6
Also creating executable in /root/.local/share/virtualenvs/slurmfactory-vhvnywio/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /root/.local/share/virtualenvs/slurmfactory-vhvnywio
Pipfile.lock (d9d4e3) out of date, updating to (cc6154)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
@joejuzl the —deploy
flag is supposed to fail if the lockfile is out of date. If this is not happening please file an issue on that.
No, —system
is not meant to create virtualenvs. The problem is you showed me your output but not your input. If you’re experiencing unexpected behavior I need all of your inputs
So the contents of my Pipfile
is:
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
"0527503" = {path = "../diomedes/", editable = true}
"502a27f" = {path = "../tube_transport/", editable = true}
"6f2d9c9" = {path = "../base/", editable = true}
"91927d2" = {path = "../ml_runner/", editable = true}
"7e3d267" = {path = "../xb_logging/", editable = true}
"ecc5d41" = {path = "../mail_utils/", editable = true}
"d4b7ac4" = {path = "../xb_activity_report/", editable = true}
"argon2" = "==0.1.10"
"argon2-cffi" = "==16.3.0"
"jinja2" = "==2.9.6"
aioredis = "==0.3.0"
arrow = "==0.10.0"
click = "==6.7"
flask = "==0.12.2"
itsdangerous = "==0.24"
keras = "==2.0.3"
markupsafe = "==1.0"
pyowm = "==2.7.1"
python-dateutil = "==2.6.0"
python-gmaps = "==0.3.1"
redlock-py = "==1.0.8"
rq = "==0.8.0"
rq-dashboard = "==0.3.8"
rq-scheduler = "==0.7.0"
scikit-learn = "==0.18.1"
scipy = "==0.19.0"
six = "==1.10.0"
uvloop = "==0.8.0"
werkzeug = "==0.12.2"
sklearn = "*"
[dev-packages]
coverage = "*"
pylint = "*"
pytest = "*"
pytest-cov = "*"
pytest-env = "*"
pytest-mock = "*"
pytest-sugar = "*"
I have attached the Pipfile.lock
as it's quite large (changed to .txt so I can upload).
They are both in the directory slurmfactory
This is my docker file:
FROM eu.gcr.io/io-xbird-milkyway/base:1.0
COPY . /opt/app/
WORKDIR /opt/app/slurmfactory
RUN pipenv install --system --deploy --verbose
ENV PYTHONUNBUFFERED 1
I have attached the output of my docker build up until it hangs for 20mins creating a lock file. After that point it just continues to install all the non-editable dependencies.
If you need anything else, let me know!
This only happens on 11.10.0 not 11.9.0
Thanks!
Hi @techalchemy while PR #2006 does seem like a bug, it doesn't fix the issue I am referring too! I have tried the same steps with that commit - and it still tries to create a new virtualenv... I can provide more output if necessary.
@joejuzl try pip install —upgrade —pre pipenv
and let me know if this is resolved
I get this error when running pipenv lock
Locking [dev-packages] dependencies…
odule>
from .pypi import PyPIRepository
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 11, in <module>
from notpip.index import PackageFinder
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/index.py", line 33, in <module>
from notpip._vendor import html5lib, requests, six
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/requests/__init__.py", line 98, in <module>
from . import packages
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/requests/packages.py", line 8, in <module>
locals()[package] = __import__(vendored_package)
ModuleNotFoundError: No module named 'pip._vendor.urllib3'
@joejuzl the comment directly above yours describes a temporary fix, I’ll have a release out in an hour or so
This error is still occuring, is there any recommended fix?
I noticed an issue in my docker builds this morning using this
Dockerfile
:(Pretty standard stuff, I don't believe Docker is the issue here)
Here is a log of the docker build:
{'implementation_name': 'cpython', 'implementation_version': '3.6.4', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_python_implementation': 'CPython', 'platform_release': '4.9.87-linuxkit-aufs', 'platform_system': 'Linux', 'platform_version': '#1 SMP Wed Mar 14 15:12:16 UTC 2018', 'python_full_version': '3.6.4', 'python_version': '3.6', 'sys_platform': 'linux'}
Contents of
Pipfile.lock
('/app/Pipfile.lock'):Removing intermediate container 55fe7525e82e ---> 3e730a1c2fa6 Step 10/11 : ENV PYTHONPATH /app ---> Running in 5eeb6a675f18 Removing intermediate container 5eeb6a675f18 ---> d2fb733b0987 Step 11/11 : ENTRYPOINT ["/docker-entrypoint.sh"] ---> Running in d6af7ad2592b Removing intermediate container d6af7ad2592b ---> 4fd18ed472d9 Successfully built 4fd18ed472d9 Successfully tagged peach:latest
$ cat Dockerfile FROM python:3.6
WORKDIR /app
COPY . . RUN pip install -U pip RUN pip install pipenv RUN pipenv install --deploy --system ENV PYTHONPATH /app $ cat Pipfile [[source]]
url = "https://pypi.python.org/simple" verify_ssl = true name = "pypi"
[packages]
Django = {git = "https://github.com/django/django.git", editable = true}
[dev-packages]
[requires]
python_version = "3.6" $ docker build . ~/dev/pipenv-test Sending build context to Docker daemon 4.608kB Step 1/7 : FROM python:3.6 ---> 336d482502ab Step 2/7 : WORKDIR /app ---> Using cache ---> 485f81cfa840 Step 3/7 : COPY . . ---> 49c882489ae1 Step 4/7 : RUN pip install -U pip ---> Running in 4e655cc62b67 Collecting pip Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB) Installing collected packages: pip Found existing installation: pip 9.0.1 Uninstalling pip-9.0.1: Successfully uninstalled pip-9.0.1 Successfully installed pip-9.0.3 Removing intermediate container 4e655cc62b67 ---> 5477835d99bd Step 5/7 : RUN pip install pipenv ---> Running in 16c2f32f55e4 Collecting pipenv Downloading pipenv-11.10.0-py3-none-any.whl (5.6MB) Collecting virtualenv-clone>=0.2.5 (from pipenv) Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.6/site-packages (from pipenv) Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv) Collecting virtualenv (from pipenv) Downloading virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB) Collecting certifi (from pipenv) Downloading certifi-2018.1.18-py2.py3-none-any.whl (151kB) Installing collected packages: virtualenv-clone, virtualenv, certifi, pipenv Successfully installed certifi-2018.1.18 pipenv-11.10.0 virtualenv-15.2.0 virtualenv-clone-0.3.0 Removing intermediate container 16c2f32f55e4 ---> 0d6b971f8cad Step 6/7 : RUN pipenv install --deploy --system ---> Running in 1c8c621383f8 Installing -e git+https://github.com/django/django.git#egg=Django… Obtaining Django from git+https://github.com/django/django.git#egg=Django Cloning https://github.com/django/django.git to ./src/django Collecting pytz (from Django) Downloading pytz-2018.4-py2.py3-none-any.whl (510kB) Installing collected packages: pytz, Django Running setup.py develop for Django Successfully installed Django pytz-2018.4
Adding -e git+https://github.com/django/django.git#egg=Django to Pipfile's [packages]… Creating a virtualenv for this project… Using /usr/local/bin/python (3.6.4) to create virtualenv… Already using interpreter /usr/local/bin/python Using base prefix '/usr/local' New python executable in /root/.local/share/virtualenvs/app-4PlAip0Q/bin/python Installing setuptools, pip, wheel...done.
Virtualenv location: /root/.local/share/virtualenvs/app-4PlAip0Q Installing dependencies from Pipfile.lock (504886)… Removing intermediate container 1c8c621383f8 ---> 8e08221d59d2 Step 7/7 : ENV PYTHONPATH /app ---> Running in b2dbe9c39856 Removing intermediate container b2dbe9c39856 ---> f65135fd2dbf Successfully built f65135fd2dbf