I have recently get hold of a RackSpace Ubuntu server and it has pythons all over the place:
iPython in 3.5, Pandas in 3.4 &2.7, modules I need like pyodbc etc. are only in 2,7
Therefore, I am keen to clean up the box and, as a 2.7 users, keep everything in 2.7.
So the key question is, is there a way to remove both 3.4 and 3.5 efficiently at the same time while keeping Python 2.7?
Removing Python 3 was the worst thing I did since I recently moved to the world of Linux. It removed Firefox, my launcher and, as I read while trying to fix my problem, it may also remove your desktop and terminal! Finally fixed after a long daytime nightmare. Just don't remove Python 3. Keep it there!
If that happens to you, here is the fix:
https://askubuntu.com/q/384033/402539
https://askubuntu.com/q/810854/402539
EDIT: As pointed out in recent comments, this solution may BREAK your system.
You most likely don't want to remove python3.
Please refer to the other answers for possible solutions.
Outdated answer (not recommended)
sudo apt-get remove 'python3.*'
So I worked out at the end that you cannot uninstall 3.4 as it is default on Ubuntu.
All I did was simply remove Jupyter and then alias python=python2.7 and install all packages on Python 2.7 again.
Arguably, I can install virtualenv but me and my colleagues are only using 2.7. I am just going to be lazy in this case :)
First of all, don't try the following command as suggested by Germain above.
`sudo apt-get remove 'python3.*'`
In Ubuntu, many software depends upon Python3 so if you will execute this command it will remove all of them as it happened with me. I found following answer useful to recover it.
https://askubuntu.com/questions/810854/i-deleted-package-python3-on-ubuntu-and-i-have-lost-dashboard-terminal-and-un
If you want to use different python versions for different projects then create virtual environments it will be very useful. refer to the following link to create virtual environments.
Creating Virtual Environment also helps in using Tensorflow and Keras in Jupyter Notebook.
https://linoxide.com/linux-how-to/setup-python-virtual-environment-ubuntu/
neither try any above ways nor sudo apt autoremove python3 because it will remove all gnome based applications from your system including gnome-terminal. In case if you have done that mistake and left with kernal only than trysudo apt install gnome on kernal.
try to change your default python version instead removing it. you can do this through bashrc file or export path command.
Its simple
just try:
sudo apt-get remove python3.7 or the versions that you want to remove
Related
Package management and juggling pip, anaconda, PPAs, and virtual-environments is difficult. Somewhere in my constellation of dependencies, things are broken. I'm on Ubuntu 18.04. As far as I know, I cannot fix these dependencies by hand.
The problem, for what it's worth: I've been unable to use tensorflow for a few months. Every time I try to fix it, even uninstalling and reinstalling everything to the best of my knowledge, things still don't work. After sinking enough hours, I'm looking for a "nuclear solution".
What I would like to do is cleanly remove everything except Python and any Python packages my system might require, so that I can start fresh (and hopefully do things properly.)
So, my question: How can I systematically clean up or remove my Python installation? I want to wipe everything and start anew. Does there exist a systematic guide, or a smart and reputable script that does this?
Helpful and cautionary tale, be a good idea not to delete it I think... I'll assume it was the profanity that got it deleted so I've edited it out.
!!!! WARNING !!!!
If you're like me and you think ah shur I'll do an 'apt list --installed | grep -i python' and then 'apt purge -y' all that crap, well, maybe don't.
Now my entire system is doo-doo. It all seemed fine until I rebooted and now there is no network connection, netplan and a bunch of other stuff is just gone. No recovery possible.
Actually it looks like it was an 'apt autoremove' AFTER I'd done the above that actually removed netplan.
And all because I wanted to remove multiple python versions to get over those gosh darn import issues and messin' around with pip and pip3 and pip3432432 and what gosh flippin' version of python is tied to what oody doody version of pip...
UPDATE - This video helped me recover me files https://youtu.be/tGIPeWkPkMc
You can try sudo apt purge python-pip python-dev, or python3 and python3-pip if you're using Python 3. This must remove all files/folders created by the installed packages. But I'm not really sure you need to do it.
The better solution is just to uninstall all pip packages, like pip freeze | xargs pip uninstall -y. Just to be sure you can even remove pip folder /usr/lib/python2.7/site-packages manually (or similar folder for Python 3).
(Extending #jay 's warning)
"Out of the Box", later Ubuntu versions have a system dependency on Python(3). For instance, my Ubuntu 20.04 runs "networkd-dispather" and "unattended-upgrade-shutdown". I've seen similar on various Cloud instances. Kali 2020 uses python to run a printer daemon. Check your system first. Or even try it on a VM similar to your system.
Try a quick check before doing something drastic.
ps aux | grep python
That will give you an idea if services are being run by Python. Frankly, I like the pip3 freeze to list the installed packages and cleanup from that list, like #sortas suggests in the second half of his answer.
i am trying to install Home Automatization (https://home-assistant.io) on my Synology. I've installed python via the synology packaging system, i've done basic setup (https://home-assistant.io/docs/installation/synology/) but when i try to run the daemon i see this in console:
homeassistant requires Python '>=3.5.3' but the running Python is 3.5.1
Is there any chance to update the python to required version on synology? Can you help me please?
Synology offers only python 3.5.1 at the moment.
You need to install older version of HA as mentioned on the installation page in blue box.
./python3 -m pip install homeassistant==0.64.3
If you would like to install latest HA, you would need to use docker instances on Synology, if your model supports it.
BTW.
Since the Python3 update (3.5.1-108) on Synology. once you install the HA you need to edit two files.
/volume1/#appstore/py3k/usr/local/bin/hass
and
/volume1/#appstore/py3k/usr/local/lib/python3.5/runpy.py
and add "import pip" to the beginning of the file where the import statements are. Otherwise HA will not start.
I've provided an updated python3-3.5.6 SPK for Synology in SynoCommunity; python3-3.6.8 is in the pipeline. Consider adding SynoCommunity ("spksrc") to your NAS to seamlessly install updates.
Additionally, be aware that home-assistant-0.82 is in beta at the same site.
Raw SPKs can be manually downloaded from my beta site if you want to check there as well, but I would suggest you look into SynoCommunity, keep updated from there, contribute comments and code there.
I am trying to reinstall Python, so I go control panel > uninstall > Python 3.6.2. It succeeds, but when I try to download 3.6.*, it says that I can't download because there is already a version of Python3 installed.
I tried to clean the registry, deleted all files named "Python", but still see the error. I even deleted the path Python in PATH.
This may be a silly solution, but for me the issue was the Python Launcher still listed in the apps list after the uninstall. Uninstalled it separately, afterwards reinstalled Python without the error.
The installer/uninstaller does not do a good job of cleaning up after itself (and that's being generous). What worked for me:
Remove all python binary folders from Program Files and Users\<username>\AppData
Clean the PATH of any and all mentions of python
Search the registry in Computer\HKEY_CLASSES_ROOT\Installer\Features for any values with python, then delete the containing key. The key names are things like "03CEBFB8CC334B3148F9B330F67264A6" (that's an example, not an actual one, since the actuals I deleted)
#3 is the one that actually got it past the hurdle, but #1 and #2 should be done anyway.
My issue persisted despite all the above. If you're still having issues:
I realized the Python installer shows a log file link... wish I had noticed it sooner. Click to open that log, search for "Detected". Find all lines with "Detected related package". These lines are specifically what's tripping the installer. Notice the version numbers are higher than the version you're installing, along with the "Operation: Downgrade"s).
Once you find these GUIDs in your log, you'll need to search each of them in the registry. I use a free registry tool called Resplendence Registry Registrar Manager (I have no connection with them), which searches the registry blazingly fast and will show everywhere it finds something. But you can also just use Windows' native RegEdit, as well.
When you find one of these GUIDs in the registry, rename the key by adding an underscore to it, like below. This is the equivalent of "deleting" them -- as far as the Python installer can tell -- but without actually deleting them. You can easily revert them if needed.
Re-run the Python installer and it should now install just fine.
Delete all the files of the old version python and try to re-install to uninstall the older version you can do it from control panel
Install another version. For example, if you are installing a 64-bit installation, then try to install 32-bit.
Download zip file from below URL.
https://www.python.org/ftp/python/3.6.0/python-3.6.0-embed-amd64.zip
Copy all the contents to the python folder which is registered in the environment.
I managed to fix all this Python cringe by doing this:
Download newest version of Python for your version after the first point. In this case it's Python 3.6, so I downloaded the latest available - 3.6.8:
https://www.python.org/downloads/release/python-368/
Run it.
Check the checkbox "Add Python to Path":
Press on the Custom Installation button:
Press Next:
Install:
It should install. Now go to Control Panel\Programs\Programs and Features, press RMB and uninstall:
Now run your wanted Python 3.6.X installation again.
If it still gives you the "A newer version of the Python launcher is already installed", run the latest installer again as in all the previous steps, but instead, check the "Install for All Users" checkbox:
Then uninstall this latest version again.
And then install your wanted Python 3.6.X installation again.
I'm throwing hands in the air, personally
I had to do it just now for 3.6, 3.7, 3.8, 3.9 and 3.10 versions because I had problems with uninstalling and installing with errors "no python installation was detected" and "A newer version of the Python launcher is already installed". Why do I have all these different versions of Python? Because different programs want different versions of Python installed and refuse to work with any other(lmao).
World would be a better place without Python.
For me, the solution to the problem (a newer version of the python launcher is already installed) was to install it via the web installer from the website (https://www.python.org/downloads/windows/)
Download the Windows x86-64 web installer. The installer took for his series (3.7). Oddly enough, it worked the first time. Previously, the registry was cleaned, and the removal of possible traces of the program - all to no avail.
I am running Windows 7 64 bit and have installed easy_install. When I run easy_install from the command prompt it opens another window for the output and quickly closes before I am able to examine what has been done.
I am aware of this question but think it may have been closed prematurely as the solution that the closed ticket referred to here does not work on my system.
When I run the cmd window as Administrator and then execute (for example):
$ easy_install pip
I get the same behavior ... another cmd window flashes and then I am returned to the prompt with no output. How then do I force easy_install to output its results in the current window?
UPDATE: (additional information) This same behavior is exhibited when using pip.exe and virtualenv.exe as well. This must have something to do with how these executables are built and how they interact with windows 7 64bit.
I discovered that the issue was the version of setuptools that I was using. I had installed python-2.7.1.amd64 and then installed setuptools-0.6c12dev.win-amd64-py2.7.
In the the quest to grab a 64 bit setuptool - I failed to notice the "dev" part of the filename.
It turns out when I uninstalled it and then installed setuptools-0.6c11.win32-py2.7 all output stays in the console. There seems to be some issues with the newer "c12" version.
On a related note - this fixes the same problem with the use of pip and virtualenv as well.
Windows 7 has made user privileges a huge hassle. It's intended to protect the average user but gives developers headaches.
Run cmd.exe as Admin (right-click on the .exe and then select "Run as Administrator") and this problem should be solved.
I've also seen this happen if you install a virtualenv and then change the parent directory name. The path seems to be hardcoded in various files when you install the virtualenv, so changing anything upstream gives it fits. You can either grep/wingrep all the files that contain the path and manually update it, or do a Google search and find the "correct" way to fix the problem (I think there is one).
First try this:
Backup your Scripts\easy_install.exe to somewhere else
Go to Lib\site-packages\site-packages\distribute-0.6.13-py2.6.egg\setuptools and copy cli.exe to Scripts\, then rename it to easy_install.exe
Run and see the result.
I'm using distribute here, if you are using setuptools and the above steps doesn't work, I suggest you give distribute a try.
I had the same issue (new window behavior displayed across a number of libraries) - I believe it was the result of the compilation method used for the setuptools binary.
I had originally used the compiled binaries that were available here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
I just had to uninstall the setuptools binary and install one available here:
http://pypi.python.org/pypi/setuptools
Presumably you'd also be able to compile your own version should you need a win64 binary.
I had such problem with pip and easy_install on Windows 7. You can just use Powershell (could be found in accessories). It works fine.
i too faced the same problem once, here is an easy and quick solution
try specifying the commands like so:
c:\python27\python.exe -m easy_install Django==1.6.5v
I've followed all instructions given on this site with an empty .vim folder, but for some reason, python highlighting is not working on my system. It only highlights the comments and a few variables - nothing like the picture.
http://concisionandconcinnity.blogspot.com/2009/07/vim-part-i-improved-python-syntax.html
Is there some other setting I am forgetting?
I'm also using ubuntu 10.04 if that matters.
A weird other note - it works in gvim, but not vim?
If you don't want to change the colorscheme, you should check out CSApprox.vim. It allows you to use colorschemes made for gvim in vim.
http://www.vim.org/scripts/script.php?script_id=2390
The colorscheme used in that tutorial is only for gvim. Try changing your colorscheme.
I think ubuntu installs vim in a minimal package (vim-tiny) with some features missing. You can try to upgrade your vim to the full version:
sudo apt-get install vim-full