Score:0

Python modules not found post upgrade to 20.04

es flag

I've been using ipython, pandas and various other libraries in Ubuntu 16.04 for a very long time. I've recently upgraded to ubuntu 20.04 (Upgraded to 18.04 and then to 20.04 quickly).

In both 18.04 and 20.04, when I try to run ipython I get the following error:

Traceback (most recent call last): File "/usr/local/bin/ipython3", line 6, in from IPython import start_ipython ModuleNotFoundError: No module named 'IPython'

ipython is in /usr/local/bin/ipython3. That inturn seems to have '#!/usr/bin/python3'.

Clearly /usr/bin/python3 is not seeing the ipython install.

Now in ubuntu 20.04 /usr/bin/python3 is python3.8. IIRC, In 16.04 it used to be python python3.5.

Originally ipython and various other modules were installed when I was in 16.04. So I am assuming these would have installed it into the python3.5... and the current python3 doesn't see them.

Questions:

  1. Is my reasoning above correct?

  2. Does this mean now in ubuntu 20.04 I should reinstall all modules I need afresh (so that they would go into python3.8)

  3. If I have to reinstall modules, Is it safe to remove the earlier ipython or other modules that I had installed in 16.04? How would I know if some modules among these are used by the rest of the system

  4. In general, a user in ubuntu when installing modules, should he do a 'sudo pip install' or just a 'pip install'.

  5. Currently when I check /usr/bin/python*, there seems to be several installations: /usr/bin/python2.7
    /usr/bin/python3.5
    /usr/bin/python3.5m
    /usr/bin/python3.8

Are all these required by the system (i.e., ubuntu 20.04) or are some of these leftovers from ubuntu 16.04 that I can safely remove?

ru flag
Leave the system Python installations alone, unless youknow what you're doing. If you've upgraded, Python will default to 3.8 and that will result in your previous modules not working - you will need to reinstall those modules.
Mani avatar
es flag
Problem is I don't know which are the system python installations and what modules they require. For instance - I know that I installed ipython in 16.04, so that is probably not the system. So if I reinstall ipython.. I suppose this would overwrite the current /usr/local/bin/ipython.. leading two installations of ipython that may be overwriting/corrupting each other?
ru flag
If you did any types of installation in /usr/local/ those are manually installed by you and need rebuilt/reinstalled/recompiled. Leave anything not in `/usr/local` alone. You may want to run `sudo apt autoremove` at some point to try and clean up unneeded packages (which may remove the older Python)
Mani avatar
es flag
Thank you. But I did not manually install in those locations - that much I'm sure. In 16.04, IIRC, all that I had done was pip3 install ipython. So if the ipython is in /usr/local/bin its probably that installation that put it there. (Also, I did the sudo apt autoremove ..didn't remove anything.)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.