Windows reports error when trying to install package using pipenv

Robert picture Robert · Sep 4, 2017 · Viewed 32k times · Source

I installed pipenv by following the instructions here. From the Windows command prompt I ran

pip install --user pipenv

which returned the message

Successfully installed pipenv-5.3.3

Now I want to install the requests package using pipenv, so I ran

pipenv install requests

but this returned

'pipenv' is not recognized as an internal or external command,
operable program or batch file.

I have added the path

C:\Users\Robert\AppData\Roaming\Python\Python35\site-packages

to my Windows path environment variable, but I still receive the same error. How can I install the requests package using pipenv?


EDIT: As I have remnants of Python 3.5 and Python 3.6 on my system, I'm going to uninstall everything and start anew. (I've just started learning Python and I want to keep this as simple as possible.)

Answer

Srivats Shankar picture Srivats Shankar · Dec 6, 2017

I have a similar setup and faced a similar problem, but the solution I found was fairly simple. All of my PATH variables were already correct (from Python 3 the Windows Installer automatically does all of this).

The problem

The problem actually arises because of conflicting installations of virtualenv.

Fix

To address this problem you need to simply run the following commands:

  1. First, remove your current version of virtualenv: pip uninstall virtualenv

  2. Then, remove your current version of pipenv: pip uninstall pipenv

  3. When you are asked Proceed (y/n)? just enter y. This will give you a clean slate.

  4. Finally, you can once again install pipenv and its dependencies: pip install pipenv

This will also install the latest version of virtualenv.

Testing if it worked

Just enter pipenv --version in the command prompt and you should see the desired output.

Notes

I know this sounds the mundane, but it is actually the solution for Windows systems. You do not need to modify any of your system environment variables (please do not add site-packages to your environment variables).

Hope this helps!