29

Trying to install spyder using pip:

pip install spyder

This error pops up:

Cannot uninstall 'ipython'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

D Malan
  • 8,902
  • 3
  • 22
  • 41
Raphael
  • 1,230
  • 1
  • 11
  • 24

4 Answers4

53

You can upgrade ipython without uninstall the old version

sudo -H pip install --ignore-installed -U ipython
0xCC
  • 1,061
  • 1
  • 9
  • 8
  • can this cause some compatibility issues though? when having two different version installed? – Farid Alijani Jun 18 '20 at 13:00
  • @Färid Alijani, I think it won't. According to pip doc (https://pip.pypa.io/en/stable/reference/pip_install/), --ignore-installed overwrites installed packages – 0xCC Jun 19 '20 at 23:03
15

Just solved with:

sudo apt-get remove ipython
Benyamin Jafari
  • 21,522
  • 19
  • 109
  • 128
Raphael
  • 1,230
  • 1
  • 11
  • 24
  • 1
    For those using this solution for other packages (in my case, scipy): similar to @vigilantbag2018's answer you may have to prefix the package name (`scipy`) with either `python-` or `python3-` (`sudo apt-get remove python3-scipy`) – CrepeGoat Oct 09 '18 at 18:27
  • 1
    slight variation that worked for me: `sudo apt-get purge ipython*` – pestophagous Jan 04 '19 at 01:37
5

For Python 2:

pip install --upgrade --force-reinstall --no-cache-dir Spyder

For Python 3:

pip3 install --upgrade --force-reinstall --no-cache-dir Spyder
Benyamin Jafari
  • 21,522
  • 19
  • 109
  • 128
Hu Xixi
  • 1,551
  • 16
  • 25
3

Some of the solutions listed may work, but this one solved my issue with distutils installed packages.

sudo apt-get remove python-ipython

Depending on what type of package it is, you will need to provide the "python-" for python packages.

Edit: However, if this still does not solve your question, you might want to consider downgrading pip to an earlier version as pip 10 does not allow removal of distutils packages

sudo -H pip install pip==9.0.1
sudo pip uninstall ipython

Thank you for the comment, as I am looking to improve how I can help people.

  • 1
    Your "answer" is probably more of a comment as it does not attempt to address pip or distutils correctly. Moreover, you;re suggesting a package removal that is also vague - beware that a lot of stackoverflow users quite naively copy/paste commands to try things out and may end up trying your commands. Please consider improving this answer .. – shalomb Jul 25 '18 at 19:09