Python Pip Install Error on Windows - python

I'm trying to install the Speech Recognition Module here. When I go to the cmd and use pip install, it shows an error. The picture below shows the error
Error Image

Access denied means you don't have permissions to install there. Try pip install XXX --user

Related

'-m' is not recognized as an internal or external command... while updating pip version using -m pip install --upgrade pip

I was trying to install a python library using pip install.
My python version: 3.10.4
So, I got this message: "WARNING: You are using pip version 22.0.4; however, version 22.1.1 is available.
You should consider upgrading via the 'C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command."
Now, following the usual procedure(from multiple Youtube videos) used the command "--upgrade pip" in both command prompt and Powershell in the correct directories
Got the following errors: '-m' is not recognized as an internal or external command,
operable program or batch file. (in command prompt)
Can someone please help with this. Thanks!
Your error message already suggests to you that you should use python -m pip install --upgrade pip,This command to update pip in your environment.
To install the library, you can use a command like python -m pip install django.
For more pip commands, you can refer to this link.
Hope this helps you.

How do I fix pip install error even when trying to install from local archive?

I'm getting an SSL error when trying to use pip install openpyxl. This is a work PC and we go through proxy. I have also installed other packages using this method py -m pip install C:\Users\Lamar\Downloads\ <package file name> with a local tar.gz file which worked fine but when trying to use py -m pip install C:\Users\Lamar\Downloads\openpyxl-3.0.7.tar.gz I get the same error even though as if I am using (pip install openpyxl). Before attempting this openpyxl I just installed py -m pip install C:\Users\Lamar\Downloads\xlrd-2.0.1.tar.gz with no problems, could someone explain to me how this is possible and how to correct it. I also have tried the "trusted host" approach but that gives a "Cannot connect to proxy" error.

How to install Python dependency properly? (maybe without sudo?)

I'm trying to run some code with python. It is using tweepy library. Then, I got this error:
Traceback (most recent call last):
File "script.py", line 1, in <module>
import tweepy
ImportError: No module named 'tweepy'
So, I tried to install dependency:
pip install tweepy
And it get permission denied:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/sockshandler.py'
Consider using the `--user` option or check the permissions.
Next thing to do is to run using sudo. I had a bad experience by using sudo for docker, because it creates protected files all over my local. But I finally tried it anyway sudo pip install tweepy
It returns success, but I still get the same error when I tried to run python3 myscript.py
But, I see some warning to upgrade the pip, so I think maybe that's it. I tried to upgrade pip using both pip install --upgrade pip and sudo pip install --upgrade pip
Still not working.. I tried one last trick up my sleeve. Change the terminal. I think, "maybe after installing, some environment variable not running on this terminal"
Nope. Not working. I admit it should be a newbie question. Having tried some solution on the web, but still not working. Thanks.
If you use python3, you should be using pip3, pip is most likely the python2 pip.
However, better is using python3 -m pip install tweepy that ensures you use the pip for your specific python version.
You can also install it as a user without sudo for just your local account:
python3 -m pip install --user tweepy
Look at the error message:
... Permission denied: '/usr/local/lib/python2.7 ....
You installed tweepy in your python2 Installation.
Use pip3 install tweepy instead. Maybe with sudo when you get the error with permission denied again. After that you can go with
python3 myscript.py
Use the --user flag, like so...
pip|pip3 install <PACKAGE> --user
This will install it in a location available and writeable to your user
See https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
You seems to have 2 python installations on the machine. Python 3.x and Python 2.7.
When you run the pip command , the alias points to pip2 which installs packages for Python 2.7 - which is clear in your error message
Permission denied: '/usr/local/lib/python2.7/dist-packages/sockshandler.py'
So if you want to install packages for python 3, then use the command pip3 instead of pip.
Like sudo pip3 install tweepy
If you want the pip to work as pip3 you can consider adding an alias with alias pip=pip3
You have to make sure the pip is pointing to right python version.

How to fix error when downloading pyPDF2 on Python 3.6.0?

I am trying to install the pyPDF2 package on Python 3.6.0. When I open the Command Prompt and type python -m pip install pyPDF2 I receive the following error:
Successfully built pyPDF2
Installing collected packages: pyPDF2
ERROR: Could not install packages due to an EnvironmentError:
[WinError 5] Access is denied: 'C:\Program
Files\Python36\Lib\site-packages\PyPDF2' Consider using the
--user option or check the permissions.
Previously, I experienced a similar issue with installing the pip library. I had to receive administrative rights from another user before successfully downloading pip.
I am using Windows 10 OS.
There are a number of options:
Install packages in your user directory using pip --user (answer of PoorProgrammer)
This is also the solution provided in the error message itself, and should always work.
Run the python/pip as administrator (answer of Sıddık Açıl)
This is only useful if you have administrative rights.
Install Python in a non-protected directory (e.g. C:\Python\3.6) instead of in C:\Program Files.
This should work as long as you're allowed to install software on the computer. Once installed, you can install additional packages without administrative rights.
Install packages in a virtual environment.
This also works without administrative rights, but you need to install virtualenv once first (e.g. using python -m pip install --users virtualenv).
To create a virtual environment for Python 3.6 and install the package in it:
py -3.6 -m virtualenv --python=3.6 my_virtual_environent
my_virtual_environent\Scripts\activate
python -m pip install pyPDF2
You can install it locally on your user as well. I assume that you don't want to have to go and get your cmd elevated every time so the following should work:
python -m pip install --user pyPDF2
If you want to see the location, it should be at %APPDATA%\Python since you are using windows.
Open cmd as an administrator to get elevated access and run your Python pip install script again.

Unable to install visvis using pip in python

I successfully added pip to python on my ubuntu. However when I try to install visvis using pip:
pip install visvis
I get the following error:
error: could not create '/usr/local/lib/python2.7/dist-packages/visvis': Permission denied
How do I solve this? Btw, I am downloading visvis to easily plot hundreds of spheres. Any suggestions on what else I could use?
Run the command as superuser to install the package system-wide.
For example, use sudo:
sudo pip install visvis
Better if you use virtualenv for your packages: http://www.virtualenv.org/en/latest/

Categories