Search code examples
python-3.xpython-idle

How to solve ModuleNotFound Error in IDLE?


I am using ubuntu 18.04. I first installed Python along with anacondafrom terminal whose version is 3.7.0 and I have launched Jupyter notebook and Spyder as well. Then I installed IDLE whose version is 3.6.6+ and I am currently working in IDLE but then when I tried to import module,it shows the error: No module found. I checked for the path as well for both in IDLE and Terminal which are different.How do I solve this problem?

when I checked the python path,

In terminal,

/home/reema/anaconda3/lib/python37.zip:/home/reema/anaconda3/lib/python3.7:/home/reema/anaconda3/lib/python3.7/lib-dynload:/home/reema/anaconda3/lib/python3.7/site-packages

In IDLE,

['', '/home/reema', '/usr/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

I tried appending in IDLE but it doesn't work.


Solution

  • Your problem is due to the different interpreters installing modules in different paths, and because the default interpreter at the command prompt is likely 3.7, while the installed Idle uses 3.6

    The answer to your problem is to use pip to install new modules and invoke pip as follows

    $ python3.x -m pip install ...
    

    This way you know which interpreter is called, and each times the correct version of pip is invoked and, each time, the module is installed in the correct path for a given interpreter.

    I have to add that, as far as I can tell, the Anaconda distribution does not support Idle.