Marcus
Marcus

Reputation: 161

Jupyter Notebook does not import any module

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-c1d07d468637> in <module>
----> 1 import requests
      2 

ModuleNotFoundError: No module named 'requests'

Nothing worked so far. I appreciate any help

Jupyter error message:

Jupyter error message

Pip installed modules:

Pip installed modules

Upvotes: 1

Views: 325

Answers (2)

bhe
bhe

Reputation: 85

Maybe you forgot to append the path to your modules to sys.path.

Example from within your notebook, if u want to import some selfwritten module from some relative location:

import sys
sys.path.append("../../../")
sys.path.append("../../")

# Rest of your code goes here, for example import $MODULE_NAME

Then you can import $MODULE_NAME (so, use the proper modulename of your desired module) iff. that module is in ../../ or in ../../../.

HTH. :-)

Upvotes: 1

I think you are installing your modules on a vitualenv and the Jupyter notebook is running outside the virtualenv.

This happened to me once.

Upvotes: 1

Related Questions