Home > Mobile >  Jupyter not able to find a module
Jupyter not able to find a module

Time:01-06

I installed a python package

C:\Users\MChadha>pip install vertica-python
Collecting vertica-python
  Downloading vertica_python-1.0.2-py2.py3-none-any.whl (169 kB)
     |████████████████████████████████| 169 kB 3.3 MB/s
Collecting six>=1.10.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting python-dateutil>=1.5
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 6.8 MB/s
Installing collected packages: six, python-dateutil, vertica-python
Successfully installed python-dateutil-2.8.2 six-1.16.0 vertica-python-1.0.2

Then I opened my jupyter notebook and tried to import it but got error.

import vertica_python
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_25176/685984573.py in <module>
----> 1 import vertica_python

ModuleNotFoundError: No module named 'vertica_python'

The code works if I create a separate python file and run it from cmd prompt.

How do I make a module visible to jupyter notebook?

CodePudding user response:

I suppose that something is wrong with your python path (pip installs package for one prefix while jupyter is using another one). So you could try installing directly from jupyter to ensure that doesn't happen (write it in cell):

import sys
!{sys.executable} -m pip install vertica-python
  •  Tags:  
  • Related