2
votes

I am new to Python and therefore I am struggling to resolve the following problem. I installed pip and I made a user installation of pipenv and then on my project folder I run the command:

pipenv install requests

which gives me an error saying that the pipenv command either wrong or cannot be found.

I added following path on my system environment variables the :

C:\Users\andri\AppData\Roaming\Python\Python37\Scripts

but still it does not work. Does anyone have an idea as to what I should do next in order to fix this? Thanks in advance

UPDATE:

My operating system is Windows.

Here is how I installed pip through cmd


C:\Users\andri>python -m pip install -U pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.5MB/s
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3

C:\Users\andri>pipenv install requests
Der Befehl "pipenv" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

C:\Users\andri>pip --version
pip 19.0.3 from c:\users\andri\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)

C:\Users\andri>pip install --user pipenv
Collecting pipenv
  Downloading https://files.pythonhosted.org/packages/13/b4/3ffa55f77161cff9a5220f162670f7c5eb00df52e00939e203f601b0f579/pipenv-2018.11.26-py3-none-any.whl (5.2MB)
    100% |████████████████████████████████| 5.2MB 2.2MB/s
Requirement already satisfied: setuptools>=36.2.1 in c:\users\andri\appdata\local\programs\python\python37-32\lib\site-packages (from pipenv) (40.6.2)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
  Downloading https://files.pythonhosted.org/packages/e3/d9/d9c56deb483c4d3289a00b12046e41428be64e8236fa210111a1f57cc42d/virtualenv_clone-0.5.1-py2.py3-none-any.whl
Collecting virtualenv (from pipenv)
  Downloading https://files.pythonhosted.org/packages/33/5d/314c760d4204f64e4a968275182b7751bd5c3249094757b39ba987dcfb5a/virtualenv-16.4.3-py2.py3-none-any.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 4.7MB/s
Requirement already satisfied: pip>=9.0.1 in c:\users\andri\appdata\local\programs\python\python37-32\lib\site-packages (from pipenv) (19.0.3)
Collecting certifi (from pipenv)
  Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
    100% |████████████████████████████████| 163kB 837kB/s
Installing collected packages: virtualenv-clone, virtualenv, certifi, pipenv
  The script virtualenv-clone.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script virtualenv.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The scripts pipenv-resolver.exe and pipenv.exe are installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed certifi-2019.3.9 pipenv-2018.11.26 virtualenv-16.4.3 virtualenv-clone-0.5.1
3
Did you install it through? Sudo ? It happens sometimes because it needs to be installed that way so it would be sudo pip install pipenv or if that doesn't work try this one sudo -H pip install -U pipenv . Also do you have virtualenv or another virtual environment the two could be conflicting.smitty_werbenjagermanjensen
hey thanks for the answer! I am using windows, is the sudo command still gonna work here? I get an errorffblord
Please include the exact command(s) you are running, and the exact output, from a "clean state", and environment details where applicable. E.g. any virtualenvs involved? What OS? How did you install pip and pipenv?ivan_pozdeev
One more: where is your Python installation and is it on PATH?ivan_pozdeev
So after you installed pipenv you tried pipenv install requests.... What is the output of the following: pipenv --python 3.7 . Also have you checked the GitHub for pipenv it is linked github.com/pypa/pipenvsmitty_werbenjagermanjensen

3 Answers

3
votes

pip is actually helpfully warning you about this situation right there...

The script virtualenv-clone.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH... The script virtualenv.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH... The scripts pipenv-resolver.exe and pipenv.exe are installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH...

You will need to add that directory

C:\Users\andri\AppData\Roaming\Python\Python37\Scripts

to your PATH environment variable; there are many ways to do it, see e.g. Adding directory to PATH Environment Variable in Windows

Another option is to just always use

C:\...> C:\Users\andri\AppData\Roaming\Python\Python37\Scripts\pipenv install

but I think that might get a little stale quickly.

0
votes
  The script virtualenv.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH

There is your answer. The Scripts directory with utility scripts for packages installed per-user is not on PATH, so your command shell won't find them unless you add it.

If you have just added it to PATH via the Control Panel, see windows - Why are changes to my PATH not being recognised? - Super User

0
votes

I also encounter this same problem, But I quietly not figured out the solution yet. But I realize that It is the problem of the latest version of python. (Python 3.10.5 in my case). Therefore, I downloaded the lower version of python (Python 3.9.9) and it solves the issue.