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

akshaykadidal
akshaykadidal Registered Posts: 2 ✭✭✭
edited July 2024 in General

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'

Answers

  • arnaudde
    arnaudde Dataiker Posts: 52 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

  • akshaykadidal
    akshaykadidal Registered Posts: 2 ✭✭✭

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

  • arnaudde
    arnaudde Dataiker Posts: 52 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 ?

Setup Info
    Tags
      Help me…