romhayh
romhayh

Reputation: 35

ModuleNotFoundError: No module named 'IPython', but ipython is installed

I have tried to put this script in the sitecustomize.py file, to be able to see colored error messages in visual studio code.

the script:

import sys
from IPython.core.ultratb import ColorTB

sys.excepthook = ColorTB()

I got the error message above even though I have used pip to install ipython.

EDIT:

I tried to use coloredlogs instead of ipython and it showed me the same message again

Upvotes: 0

Views: 2855

Answers (3)

romhayh
romhayh

Reputation: 35

I needed to reinstall python on my computer. there were multiple versions of it, and because of that there were multiple versions of pip

Upvotes: 0

Jill Cheng
Jill Cheng

Reputation: 10344

Please use the command "pip show ipython" to check the installation location of the module: (If it does not display the location of the module, it means that the terminal used environment is inconsistent with the selected one.)

enter image description here

Then find the folder of the module in this python environment, try to delete it, and then reinstall it:

enter image description here

Run:

enter image description here

Upvotes: 0

Seth
Seth

Reputation: 2370

The IPython module only works inside iPython, not inside any other IDE/Shell/etc.

Upvotes: 1

Related Questions