Problems in fully uninstalling Python 2.7 from Windows 7 - python

some months ago, I installed Python 2.7 on my laptop (my os is Windows 7).
After, I decided to use Python xy 2.7.3 instead of 'pure' Python; so, as suggested, I removed Python 2.7 and tried to install Python xy 2.7.3. However, when I tried to run the .exe file for installation, a warning window appears telling me that Python 2.7 is already installed on my computer. I tried to install a different version of Python xy (2.6) and everything went fine; however, I'd really prefer to use the latest version of Python xy.
Actually, I can't figure out what went wrong whie uninstalling Python 2.7; does someone have any clue?
I can tell you that I followed the 'normal' procedure for programm uninstalltion; control panel -> Programs -> Remove Program
Thanks in advance
Stefano

Run regedit, backup and delete the registry keys:
HKEY_LOCAL_MACHINE\Software\Python\
HKEY_CURRENT_USER\Software\Python
My problem occurred when changing from Canopy to Python(x,y).
So, also delete all folders that are left behind when uninstalling.
https://support.enthought.com/entries/23580651-Uninstalling-Canopy

I also had this issue as well. It was due to third party installs. Even though you have uninstalled python, it leaves all the third party libraries that were installed and I think Python(x,y) just detects the directory.
To fix, uninstall Python 2.7 and then check to see if C:\Python27 still exists. If it does, go ahead and delete and then try installing Python(x,y). That is what worked for me.

I faced this issue: I tried to uninstall the python and fresh install, reason my pip version issue was not getting resolved. So I deleted the python folder, removed python from system path, and when I tried to uninstall from "Uninstall a program" in control panel, it showed "Windows installation package" error window and could not clean uninstall.
Solution what i found was: In the "Uninstall a program" select python and click repair. And then uninstall the python, it worked for me. Hope this helps and save some time.
PS: I am pretty new to python, and any help correcting me would be appreciated.

Maybe to put an answer out there.
Uninstalling anything from windows can have multiple side effects residing completly on your specific machine. As to what is common:
-> Python sets itself in your windows path. Here is how to modify your windows path: http://www.computerhope.com/issues/ch000549.htm
It means that there is a probability that python is gone but the path entry might not be. That is a guess however -> more information needed
-> Are you sure that everything was removed from your computer? If you already did the normal uninstalling process - try to look up if any python directory is still present.
-> Thirdparty installed? Have you downloaded any libs that are still on your machine.
Besides from that - it could be anything - the more information you give us the more we can say about it.
Maybe this post will help you: How to completely remove Python from a Windows machine?

I had python 2.7.12 and wanted to uninstall it for 2.7.9. I had the same problem as you and to fix it I tried to delete all of the local files and then uninstall however it still gave me the same error. So instead I decided to repair the python 2.7.12 and then uninstall which worked perfectly and completely got rid of the error.

I had python 2.7 installed and enthought canopy. I wanted to switch to python(x,y) to access a full version of the OpenCV library. python(x,y) installation complained about python 2.7 already being installed after:
1)Using windows control panel
2)Removing all lingering python files
3)Removing the windows path as suggested above
Not until I removed all registry entries related to python/enthough did python(x,y) install without issue.

I installed Enthought before. When I wanted to install Python(x,y) instead, I met the problems above.
After I had tried to uninstall Enthought and Python(x,y) from the Control Panel and then restart the PC, the problem still occured the next time I installed Python(x,y).
I solved this problem by:
deleting all the relevant files in C:/User/UserName/AppData/ about Python, including the third party softwares like Enthought;
deleting the Path in user and system Environment;
=====the two steps were failed if I didn't do the third step.=====
deleting the register keys as #Daniel said. (include all the relevant keys with the prefix py if you installed the third party software about Python. )
HKEY_LOCAL_MACHINE\Software\Python\
HKEY_CURRENT_USER\Software\Python

Locate that set up file which was used to install Python. Run it and choose repair. If that doesn't solve the problem. Go to c:\Python(x,y) and delete this folder completely by shift+Del.
Run that set up file again and click on "Change" which will ultimately install the Python again. By default in my case option to add path and making that version of Python the default on my system was unchecked which can be figured out by seeing the red cross mark in one of the installation screen. Click on it if you want set up to make it default Python version and also click on the option to indicate you want the path to be added in windows environment variable.
No need to touch registry as previous ones will be overwritten again.
In my case it worked. I was getting error like:
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Besides that un-installation was failing from control panel. So above steps solved all of my problem. Hope it helps.

I Repaired/Modified to install all the components for the Python
version I wanted to uninstall.
Once that was done, I clicked on Uninstall/Change and that uninstalled it for good.

Related

Python import not found after VSCode restart

My Python import could not be found after i changed the directory and restarted VSCode.
I installed the package via cmd (pip install ) and it was found in Vscode.
I restarted VSCode because i changed the file location to a other directory. The package wasnt found since then. I uninstalled the package and installed it via Powershell but it wouldnt work. Updated the pip installer.
Created a new file with in the directory where it has been before and installed the package again.
VSCode doesnt recognize the package anymore.
Import "" could not be Resolved (Pylance(reportMissingImports))
Does anybody know why this behavious appears and how to fix it?
I havent found a proper solution on here or another forum
In the bottom right of your VS code instance, you'll see something like 3.11.0 64-bit, which indicates the version of Python that VS code is referring to when running and linting your code. The problem is you installed the package with a different version of Python. If you click on the aforementioned button (that says 3.11.0 64-bit) you should see a list of options show up for the different Python versions installed. You need to change to the one that you installed the package on.

