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
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.
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
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.
Related
This question already has answers here:
How do I install pip on Windows?
(40 answers)
'pip' is not recognized as an internal or external command
(39 answers)
Closed 1 year ago.
Disclaimer: in my first semester learning python and every answer I've found for this either hasn't worked or is way over my head. My Teachers Aid runs MacOS and I'm on Windows so he claims hasn't been able to help.
I'm trying to install the packages 'requests' and 'beautifulsoup' for a homework assignment. I installed pip, then requests, (through cmd prompt) and the cmd prompt says successfully installed but VSCode gives me "ModuleNotFoundError: No module named 'requests'".
I uninstalled requests then tried to reinstall and I get "Requirement already satisfied".
Then I tried to follow this YouTube video (It's short) "https://www.youtube.com/watch?v=paRXeLurjE4" And after step 3, to update pip and install packages I get the following:
"
C:\Users\honeycuttsierra\AppData\Local\Programs\Python\Python39>python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\honeycuttsierra\appdata\local\programs\python\python39\lib\site-packages (21.1.3)
Collecting pip
Using cached pip-21.2.4-py3-none-any.whl (1.6 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.1.3
Uninstalling pip-21.1.3:
Successfully uninstalled pip-21.1.3
WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'C:\Users\honeycuttsierra\AppData\Local\Programs\Python\Python39\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 pip-21.2.4"
So how do I add pip.exe, pip3.9.exe and pip3.exe to PATH permanently? Will this fix my issue?
I am completely overwhelmed with installing Python3 and Pip.
After running brew install Python3 it seems like Python3 was successfully installed.
Now I tried to run Scrapy again but this error occurs:
-bash: /usr/local/bin/scrapy: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
I guess because the Python version changed?
So I tried to uninstall Scrapy which needs pip.
Here comes the next issue - after installing pip like explained here (https://pip.pypa.io/en/stable/installing/#install-pip) I see this error:
Clms:~ userName$ python3 -m pip install -U --force-reinstall pip
Collecting pip
Using cached pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.0.2
Uninstalling pip-20.0.2:
Successfully uninstalled pip-20.0.2
WARNING: The scripts pip, pip3 and pip3.7 are installed in '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin' 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 pip-20.0.2
I truly have no idea how to fix that mess.
Googled for hours, tried a lot but could not figure out to resolve this situation.
Most explanations I encounter require more knowledge about this topic and one leads to the other.
I would be highly grateful for a rescue!
Thanks!
First, you're running the program with python 2.7 not with python 3.x
To run the python on python 3.x use
python3 program.py
Second, regarding the warning. It means the path of the pip is not added to the environment variable PATH. Means you can't call pip from any location, you need to go to its root path to call pip.
Run the below command to update the environment variable PATH to include the root path of pip.
export PATH=/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin:$PATH
This change is temporary. Depends on your OS, different process you need to follow to permanently update environment variable PATH
Long story short, there was a script (written in python) that was written to automatically install a number of python libraries. I ran it with
sudo python python_script.py
And I got the warning
The directory '/home/dir/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
However when I checked the directories they are all owned by me. And when I do pip freeze I see nothing after running the installation script. So I ended up deciding to install the packages manually one by one.
When I do pip3 install boto3==0.0.21
I got an error:
ERROR: botocore 1.0.0b3 has requirement jmespath==0.7.1, but you'll have jmespath 0.9.4 which is incompatible.
when I do a pip freeze I get
alabaster==0.7.12
Babel==2.7.0
bcdoc==0.16.0
boto3==0.0.21
botocore==1.0.0b3
Django==1.8.2
docutils==0.15.2
futures==2.2.0
Jinja2==2.10.3
jmespath==0.9.4
MarkupSafe==1.1.1
psycopg2==2.7
Pygments==2.4.2
python-dateutil==2.8.0
pytz==2019.3
six==1.12.0
snowballstemmer==2.0.0
Sphinx==1.3.1
sphinx-rtd-theme==0.1.9
sphinxcontrib-httpdomain==1.3.1
How can I fix this error? Is there a way for me to change the jmespath from 0.9.4 to 0.7.1 to fix the installation?
First, I don't think you should use sudo, unless you want to install under root. Try python python_script.py.
Secondly, try to uninstall the wrong version first, then reinstall the correct one.
Try
pip uninstall jmespath
pip uninstall jmespath
Do uninstall twice!
Then
pip install jmespath==0.7.1
Hope this helps
I have already installed pipenv using,
pip install pipenv on the directory which was installed successfully. But
pipenv install Django==2.1 does not seem to work. In fact, no command is getting executed using pipenv.
pip install 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 5.5MB/s
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/dist-packages (from pipenv) (40.9.0)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/ba/f8/50c2b7dbc99e05fce5e5b9d9a31f37c988c99acd4e8dedd720b7b8d4011d/virtualenv_clone-0.5.3-py2.py3-none-any.whl
Requirement already satisfied: certifi in /usr/local/lib/python3.6/dist-packages (from pipenv) (2019.3.9)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.6/dist-packages (from pipenv) (19.0.3)
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 17.1MB/s
Installing collected packages: virtualenv-clone, virtualenv, pipenv
Successfully installed pipenv-2018.11.26 virtualenv-16.4.3 virtualenv-clone-0.5.3
pipenv install Django==2.1
File "", line 1
pipenv install Django==2.1
^
SyntaxError: invalid syntax
*
Anything on Google Colab suggestions would be very helpful!
*
pip is a shell command. I assume Google Colab has made pip available as a special command(*) (without the % syntax), but that doesn't mean any other shell command works as such. That is why you get a SyntaxError: it is not recognised as normal Python syntax.
You can work around it by using !pipenv install 'Django==2.1' (the single quotes may not be necessary, but the exclamation work is).
I doubt, however, that you really need a virtual environment in the first place. This is not on your regular machine, where you may want to keep dependencies apart. Instead, just start a new notebook for a new project, and install Django as normal: pip install Django. I wouldn't bother with pipenv and virtual environments inside notebooks. There doesn't seem to be any use for it.
(*) Try, for example, pip?, and note the help lists its usage with the %pip syntax. I assume that, if it's not ambiguous, Colab will use %pip when called as pip. The same works for, for example, ls instead of %ls.
I've never downloaded with pip before so I might be doing something dumb, but I've looked at tutorials.
I'm installing with pip in cmd, using the path to python34/Scripts (which is where pip is).
I'm getting the console output:
C:/Python34/Scripts>pip install pyinstaller
Downloading/unpacking pyinstaller
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement
pyinstaller
Cleaning up...
No distributions at all found for pyinstaller
Storing debug log for failure [...]
I tried using pip3:
C:\Python34\Scripts>pip3 install pyinstaller
Collecting pyinstaller
Using cached PyInstaller-3.3.1.tar.gz
Requirement already satisfied: setuptools in
c:\python34\lib\site-packages (from pyinstaller)
Collecting pefile>=2017.8.1 (from pyinstaller)
Using cached pefile-2017.11.5.tar.gz
Collecting macholib>=1.8 (from pyinstaller)
Using cached macholib-1.9-py2.py3-none-any.whl
Collecting future (from pyinstaller)
Using cached future-0.16.0.tar.gz
Collecting pypiwin32 (from pyinstaller)
Using cached pypiwin32-223-py3-none-any.whl
Collecting altgraph>=0.15 (from macholib>=1.8->pyinstaller)
Using cached altgraph-0.15-py2.py3-none-any.whl
Collecting pywin32>=223 (from pypiwin32->pyinstaller)
Could not find a version that satisfies the requirement
pywin32>=223 (from pypiwin32->pyinstaller) (from versions: )
No matching distribution found for pywin32>=223 (from
pypiwin32->pyinstaller)
Could not find a version that satisfies the requirement pywin32>=223
Is this because python 3.4 is not supported, maybe? I'll try downloading 3.6
I tried downloading 3.6, for some reason it ended up at C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6
and I cannot find pip anywhere near. Can i just drag the pip from 3.4 to 3.6?
Tried dragging it over, then running pip3 install pyinstaller from the directory C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6. Got the same error as with pip3 in the 3.4 directory.
At this point I'm at a loss. I'm sure I'm doing something wrong, but I can't figure out what. Any help would be greatly appreciated!
When you have multiple Python installations (except for the simple case of one 2.7 and one 3.x), and you don’t want to use virtual environments, the simplest solution is to not try to run scripts like pip and 2to3 directly, but instead run them via -m. That way, you only have to know how to run Python itself for each installation, and you automatically know how to run everything else. For example, if you run Python 3.6 like this:
python36
… then you run the copy of pip that comes with Python 3.6 like this:
python36 -m pip
That way you’re guaranteed that it’s running the copy of pip that you want, using the version of Python that you want, so everything gets installed into the site packages for that version of Python.
On Windows, the recommended way of dealing with multiple Python installations is the py launcher. When you installed 3.6, it should have installed the launcher if not present, and configured it to default to 3.6. So, you can run Python 3.6 like this:
py
You should verify that this actually runs Python 3.6. But, assuming it does, you can run its pip like this:
py -m pip
However, are you sure you even want to manage multiple Python installations? It’s unlikely that you have code that works in 3.4 but not 3.6. (If you’d installed a bunch of packages for 3.4 you’d need to freeze a requirements file and install it for 3.6, but since you’ve never used pip before, that’s not an issue.) So if you just uninstall 3.4, all of this confusion won’t even come up.
Although you still may want py -m pip. This way, you don’t have to add stuff to your PATH or cd into specific directories; py should just be always available.
Also, if you do want multiple Python installations, are you sure you don’t want to use virtual environments? That way, whichever environment you currently have activated, python, pip, etc. all come from that environment.
I would recommend installing wheels directly from this site, which hosts precompiled wheels for windows, including pyinstaller:
https://www.lfd.uci.edu/~gohlke/pythonlibs/