How to reinstall system python 2.7 on Linux Mint 18.3 WITHOUT reinstalling the OS?
up vote
1
down vote
favorite
On a clean install of Linux Mint 18.3 I ran the following commands through the terminal:
sudo apt install python-pip
pip install install --upgrade pip
pip install future
pip install six
Now when I run pip install <package name>
or sudo pip install <package name>
neither works. Generally I'll get an error message that looks like this:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
I think it was the pip install install --upgrade pip
command that broke everything but yeah this was a terrible idea and I've given up on what I was trying to. All I want now it to return my system python to it's factory setting without having to completely reinstall Linux Mint. Is that possible?
linux-mint apt python pip
add a comment |
up vote
1
down vote
favorite
On a clean install of Linux Mint 18.3 I ran the following commands through the terminal:
sudo apt install python-pip
pip install install --upgrade pip
pip install future
pip install six
Now when I run pip install <package name>
or sudo pip install <package name>
neither works. Generally I'll get an error message that looks like this:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
I think it was the pip install install --upgrade pip
command that broke everything but yeah this was a terrible idea and I've given up on what I was trying to. All I want now it to return my system python to it's factory setting without having to completely reinstall Linux Mint. Is that possible?
linux-mint apt python pip
This is one of my annoyances with the new pip 10 release. The packages you are using expect pip <= 9.
– Edward Minnix
Jun 11 at 19:42
@EdwardMinnix yes it sucks. The python devs seem like they are aggressively trying to kill python 2.7. it's a just cause but sometimes I disagree with their methods.
– James Draper
Jun 11 at 19:48
This is not a Python 2 versus Python 3 issue, this is a pip issue (anything from 2.7 to 3.6).
– Edward Minnix
Jun 11 at 20:00
1
In fact, it's an Ubuntu issue, because packages installed withapt
are protected against overwriting. So when you issuesudo pip install --upgrade pip
, you actually don't update anything - you install another copy ofpip
in/usr/local/
. The error is because/usr/local/lib/pythonX.X/site-packages
precedes/usr/lib/pythonX.X/dist-packages
, sopip==8.1.2
frompython-pip
tries to use incompatible code frompip==10.0.0
, thus causing the import error. An easy fix is to place/usr/local/bin
before/usr/bin
, so the correct executable is used when callingpip
.
– hoefling
Jun 11 at 21:43
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
On a clean install of Linux Mint 18.3 I ran the following commands through the terminal:
sudo apt install python-pip
pip install install --upgrade pip
pip install future
pip install six
Now when I run pip install <package name>
or sudo pip install <package name>
neither works. Generally I'll get an error message that looks like this:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
I think it was the pip install install --upgrade pip
command that broke everything but yeah this was a terrible idea and I've given up on what I was trying to. All I want now it to return my system python to it's factory setting without having to completely reinstall Linux Mint. Is that possible?
linux-mint apt python pip
On a clean install of Linux Mint 18.3 I ran the following commands through the terminal:
sudo apt install python-pip
pip install install --upgrade pip
pip install future
pip install six
Now when I run pip install <package name>
or sudo pip install <package name>
neither works. Generally I'll get an error message that looks like this:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
I think it was the pip install install --upgrade pip
command that broke everything but yeah this was a terrible idea and I've given up on what I was trying to. All I want now it to return my system python to it's factory setting without having to completely reinstall Linux Mint. Is that possible?
linux-mint apt python pip
linux-mint apt python pip
asked Jun 11 at 17:21


