Skip to main content
Solved

Containerization Practice in CDF Jupyter Notebook

  • 23 June 2024
  • 6 replies
  • 45 views

Hello All, 

I am curious to know, how does Cognite follows containerization practices. 
Can we create and use virtual environment in CDF jupyter notebook?

I had installed (%pip install) some packages in my notebook and used it for a while. Surprisingly in next session (Notebook restart / kernel restart) it is giving error as ‘package not found’.

 

6 replies

Userlevel 4

Hi,

Thanks for asking this question and using our Jupyter Notebook service. The Jupyter Notebook in Cognite Data Fusion is based on a browser only Pyodide kernel where everything runs inside your browser. The way it works is that each Python kernel starts from scratch, so all packages have to be installed each time in a cell using %pip install mypackage which usually is really fast. 

There is no state between sessions you can rely on.

Hope this helps!

Badge +2

Hi Andres, 

I have subsequent question to this:

  1.  Does that mean - we do not use any CDF compute resources? 
  2. As stated, ‘Python Kernel starts freshly every time’ - then every time I need to INSTALL the library in same notebook. Is this correct ? 
     
Userlevel 4

Correct! No Cognite compute resource is used for notebooks, only your browser.

And yes, add a cell with the packages you want to install to ensure that the notebook has what it needs. Installing is quite fast (faster than installing locally on the computer normally).

Userlevel 4
Badge +2

Hi @Ankit Kothawade,

We are following up to see whether you're satisfied with the responses you've received? 

Userlevel 4
Badge +2

Hi @Ankit Kothawade,

Did the information provided above assist you in addressing your query?

Userlevel 4
Badge +2

Hi @Ankit Kothawade,

I hope the issue has been resolved. I'm closing this topic for now. Please feel free to start a new post if you have any questions. 

Reply