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.

pipenv install --system cannot find python path

See original GitHub issue

When executing pipenv install --system using pipenv 8.1.2 or older, everything works as normal. When using pipenv version 8.1.3 or newer, pipenv cannot find the path to python.

  1. Environment: I run this inside a docker container: tensorflow:1.3.0-gpu-py3 using nvidia-docker
  2. Python version: 3.5.2
  3. Python location: /usr/bin/python
  4. Pipenv version: 8.1.3 or newer
Expected result

No thrown exception

Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock!
Installing dependencies from Pipfile.lock…
Actual result

The following exception is thrown:

Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Error [Errno 2] No such file or directory: '/bin/python' while executing command python egg_info
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/", line 1738, in install
    do_init(dev=dev, allow_global=system, ignore_pipfile=ignore_pipfile, system=system, skip_lock=skip_lock, verbose=verbose, concurrent=concurrent, deploy=deploy)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/", line 1250, in do_init
  File "/usr/local/lib/python3.5/dist-packages/pipenv/", line 1069, in do_lock
  File "/usr/local/lib/python3.5/dist-packages/pipenv/", line 425, in resolve_deps
  File "/usr/local/lib/python3.5/dist-packages/piptools/", line 101, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/usr/local/lib/python3.5/dist-packages/piptools/", line 198, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "/usr/local/lib/python3.5/dist-packages/piptools/", line 284, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/usr/local/lib/python3.5/dist-packages/piptools/repositories/", line 170, in get_dependencies
    self._dependencies_cache[ireq] = reqset._prepare_file(self.finder, ireq)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/pip/req/", line 634, in _prepare_file
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/pip/req/", line 129, in prep_for_dist
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/pip/req/", line 447, in run_egg_info
    command_desc='python egg_info')
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/pip/utils/", line 667, in call_subprocess
    cwd=cwd, env=env)
  File "/usr/lib/python3.5/", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/bin/python'
Steps to replicate

pip install pipenv==8.1.3 pipenv install --system

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

Jitsusamacommented, Mar 22, 2018

Ok, I’ve done some investigating, and I’ve been able to make it work in a way that’s not too hacky. As an aside, my main reason for doing this is because pipenv doesn’t work on my Windows PC due to a corporate firewall that thinks it’s a virus 😛

Here are my steps for reproducing the issue:

# docker run --rm -it --entrypoint /bin/bash python:3.6-slim
root@adbc1b6c3752:/# mkdir app && cd app
root@adbc1b6c3752:/app# echo '[[source]]
> url = ""
> verify_ssl = true
> name = "pypi"
> [packages]
> requests = "*"
> [requires]
> python_version = "3.6"' > Pipfile
root@adbc1b6c3752:/app# pip install -q --upgrade pipenv
root@adbc1b6c3752:/app# pipenv install --system
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
/python: not found

I tried to track down what was giving this error and had no luck, then I discovered that there is a verbose option to pipenv install. I used that and had the following results:

root@adbc1b6c3752:/app# pipenv install -v --system
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…

/bin/sh: 1: /bin/python: not found

I tried to figure out which script referenced /bin/python, but to no avail. So I thought, well, I can fix this easy enough:

root@adbc1b6c3752:/app# ln -sf $(which python) /bin/python
root@adbc1b6c3752:/app# pipenv install --system
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (7b8df8)!
Installing dependencies from Pipfile.lock (7b8df8)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 5/5 —

When adding the symbolic link function into my Dockerfile, I’m able to do this all dynamically. I understand from @kennethreitz that this goes against the very principle of pipenv, mainly being that when you deploy your application, you have the versions already pinned. I agree with him. In my case, I’m simply using this method to generate my Pipfile.lock since I can’t generate it on my development workstation.

If you are interested though, here is what the Dockerfile could look like:

FROM python:3.6-slim

COPY Pipfile ./
RUN set -x \
 && ln -sf /usr/local/bin/python /bin/python \
 && pip install --upgrade pipenv==11.9.0 \
 && pipenv install --system
Groniscommented, Nov 17, 2017

Hi @erinxocon , the reason it works for you, is because you are missing the slash before notebooks, and pipenv does not find the Pipfile (since it is not in working directory). For your Dockerfile, it does not crash, but the result is a docker container without any dependencies from the Pipfile.

This Dockerfile does not work: (e.g with /notebooks rather than notebooks)

FROM tensorflow/tensorflow:1.3.0-gpu-py3

    LANG=C.UTF-8 \

RUN set -ex && pip install pipenv --upgrade

COPY Pipfile /notebooks/Pipfile
RUN set -ex && pipenv install --system

I have also tested this Dockerfile with pipenv version 8.3.2 and the bug still persist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv doesn't find correct python version on $PATH without ...
When multiple versions of python 3 are installed on $PATH and pyenv is not available, then pipenv will only look at /usr/bin/python3 and...
Read more >
Why can't Pipenv find the correct version of python for my venv?
I am having a similar workflow when it comes to installing Python (using both Pyenv and Pipenv). This is working for me: Install...
Read more >
Configure a Pipenv environment | IntelliJ IDEA Documentation
Install Pipenv  · Run the following command to find the user base's binary directory: $ python -m site --user-base · Add bin...
Read more >
pipenv · PyPI
Commands. Locate the Project. Locate the virtualenv. Locate the Python Interpreter. Install Packages. Installing from git. Install a dev dependency.
Read more >
Using Python environments in VS Code
Using Python environments in VS Code. This article discusses the helpful Python environments features available in Visual Studio Code. An "environment" in ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found