question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

major version bump of virtualenv (updated 2019-02-10) breaks multistage docker builds using pipenv

See original GitHub issue

Issue description

Pipenv installs new version of virtualenv (20.0.1) when updated or installed for the first time. The new version of virtualenv, which is a complete rewrite and does not have the same virtualenv directory structure as previous major release, appears to break python apps deployed using a multistage docker build process, ie.

FROM python:3.6 as build
# install any build dependencies using package manager
RUN pip install pipenv
RUN pipenv install
RUN python setup.py install
FROM python:3.6
COPY --from build <path_to_virtualenv_location> <path_to_location_in_final_step>
ENTRYPOINT ['<path_to_location_in_final_step/bin/<executable_name>'

Expected result

Running container should result in the executable running successfully.

Actual result

Executable fails with ModuleNotFoundError: No module named 'pkg_resources'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
saikillcommented, Feb 11, 2020

We are still getting error with the latest version of virtualenv

Building wheels for collected packages: distlib Building wheel for distlib (setup.py): started Building wheel for distlib (setup.py): finished with status ‘done’ Created wheel for distlib: filename=distlib-0.3.0-py3-none-any.whl size=340427 sha256=06ab30a179b43cbf2e3a63c7d92ab467e6d664bc7d142b889dad313cb875875f Stored in directory: /tmp/.cache/pip/wheels/3d/85/00/c5766a5c95cf8683c50f1c142e3be944b6ffa7d4c9d86ac96d Successfully built distlib Installing collected packages: zipp, importlib-metadata, filelock, distlib, importlib-resources, appdirs, six, virtualenv, virtualenv-clone, certifi, pipenv Successfully installed appdirs-1.4.3 certifi-2019.11.28 distlib-0.3.0 filelock-3.0.12 importlib-metadata-1.5.0 importlib-resources-1.0.2 pipenv-2018.11.26 six-1.14.0 virtualenv-20.0.2 virtualenv-clone-0.5.3 zipp-2.2.0 usage: virtualenv [–version] [–with-traceback] [-v | -q] [–discovery {builtin}] [-p py] [–creator {builtin,cpython3-posix,venv}] [–seeder {app-data,pip}] [–no-seed] [–activators comma_separated_list] [–clear] [–system-site-packages] [–symlinks | --copies] [–download | --no-download] [–extra-search-dir d [d …]] [–pip version] [–setuptools version] [–wheel version] [–no-pip] [–no-setuptools] [–no-wheel] [–clear-app-data] [–symlink-app-data] [–prompt prompt] [-h] dest virtualenv: error: unrecognized arguments: --relocatable Build step ‘Execute shell’ marked build as failure

1reaction
JeffinBaocommented, May 29, 2020

We are still getting error with the latest version of virtualenv

Building wheels for collected packages: distlib Building wheel for distlib (setup.py): started Building wheel for distlib (setup.py): finished with status ‘done’ Created wheel for distlib: filename=distlib-0.3.0-py3-none-any.whl size=340427 sha256=06ab30a179b43cbf2e3a63c7d92ab467e6d664bc7d142b889dad313cb875875f Stored in directory: /tmp/.cache/pip/wheels/3d/85/00/c5766a5c95cf8683c50f1c142e3be944b6ffa7d4c9d86ac96d Successfully built distlib Installing collected packages: zipp, importlib-metadata, filelock, distlib, importlib-resources, appdirs, six, virtualenv, virtualenv-clone, certifi, pipenv Successfully installed appdirs-1.4.3 certifi-2019.11.28 distlib-0.3.0 filelock-3.0.12 importlib-metadata-1.5.0 importlib-resources-1.0.2 pipenv-2018.11.26 six-1.14.0 virtualenv-20.0.2 virtualenv-clone-0.5.3 zipp-2.2.0 usage: virtualenv [–version] [–with-traceback] [-v | -q] [–discovery {builtin}] [-p py] [–creator {builtin,cpython3-posix,venv}] [–seeder {app-data,pip}] [–no-seed] [–activators comma_separated_list] [–clear] [–system-site-packages] [–symlinks | --copies] [–download | --no-download] [–extra-search-dir d [d …]] [–pip version] [–setuptools version] [–wheel version] [–no-pip] [–no-setuptools] [–no-wheel] [–clear-app-data] [–symlink-app-data] [–prompt prompt] [-h] dest virtualenv: error: unrecognized arguments: --relocatable Build step ‘Execute shell’ marked build as failure

I experience the same issue. I roll back virtualenv version to pip install -U virtualenv==16.7.9 as mentioned by @ianlofs . My question is does latest virtualenv removed relocatable?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pipenv throws and error when installing in docker
I am able to run it outside of docker properly. But docker build fails. docker build --platform=linux/amd64 -t shopwalk/location-api:latest .
Read more >
Elegantly activating a virtualenv in a Dockerfile - Python⇒Speed
It's broken for two different reasons: Every RUN line in the Dockerfile is a different process. Running activate in a separate RUN has...
Read more >
Release and Version History — pipenv 2022.12.20.dev0 ...
Previously creating a new pipenv project would only specify in the Pipfile the major and minor version, i.e. “python_version = 3.7”. Now if...
Read more >
Multi-stage Docker builds for Python apps
What's more, by only including what is absolutely required you can avoid security vulnerabilities in packages that aren't even needed. There are ...
Read more >
Pipenv: promises a lot, delivers very little - Hacker News
Pipenv tries to upgrade all the versions of everything in your lockfile ... My Java app declares its dependencies in a build.sbt file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found