Pipenv: Command Not Found

224,560

Solution 1

That happens because you are not installing it globally (system wide). For it to be available in your path you need to install it using sudo, like this:

$ sudo pip install pipenv

Solution 2

This fixed it for me:

sudo -H pip install -U pipenv

Solution 3

If you've done a user installation, you'll need to add the right folder to your PATH variable.

PYTHON_BIN_PATH="$(python3 -m site --user-base)/bin"
PATH="$PATH:$PYTHON_BIN_PATH"

See pipenv's installation instructions

Solution 4

I tried this:

python -m pipenv  # for python2

python3 -m pipenv # for python3

Solution 5

I have same problem with pipenv on Mac OS X 10.13 High Seirra, another Mac works just fine. I use Heroku to deploy my Django servers, some in 2.7 and some in 3.6. So, I need both 2.7 and 3.6. When HomeBrew install Python, it keeps python points to original 2.7, and python3 points to 3.6.

The problem might due to $ pip install pipenv. I checked /usr/local/bin and pipenv isn't there. So, I tried a full uninstall:

$ pip uninstall pipenv

Cannot uninstall requirement pipenv, not installed
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

$ pip3 uninstall pipenv
Skipping pipenv as it is not installed.

Then reinstall and works now:

$ pip3 install pipenv
Collecting pipenv
Share:
224,560

Related videos on Youtube

lgants
Author by

lgants

Updated on April 23, 2022

Comments

  • lgants
    lgants about 2 years

    I'm new to Python development and attempting to use pipenv. I ran the command pip install pipenv, which ran successfully:

    ...
    Successfully built pipenv pathlib shutilwhich pythonz-bd virtualenv-clone
    Installing collected packages: virtualenv, pathlib, shutilwhich, backports.shutil-get-terminal-size, pythonz-bd, virtualenv-clone, pew, first, six, click, pip-tools, certifi, chardet, idna, urllib3, requests, pipenv
    ...
    

    However, when I run the command pipenv install in a fresh root project directory I receive the following message: -bash: pipenv: command not found. I suspect that I might need to modify my .bashrc, but I'm unclear about what to add to the file or if modification is even necessary.

    • phd
      phd over 6 years
      Check /usr/local/bin/pipenv — is it there? Is /usr/local/bin in your $PATH?
    • aDone
      aDone over 6 years
      Same problem here: succesfully built pipenv but no sign of pipenv folder in /usr/local/bin .
    • dethos
      dethos over 6 years
      Are you installing pipenv globally?
    • kojiro
      kojiro about 3 years
      This is a popular question with a lot of highly upvoted answers that recommend the use of sudo; however, sudo is a dangerous command that should not be run without careful consideration. Please do not blindly copy and paste from the answers here.
    • Brijesh
      Brijesh about 2 years
      For Windows, 1. In Gitbash do this and check the location packages. pip list -v and this will give the list of packages and the location the are installed. 2. In command Prompt (cmd) enter PATH and check in output if the c:\users\test\appdata\roaming\python\python36\Scripts or the path mentioned in output of 1st command is there, if not present update the system Env variable. 3. Close the CMD prompt and GIt Bash and check again, PIPENV should work now.
  • michael
    michael over 6 years
    for the copy-and-pasters out there, this command is usually run as sudo -H pip install -U pipenv (eg on ubuntu), installing pipenv in /usr/local/bin. The alternative is a user install, e.g., $ pip install pipenv, which is the same as $ pip install --user pipenv, which installs things in $HOME/.local/..., requiring the PATH to be modified as in the other answer, stackoverflow.com/a/47111756/127971
  • eksortso
    eksortso over 6 years
    This was useful, in that I needed to run pipenv run, and the installation instructions told me so.
  • Andrey Vaganov
    Andrey Vaganov about 6 years
    @Babbz77 The -H (HOME) for sudo option requests that the security policy set the HOME environment variable to the home directory of the target user (root by default) as specified by the password database. The -U for pip install upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade - strategy used.
  • Claudio Santos
    Claudio Santos about 6 years
    You must test python3 -m site to see if the --user-base dir exist!
  • Ozkan Serttas
    Ozkan Serttas about 4 years
    I installed python3 through Homebrew. When ran which python3 the output was /Cellar/python/3.7.7/bin/python3 which I assigned it to my PATH but still ``pipenv` not found`. Any idea?
  • kojiro
    kojiro about 3 years
    Sudo is dangerous and just not needed for this. Folks should really never run sudo pip install anywhere. Most likely you'd want to use your package manager, be it apt, or homebrew, or whatever. For example, brew install pipenv works nicely on macOS. If your package manager doesn't happen to have pipenv in its catalog, then pip install --user is a reasonable alternative.
  • FedericoCapaldo
    FedericoCapaldo over 2 years
    this made it work, many thanks!
  • analyst_47
    analyst_47 over 2 years
    Thank you for this
  • Jason R Stevens CFA
    Jason R Stevens CFA over 2 years
    This is the right way to rock the local installation. Thank you!
  • thenewjames
    thenewjames about 2 years
    brew install pipenv is discouraged by the maintainers
  • Can
    Can about 2 years
    Thanks! This solved it for me on windows!