Ubuntu Uninstall all Python's and Pip's - python

I'm using Ubuntu Mate on a Raspberry Pi and want to uninstall all existing Python and Pip versions so that I can install only Python 3.8.3 and pip 20.1.1 because at the moment it's really confusing. I just want to type python something or pip install something and those versions to be used so i think the best way would be to uninstall them all and simply install the 2 versions I need.
I tried to run sudo apt-get remove --purge python but that didn't seem to have worked.

Related

Unable to install pandas or other packages in linux virtual environment

I am unable to install module pandas in my linux vm. I tried all ways to install it, but it says it has version 1.1.5 requirement already satistied. But when I try running the code, it says, no module found. The latest version of python in it is 2.7.3, but I want to install 3.8 or 3.7, but I'm unable to. Where am I going wrong?
Did you try installing python3 from your package manager? You can install python 3.9 from apt using the below command
apt install python3 pip -y
You can also install the below package to use python in the terminal instead of python3 every time
apt install python-is-python3 -y
I cant comment yet so using the answer section, kindly give me an upvote so I can start using the comment feature, sorry for the trouble

Install opencv-python module

I'm trying to install the opencv module without success, I think the problem is related to the version of python I'm using.
Indeed I upgraded to the 3.9.1 version but when I'm trying to install the module, I still receive a warning referred to the old version of python I had (i.e. 2.7).
How can I get rid of this situation and successfully install the opencv library?
Error in bash
The issue is because the pip you are using in the insallation command conforms to pip2 which is used for installing packages for python2 (as is evident from the command output). You can verify the version by running:
pip --version
To solve the issue, use pip3:
sudo -H pip3 install opencv-python
If pip3 is not installed, install it via HomeBrew:
brew install python3
It should install pip3 as well. Also, have a look at this.

How to install matplotlib on python3.4 raspberry pi

I am trying to install matplotlib on python3.4 (the default version on raspberry pi) via pip3 but the installation always fails.
I have tried installing python3.7 but pip3 defaults to installing on python3.4 and I don't know how to change that.
The error message I constantly get is " Beginning with Matplotlib 3.1, Python 3.6 or above is required.". How do I update my python on the pi or install it on python3.4?
Any help appreciated.
Having just looked at older releases ( https://pypi.org/project/matplotlib/#history ), I think 2.2.4 was the last version to work on Python 3.4
You can install a specific version of the library using the command
pip install matplotlib==2.2.4
Use the package manager of the distribution :
sudo apt install python3-matplotlib
The dependencies should be OK there.
You can just use
sudo pip3 install matplotlib
or for a local instlal of the lib
pip3 install --user <your_username> matplotlib

Pip install pandas: installing dependencies error

I am trying to pip install pandas in a virtual environment but I am having an error I really do not understand.
I am guessing it has something to do with the Double requirement given but I really do not know where to go from here.
I met the same error on Python3.4.
And the root cause of this error is that
"pandas 0.21-0.22 no longer supports Python 3.4"
See more about this issue:
https://github.com/pandas-dev/pandas/issues/20775
Problem with installing pandas for Python 3.4
You get the error "Double requirement given: numpy ..."
The reason for this error is that pandas 0.21-0.22 no longer supports Python 3.4, and thus no longer distributes binary wheels for Python 3.4. Therefore, pip tries to install pandas from source, and this is what now started to fail with Pip version 10.
You can check your python version.
$ python --version
Python 3.4.3
Solution: Install python 3.5
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.5
After you install python 3.5, you can install pandas successfully in a virtual environment(with Python 3.5).
Is this a clean & fresh new venv? If not, one thing to try is making a new venv, then first installing numpy and after that pandas.
BTW: I'd suggest switching to Python 3.
the latest version of pandas have some issue with python3.4, if you have python3.4 you can install 0.20.3 version of pandas
pip3 install pandas==0.20.3
You don't have to install via pip, you can install via your system's repositories see here.

How can I let pip know that I am interested in packages for python 3.4?

After an hour search, I have found no answer.
My Mac came with Python 2.7, but I have decided to upgrade to python 3.4.
I installed python 3.4 from python.org.
I can now use python 3.4 from terminal.
Pip still tries to download python 2.7 packages - numpy for 2.7 is "up to date".
When I try to --upgrade a package, for example numpy, I get "no permission" error. With sudo appended, the output is trash.
How can I let pip know that I am interested in packages for python 3.4?
Requirement already up-to-date: numpy in /Library/Python/2.7/site-packages
That's the problem. I want numpy to be up-to-date with Python 3.4.
You should be able to call a specific pip for your install, although it depends on which version you are running:
Starting at version 0.8:
pip-3.4 install numpy
and starting at version 1.5:
pip3.4 install numpy
If you don't have these, you should be able to just download pip and reinstall it, just be sure to call python 3.4 when you run the installer.
I would suggest to install a package manager such as macports brew and install the updated python version from them. After the latest version of python is setup use pip to install the version of numpy
In mac ports , you are able to select the default system python without messing with the path your self.
I would use Homebrew:
brew install python3
This should install Python3.4.1. Then to get pip:
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python3 get-pip.py
# Upgrade just in case...
pip3 install -U pip
Then use:
pip3 install numpy
And to run Python, use:
python3
(I only have one Python 3 installation, if you have multiple you'll need to be more specific with the version number)

Categories