FileNotFoundError: [Errno 2] when installing pipenv from pipfile
See original GitHub issueHi all,
I am experiencing some issues while building my docker file on the last shown step (1):
COPY Pipfile* ./
RUN pip3 install pipenv
(1) RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy --clear --keep-outdated.
I get the following Stacktrace:
> [builder-image 5/5] RUN pipenv install --deploy --clear --keep-outdated:
#10 1.527 Creating a virtualenv for this project...
#10 1.527 Pipfile: /Pipfile
#10 1.543 Using /usr/bin/python3 (3.10.4) to create virtualenv...
⠼ Creating virtual environment...created virtual environment CPython3.10.4.final.0-64 in 491ms
#10 2.680 creator CPython3Posix(dest=/.venv, clear=False, no_vcs_ignore=False, global=False)
#10 2.680 seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
#10 2.680 added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
#10 2.680 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
#10 2.680
#10 2.758✔ Successfully created virtual environment!
#10 2.760 Traceback (most recent call last):
#10 2.760 File "/usr/local/bin/pipenv", line 8, in <module>
#10 2.760 sys.exit(cli())
#10 2.760 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1128, in __call__
#10 2.761 return self.main(*args, **kwargs)
#10 2.761 File "/usr/local/lib/python3.10/dist-packages/pipenv/cli/options.py", line 56, in main
#10 2.761 return super().main(*args, **kwargs, windows_expand_args=False)
#10 2.761 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1053, in main
#10 2.761 rv = self.invoke(ctx)
#10 2.761 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1659, in invoke
#10 2.762 return _process_result(sub_ctx.command.invoke(sub_ctx))
#10 2.764 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1395, in invoke
#10 2.765 return ctx.invoke(self.callback, **ctx.params)
#10 2.765 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
#10 2.765 return __callback(*args, **kwargs)
#10 2.766 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
#10 2.766 return ctx.invoke(f, obj, *args, **kwargs)
#10 2.766 File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
#10 2.767 return __callback(*args, **kwargs)
#10 2.767 File "/usr/local/lib/python3.10/dist-packages/pipenv/cli/command.py", line 222, in install
#10 2.767 do_install(
#10 2.767 File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 1964, in do_install
#10 2.768 ensure_project(
#10 2.768 File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 552, in ensure_project
#10 2.770 ensure_virtualenv(
#10 2.770 File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 485, in ensure_virtualenv
#10 2.770 do_create_virtualenv(
#10 2.770 File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 1012, in do_create_virtualenv
#10 2.771 project._environment = Environment(
#10 2.772 File "/usr/local/lib/python3.10/dist-packages/pipenv/environment.py", line 70, in __init__
#10 2.772 self._base_paths = self.get_paths()
#10 2.773 File "/usr/local/lib/python3.10/dist-packages/pipenv/environment.py", line 394, in get_paths
#10 2.774 c = subprocess_run(command)
#10 2.774 File "/usr/local/lib/python3.10/dist-packages/pipenv/utils/processes.py", line 75, in subprocess_run
#10 2.774 return subprocess.run(
#10 2.775 File "/usr/lib/python3.10/subprocess.py", line 501, in run
#10 2.775 with Popen(*popenargs, **kwargs) as process:
#10 2.775 File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
#10 2.776 self._execute_child(args, executable, preexec_fn, close_fds,
#10 2.778 File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
#10 2.778 raise child_exception_type(errno_num, err_msg, err_filename)
#10 2.778 FileNotFoundError: [Errno 2] No such file or directory: '/.venv/bin/python'
------
executor failed running [/bin/sh -c pipenv install --deploy --clear --keep-outdated]: exit code: 1
The solution I found is:
COPY Pipfile* ./
RUN pip3 install pipenv==v2022.4.20
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy --clear --keep-outdated
The build image is ubuntu:22.04, python-version 3.10.4
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:64
Top Results From Across the Web
FileNotFoundError: [Errno 2] using Pipenv - Stack Overflow
I'm trying to install dependencies in django using pipenv install . Then it responded error message like this in Ubuntu 22.04 LTS.
Read more >Pipenv shell start error: FileNotFoundError: [Errno 2] No such ...
Hi all,. i'm trying to use pipenv, installing works, now I wanted to start the shell with pipenv shell and I got the...
Read more >Frequently Encountered Pipenv Problems - Read the Docs
This is usually a result of mixing Pipenv with system packages. We strongly recommend installing Pipenv in an isolated environment. Uninstall all existing ......
Read more >Common Pipenv Errors and How to Solve Them: Why Won't it ...
Pipfile won't lock when it tries to install packages that don't exist, i.e., typos. Pipenv looks for the package you specify, whether it...
Read more >pipenv Documentation - Read the Docs
The recommended way to install pipenv on most platforms is to install from pypi ... 3.1.2 Installing Pipenv ... FileNotFoundError: [Errno 2] issue...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The (excellent!) bug report at https://github.com/pypa/setuptools/issues/3278 identifies the cause more precisely.
There are two better workarounds identified there:
SETUPTOOLS_USE_DISTUTILS=stdlib
when running pipenv.sed -i.bak -e "s/var, 'local'/var, 'stdlib'/" ~/.local/lib/python3.10/site-packages/distutils-precedence.pth
@andrewdotn I had to export in order for it to work: