Python pip failing to operate after first install - python

I have installed Python 3.11 with pip. I install a module (I have been using pyperclip) and then continue to use it without problems. I go back to command prompt line and suddenly pip is not a recognized internal or external source. The file location is the same, both are on the PATH environment variable, nothing has changed. The only evidence that it ever existed is the python -m ensurepip command which returns pip satisfies requirements. I am at my wits' end, two days straight of tackling this issue. I just want a working pip.
I have checked the variable paths, wiped all Python downloads from every corner of my PC, un- and re-installed until the cows come home, been through every checklist and every forum, and nothing has worked.

Related

Weird Python Log Error while trying to reinstall Python on Windows 11

I installed Python on Windows 11 normally after getting the setup from python.org but, by mistake, I deleted the partition Python was installed in (it was E drive). So now, when I rerun the setup, it shows that Python is already installed.
I forced uninstall the old Python and removed all the registery keys with the help of Revo Uninstaller, but now, when I try to install Python again, it isn't installed to the specified folder and when I try to Uninstall the same via setup (after installing), this is the error I come across: https://paste.pythondiscord.com/tekopijiju
So now I want to know if there's a way to force install that Python version?
This issue has been fixed.
The Fix: I reproduced the path (The E drive) I had deleted and added the same Python folder to it and then clicked the Repair button. It automatically installed Python back to that folder and then I was able to normally uninstall it and install at another location!

Pip upgrading arcgis completely broke pip

Overview: While running Python 3.6, after upgrading my arcgis package, scripts no longer recognizes many packages and pip itself completely broke, making it impossible to upgrade or uninstall any packages.
Background Info: Fairly recently, when I run a particular program of mine, I have been seeing a deprecation message connected to the arcgis package. So, I upgraded the arcgis package to see if it fixed it. It seemed to install correctly but then when trying to run my program, I'd get errors for other packages, like folium or requests. I then tried upgrading Python and initially, it worked. I used pip to install pandas and requests but right after I installed arcgis, everything broke again. So then when trying to uninstall arcgis (or do anything else pip related) I get this error:
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\Users\myuserpath\AppData\Local\.certifi'
I've uninstalled Python but it doesn't change anything. pip install any package results in this error. I tried reverting back to Python 3.6 but the installer wasn't available from the python site, only 3.9.
What could have been changed or affected by this arcgis installation?
There seems to be two primary issues you're dealing with. The first is as #BoarGules mentioned, that arcgis does a 'full' install with all its dependencies and that could be causing problems. Secondly, the newest requests library seems to have some issues as well, at least from what I've experienced. So let's get started fixing all this.
There's probably a few different ways to fix this, so this is just one of the many. First, uninstall python and delete the python folder from your AppData folder - in your case, it would be the Python 3.9 folder. Re-install Python and check your site-packages folder making sure it only contains the default Python packages. Open up a command prompt and do a pip install of something basic, like pandas. If that goes well, then the first hurdle is over.
When it comes time to install arcgis again, you'll want to use this instead
pip install arcgis --no-deps
this will prevent the doubling up of any of the packages or whatever seems to be happening. You will need to then also install these:
pip install ujson
pip install requests_ntlm
Next, when you come to installing requests, use an older library, like this one:
pip install requests==2.20.0
That should get things back up and running.

Disappearing pip as part of Python 3.8 installation

Have reviewed the highly popular thread below, but cannot seem to find a resolution.
'pip' is not recognized as an internal or external command
I was having issues with the below issue, when trying to use CMD to pip install anything:
'pip' is not recognized as an internal or external command
Eventually was convinced it was my Python installation which may have been all over the place, so took the decision to completely remove and install fresh. Upon doing this, I managed to then successfully install something via 'pip install ', which in this case was pyinstaller.
However, having since turned off/on my PC, I now have the same issue again? When I go into my Python directory, there is no pip files/folder in :
C:\Users\Jon_D\AppData\Local\Programs\Python\Python38-32\Scripts
C:\Users\Jon_D\AppData\Local\Programs\Python\Python38-32\libs
C:\Users\Jon_D\AppData\Local\Programs\Python\Python38-32\Lib
In fact, there is now a pip folder within the higher Programs directory:
C:\Users\Jon_D\AppData\Local\pip
Not sure what has caused this given it was a completely fresh install, which included adding a PATH entry.
I hope this will help you
python get-pip.py
If python doesn't recognise you can you py instead of python

Installing modules reliably in one location

I've been working with Python for a little while now but have come to absolutely detest installing new modules. It always seems to take me a full work day to install one additional module. This last happened with mpl_toolkits and now it is happening with gdal.
The main issue seems to be that easy_install/pip/get-app aren't saving a file in the correct location and so Python (I'm using Spyder) can't find it. How do I install a module in a location so that Python can find it?
I have been reading guides, articles, manuals and Stack Overflow articles all day now and I feel this needs a new question as I can't find an answer.
It is installing fine, it's just Python (and I) can't find it
It's not in the /lib/python2.7/site-packages folder, which seems to be the Python default, although half the modules that do work aren't in there when I list it
I installed using:
sudo apt-get install gdal-bin
I also tried with:
pip install gdal
but this fails with the error:
Command "python setup.py egg_info" failed with the error code 1 in /tmp/pip-build-NWJT2f/gdal/
I looked for the files using
dpkg -L gdal
and then added the file path this said into Spyder's preferences option for PYTHONPATH, but it still couldn't find it and so I'm guessing this is wrong.
I have read the official documentation of PYTHONPATH, but it's very short and doesn't really explain it at all.
I recommend trying anaconda or miniconda, which manage environments and install packages - it 'just works'.
https://www.continuum.io/downloads

Why does my python installation recognize /Library/Python/2.7/site-packages/?

I have installed Python using Homebrew. I would like for this installation of python to recognize only one site-pakages directory -- /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
However, when I start the python shell and give the command print [f for f in sys.path if f.endswith('packages')] I get the following output:
['/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
Why is /Library/Python/2.7/site-packages sitting at the end there? Shouldn't the Homebrew installation of Python have just one main site-packages directory under /usr/local/ ???
Edit: I am using virtualenv -- but this is occurring after a fresh install of python using homebrew before I have even had a chance to install virtualenv. Also, I'm interested in why it is happening, not on what I should do to get around it.
Created a stack overflow account just for this, since I was so annoyed by it. I actually had a bug inadvertently caused by that extra "/Library/Python/2.7/site-packages" in the sys.path
Researching it led me to this:
http://bugs.python.org/issue4865
tl;dr: From what I can tell, they throw that path in there to help people that installed packages for the apple-shipped python, but then later would try to use those packages in other versions of python (like the ones used by homebrew, macports, etc).

Categories

Resources