James Draper
15818
15818
This is one of my annoyances with the new pip 10 release. The packages you are using expect pip <= 9.
– Edward Minnix
Jun 11 at 19:42
@EdwardMinnix yes it sucks. The python devs seem like they are aggressively trying to kill python 2.7. it's a just cause but sometimes I disagree with their methods.
– James Draper
Jun 11 at 19:48
This is not a Python 2 versus Python 3 issue, this is a pip issue (anything from 2.7 to 3.6).
– Edward Minnix
Jun 11 at 20:00
1
In fact, it's an Ubuntu issue, because packages installed withapt
are protected against overwriting. So when you issuesudo pip install --upgrade pip
, you actually don't update anything - you install another copy ofpip
in/usr/local/
. The error is because/usr/local/lib/pythonX.X/site-packages
precedes/usr/lib/pythonX.X/dist-packages
, sopip==8.1.2
frompython-pip
tries to use incompatible code frompip==10.0.0
, thus causing the import error. An easy fix is to place/usr/local/bin
before/usr/bin
, so the correct executable is used when callingpip
.
– hoefling
Jun 11 at 21:43
add a comment |
This is one of my annoyances with the new pip 10 release. The packages you are using expect pip <= 9.
– Edward Minnix
Jun 11 at 19:42
@EdwardMinnix yes it sucks. The python devs seem like they are aggressively trying to kill python 2.7. it's a just cause but sometimes I disagree with their methods.
– James Draper
Jun 11 at 19:48
This is not a Python 2 versus Python 3 issue, this is a pip issue (anything from 2.7 to 3.6).
– Edward Minnix
Jun 11 at 20:00
1
In fact, it's an Ubuntu issue, because packages installed withapt
are protected against overwriting. So when you issuesudo pip install --upgrade pip
, you actually don't update anything - you install another copy ofpip
in/usr/local/
. The error is because/usr/local/lib/pythonX.X/site-packages
precedes/usr/lib/pythonX.X/dist-packages
, sopip==8.1.2
frompython-pip
tries to use incompatible code frompip==10.0.0
, thus causing the import error. An easy fix is to place/usr/local/bin
before/usr/bin
, so the correct executable is used when callingpip
.
– hoefling
Jun 11 at 21:43
This is one of my annoyances with the new pip 10 release. The packages you are using expect pip <= 9.
– Edward Minnix
Jun 11 at 19:42
This is one of my annoyances with the new pip 10 release. The packages you are using expect pip <= 9.
– Edward Minnix
Jun 11 at 19:42
@EdwardMinnix yes it sucks. The python devs seem like they are aggressively trying to kill python 2.7. it's a just cause but sometimes I disagree with their methods.
– James Draper
Jun 11 at 19:48
@EdwardMinnix yes it sucks. The python devs seem like they are aggressively trying to kill python 2.7. it's a just cause but sometimes I disagree with their methods.
– James Draper
Jun 11 at 19:48
This is not a Python 2 versus Python 3 issue, this is a pip issue (anything from 2.7 to 3.6).
– Edward Minnix
Jun 11 at 20:00
This is not a Python 2 versus Python 3 issue, this is a pip issue (anything from 2.7 to 3.6).
– Edward Minnix
Jun 11 at 20:00
1
1
In fact, it's an Ubuntu issue, because packages installed with
apt
are protected against overwriting. So when you issue sudo pip install --upgrade pip
, you actually don't update anything - you install another copy of pip
in /usr/local/
. The error is because /usr/local/lib/pythonX.X/site-packages
precedes /usr/lib/pythonX.X/dist-packages
, so pip==8.1.2
from python-pip
tries to use incompatible code from pip==10.0.0
, thus causing the import error. An easy fix is to place /usr/local/bin
before /usr/bin
, so the correct executable is used when calling pip
.– hoefling
Jun 11 at 21:43
In fact, it's an Ubuntu issue, because packages installed with
apt
are protected against overwriting. So when you issue sudo pip install --upgrade pip
, you actually don't update anything - you install another copy of pip
in /usr/local/
. The error is because /usr/local/lib/pythonX.X/site-packages
precedes /usr/lib/pythonX.X/dist-packages
, so pip==8.1.2
from python-pip
tries to use incompatible code from pip==10.0.0
, thus causing the import error. An easy fix is to place /usr/local/bin
before /usr/bin
, so the correct executable is used when calling pip
.– hoefling
Jun 11 at 21:43
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
If you're issue is being on too-modern a version of pip (10+), you can always revert it to the previous version (e.g., pip 9.0.3 which was the last version prior to pip 10). You can do this from the command line:
pip install pip==9.0.3
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
add a comment |
up vote
1
down vote
I am on a virtualbox linuxmint 18 Sarah installation.
I got into a real mess when I tried to update pip.
(eventually a missing frozen keyword when using the new pip for installations)
After trying to follow the various instructions like the one above, I did a brute force reinstall until I could run my python tests again and continue development.
Here it goes:
- First the system upgrade (apt update && apt upgrade)
then remove all python installations brute force
(uninstalling python2.7 with the package manager will leave many
broken packages behind)
rm -f /usr/bin/pip*
rm -rf /usr/lib/python2.7
rm -f /usr/local/bin/pip*
rm -f /usr/local/bin/pyt*
rm -f /usr/local/bin/pip*
rm -rf /usr/local/lib/python2.7
rm -rf $HOME/.local/bin/pyt*
rm -rf $HOME/.local/bin/pip*
rm -rf $HOME/.local/lib/python2.7
reinstall python from linux packages giving a working pip
apt install python2.7 --reinstall
apt install python-pip --reinstall
apt install python-setuptools --reinstall
apt install python-pkg-resources --reinstall
reinstall needed python package from using pip, e.g.:
pip install wheel
pip install grequests
pip install pytest
pip install flask
pip install chardet
pip install prometheus_client
pip install bs4
The python packages you need to reinstall might vary obviously for your setup.
I hope I didn't miss anything important from my command history, but you should get the general idea. The longest was the system upgrade. Everything else wen quite quick
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
If you're issue is being on too-modern a version of pip (10+), you can always revert it to the previous version (e.g., pip 9.0.3 which was the last version prior to pip 10). You can do this from the command line:
pip install pip==9.0.3
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
add a comment |
up vote
1
down vote
If you're issue is being on too-modern a version of pip (10+), you can always revert it to the previous version (e.g., pip 9.0.3 which was the last version prior to pip 10). You can do this from the command line:
pip install pip==9.0.3
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
add a comment |
up vote
1
down vote
up vote
1
down vote
If you're issue is being on too-modern a version of pip (10+), you can always revert it to the previous version (e.g., pip 9.0.3 which was the last version prior to pip 10). You can do this from the command line:
pip install pip==9.0.3
If you're issue is being on too-modern a version of pip (10+), you can always revert it to the previous version (e.g., pip 9.0.3 which was the last version prior to pip 10). You can do this from the command line:
pip install pip==9.0.3
answered Jun 11 at 19:47
Edward Minnix
1114
1114
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
add a comment |
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
on my broken python this Successfully installed pip-8.1.1
– U.V.
Nov 23 at 13:54
add a comment |
up vote
1
down vote
I am on a virtualbox linuxmint 18 Sarah installation.
I got into a real mess when I tried to update pip.
(eventually a missing frozen keyword when using the new pip for installations)
After trying to follow the various instructions like the one above, I did a brute force reinstall until I could run my python tests again and continue development.
Here it goes:
- First the system upgrade (apt update && apt upgrade)
then remove all python installations brute force
(uninstalling python2.7 with the package manager will leave many
broken packages behind)
rm -f /usr/bin/pip*
rm -rf /usr/lib/python2.7
rm -f /usr/local/bin/pip*
rm -f /usr/local/bin/pyt*
rm -f /usr/local/bin/pip*
rm -rf /usr/local/lib/python2.7
rm -rf $HOME/.local/bin/pyt*
rm -rf $HOME/.local/bin/pip*
rm -rf $HOME/.local/lib/python2.7
reinstall python from linux packages giving a working pip
apt install python2.7 --reinstall
apt install python-pip --reinstall
apt install python-setuptools --reinstall
apt install python-pkg-resources --reinstall
reinstall needed python package from using pip, e.g.:
pip install wheel
pip install grequests
pip install pytest
pip install flask
pip install chardet
pip install prometheus_client
pip install bs4
The python packages you need to reinstall might vary obviously for your setup.
I hope I didn't miss anything important from my command history, but you should get the general idea. The longest was the system upgrade. Everything else wen quite quick
add a comment |
up vote
1
down vote
I am on a virtualbox linuxmint 18 Sarah installation.
I got into a real mess when I tried to update pip.
(eventually a missing frozen keyword when using the new pip for installations)
After trying to follow the various instructions like the one above, I did a brute force reinstall until I could run my python tests again and continue development.
Here it goes:
- First the system upgrade (apt update && apt upgrade)
then remove all python installations brute force
(uninstalling python2.7 with the package manager will leave many
broken packages behind)
rm -f /usr/bin/pip*
rm -rf /usr/lib/python2.7
rm -f /usr/local/bin/pip*
rm -f /usr/local/bin/pyt*
rm -f /usr/local/bin/pip*
rm -rf /usr/local/lib/python2.7
rm -rf $HOME/.local/bin/pyt*
rm -rf $HOME/.local/bin/pip*
rm -rf $HOME/.local/lib/python2.7
reinstall python from linux packages giving a working pip
apt install python2.7 --reinstall
apt install python-pip --reinstall
apt install python-setuptools --reinstall
apt install python-pkg-resources --reinstall
reinstall needed python package from using pip, e.g.:
pip install wheel
pip install grequests
pip install pytest
pip install flask
pip install chardet
pip install prometheus_client
pip install bs4
The python packages you need to reinstall might vary obviously for your setup.
I hope I didn't miss anything important from my command history, but you should get the general idea. The longest was the system upgrade. Everything else wen quite quick
add a comment |
up vote
1
down vote
up vote
1
down vote
I am on a virtualbox linuxmint 18 Sarah installation.
I got into a real mess when I tried to update pip.
(eventually a missing frozen keyword when using the new pip for installations)
After trying to follow the various instructions like the one above, I did a brute force reinstall until I could run my python tests again and continue development.
Here it goes:
- First the system upgrade (apt update && apt upgrade)
then remove all python installations brute force
(uninstalling python2.7 with the package manager will leave many
broken packages behind)
rm -f /usr/bin/pip*
rm -rf /usr/lib/python2.7
rm -f /usr/local/bin/pip*
rm -f /usr/local/bin/pyt*
rm -f /usr/local/bin/pip*
rm -rf /usr/local/lib/python2.7
rm -rf $HOME/.local/bin/pyt*
rm -rf $HOME/.local/bin/pip*
rm -rf $HOME/.local/lib/python2.7
reinstall python from linux packages giving a working pip
apt install python2.7 --reinstall
apt install python-pip --reinstall
apt install python-setuptools --reinstall
apt install python-pkg-resources --reinstall
reinstall needed python package from using pip, e.g.:
pip install wheel
pip install grequests
pip install pytest
pip install flask
pip install chardet
pip install prometheus_client
pip install bs4
The python packages you need to reinstall might vary obviously for your setup.
I hope I didn't miss anything important from my command history, but you should get the general idea. The longest was the system upgrade. Everything else wen quite quick
I am on a virtualbox linuxmint 18 Sarah installation.
I got into a real mess when I tried to update pip.
(eventually a missing frozen keyword when using the new pip for installations)
After trying to follow the various instructions like the one above, I did a brute force reinstall until I could run my python tests again and continue development.
Here it goes:
- First the system upgrade (apt update && apt upgrade)
then remove all python installations brute force
(uninstalling python2.7 with the package manager will leave many
broken packages behind)
rm -f /usr/bin/pip*
rm -rf /usr/lib/python2.7
rm -f /usr/local/bin/pip*
rm -f /usr/local/bin/pyt*
rm -f /usr/local/bin/pip*
rm -rf /usr/local/lib/python2.7
rm -rf $HOME/.local/bin/pyt*
rm -rf $HOME/.local/bin/pip*
rm -rf $HOME/.local/lib/python2.7
reinstall python from linux packages giving a working pip
apt install python2.7 --reinstall
apt install python-pip --reinstall
apt install python-setuptools --reinstall
apt install python-pkg-resources --reinstall
reinstall needed python package from using pip, e.g.:
pip install wheel
pip install grequests
pip install pytest
pip install flask
pip install chardet
pip install prometheus_client
pip install bs4
The python packages you need to reinstall might vary obviously for your setup.
I hope I didn't miss anything important from my command history, but you should get the general idea. The longest was the system upgrade. Everything else wen quite quick
answered Nov 23 at 16:08
U.V.
614
614
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449167%2fhow-to-reinstall-system-python-2-7-on-linux-mint-18-3-without-reinstalling-the-o%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This is one of my annoyances with the new pip 10 release. The packages you are using expect pip <= 9.
– Edward Minnix
Jun 11 at 19:42
@EdwardMinnix yes it sucks. The python devs seem like they are aggressively trying to kill python 2.7. it's a just cause but sometimes I disagree with their methods.
– James Draper
Jun 11 at 19:48
This is not a Python 2 versus Python 3 issue, this is a pip issue (anything from 2.7 to 3.6).
– Edward Minnix
Jun 11 at 20:00
1
In fact, it's an Ubuntu issue, because packages installed with
apt
are protected against overwriting. So when you issuesudo pip install --upgrade pip
, you actually don't update anything - you install another copy ofpip
in/usr/local/
. The error is because/usr/local/lib/pythonX.X/site-packages
precedes/usr/lib/pythonX.X/dist-packages
, sopip==8.1.2
frompython-pip
tries to use incompatible code frompip==10.0.0
, thus causing the import error. An easy fix is to place/usr/local/bin
before/usr/bin
, so the correct executable is used when callingpip
.– hoefling
Jun 11 at 21:43