Jupyter notebook: Unable to import a library after installing it using pip

akshaykadidal
Level 1
Jupyter notebook: Unable to import a library after installing it using pip
 

Untitled.pngUntitled1.png

 

!pip3 install prefixspan

Requirement already satisfied: prefixspan in /home/dataiku/.local/lib/python3.6/site-packages
Requirement already satisfied: docopt>=0.6.2 in /home/dataiku/.local/lib/python3.6/site-packages (from prefixspan)
Requirement already satisfied: extratools>=0.8.1 in /home/dataiku/.local/lib/python3.6/site-packages (from prefixspan)
Requirement already satisfied: sortedcontainers>=1.5.10 in /home/dataiku/.local/lib/python3.6/site-packages (from extratools>=0.8.1->prefixspan)
Requirement already satisfied: toolz>=0.9.0 in /home/dataiku/.local/lib/python3.6/site-packages (from extratools>=0.8.1->prefixspan)

import prefixspan
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-f482b0ab5f8d> in <module>
----> 1 import prefixspan

ModuleNotFoundError: No module named 'prefixspan'

 

0 Kudos
3 Replies
arnaudde
Dataiker

Hello,
The way to go to manage python packages in DSS it to use code environments. You will be able to specify and install the pip packages you need. 


Then going back to your notebook you will be able to change the kernel (Kernel>Change Kernel) to the one with the right code environment and therefore the needed packages.

I hope it helps,

Arnaud

0 Kudos
akshaykadidal
Level 1
Author

I have created 3.6 evnironment. but yet when I check the python version it still shows 2.x

0 Kudos
arnaudde
Dataiker

Hello, 
Can you specify where you check the python version ? 
If you are checking the version in a python dss notebook, have you changed the kernel before executing the cell ?

0 Kudos