How do I properly uninstall/fix python 3.8.5 when the installer doesn't work?

After messing up my pip installation (I interrupted an update), I tried reinstalling python, but it didn't fix pip. After trying to uninstall python and re-install it manually, the installer just simply won't work for 3.8.5. After removing all python directories (to my knowledge), it still shows up in control panel, and the installer sees it, but can't uninstall it. All it says is "uninstall successful".
Older versions would not install as they detect an existing installation.
The files I've removed:
%programfiles%\python
%appdata%\python
%userprofile%\local\programs\python
%userprofile%\local\programs\pip
I have also removed python from path, and the registry entry.
For any more information, feel free to comment.
Thanks in advance
I had to remove the registry key from
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
with information from this article. Then I brought up the uninstaller prompt again, which still showed the "Modify, Repair & Uninstall" options from earlier, but I right-clicked the icon on the taskbar (When a program is open) and clicked on properties, finding the path to that executable:
%userprofile%\AppData\Local\Package Cache\{de694e50-e0d0-48a5-9a7a-56fd037154e2}
I deleted that file, and then when I clicked "uninstall" in control panel again, it said if I'd like to remove it from the program list as it couldn't find it.
After that, the installer now can't see Python installed.

Python versions in my PC shows 2.7.17 instead of 3.8.5

Yesterday I've been trying to install Python 3.8.5. I got the installer from the python website. My problem is that whenever I run python --version in the command line, it keeps saying, like in the image above, Python 2.7.17.
Today I also installed the Microsoft store package, and it's the same.
But running py apparently gives me the correct version 3.8.5. Does this mean that every python program I'll write will use the current version? That's what I currently want to make sure of.
As a side note also, I uninstalled all other python versions except 3.8.5 that I saw in my settings>Apps list. So, that adds to my confusion why running python --version would still show 2.7.17.
Maybe not as relevant, but I also have WSL2 enabled on my machine, I would like to install python to both. At the moment I'm focusing on the Windows10 part, but if there's a solution that will help both, that'll be awesome.
Thanks in advance!
[update]: adding python3 --version screenshot
[update]: yet another confusing part for me:
should I just let this be?
Is this something I need to straighten up first before moving forward?
are my python programs going to be ran in version 3.8.5 and not
2.7.17?
I know my answer is very late but i see a lot of people facing this problem. So if you want to interact with the latest Python version in your command prompt, you just need to set newer (or which one you want) Python path variable above/before other Python version's path variables. This solution also helped me a lot with other path problems.
This is a problem with your PATH environment variable being set incorrectly. I'm guessing that you installed Python 3 globally, after you had Python 2.7 installed. Whenever you do this and have the option Add to PATH checked, it will overwrite the default python location to the new install, thus causing Python 3 to now open instead. You can change this back manually by changing the value in PATH.
I'd suggest using something like pipenv to manage your python versions and respective libraries, that will create a sandbox for your application to run in and will always point to the correct dependencies.
Ok, so hopefully this fixes every question I had. Hopefully comments will assure me that is so.
What I did was, delete the environment variables relating to Python 27. Found the Python3.exe path and added that to the path variable. Not exactly sure how that works, but it did give me the outcome I wanted to see.

Don't know how to fix a broken Python installation

I was trying to install a SQL-Python connector and kept receiving an error that it could not find the python installation. It said that it only accepted the version used by the installer from the python website so I downloaded that and tried to install it in the same path where my python was (C:\Python38) but then saw that it was installing a 32-bit version of python there so I cancelled the install mid-install (this was a mistake). I think I did that at the wrong time because now the folder still exists but it had deleted some parts of my python installation. So now I'm in a weird place where I can't install python (When I open the 64-bit installer it only gives me the option to Modify, Repair or Uninstall, and all of those shoot up errors where it says that it can't find the python installation). The 32-bit version does allow me to try and install but I get an error saying "The File 'python.dll' cannot be installed because the file cannot be found in cabinet file 'cab1.cab.'"
If I try and uninstall python from the Windows uninstaller I also get errors that there is no python version to install.
I tried just deleting the folder from my system but that doesn't work either. Not sure how to bring my computer back to a state where I can do a fresh python install. Is there any way?
What I did, and I am not sure that it was the cause of solving the problem, was to delete the 'python.exe' and 'python3.exe' files that where in 'C:\Users\Usuario\AppData\Local\Microsoft\WindowsApps'. As the user don't have access to delete them from the files explorer, I entered from cmd as administrator and deleted them with the 'del' command.
Again I am not sure if that was the cause but I think it worked for me while I was trying to delete all python related files to reinstall.

How can I simulate a path that no longer exists to let python uninstall?

I installed python and then changed the c:/user/(username) of my computer.
After that I am unable to unistall/repair/modify python. I tired to downgrade and upgrade but failed with error windows cannot find the path.
How can I fix this? The version which was installed is 3.7.5 and I want to install the same or the lower versions.
edit: I tried to create a folder same from the error but it did not work. I tried to manually remove the python files too.
Try using the mklink utility.
mlkink C:\Users\vishn C:\Users\<yournewdir>
It's a hack, but it should let your system work through the python repair / modify / etc. problems.
When you're done, remove the "C:\Users\Vishn"; it won't delete the thing it points to, only the shortcut.
Finally did it with help of a third party application called Revo uninstaller.

Categories