Skip to main content
Solved

Containerization Practice in CDF Jupyter Notebook

  • June 23, 2024
  • 6 replies
  • 68 views

Forum|alt.badge.img+3

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’.

 

Best answer by Dilini Fernando

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. 

6 replies

Anders Hafreager
Practitioner ⭐️⭐️⭐️
  • Practitioner ⭐️⭐️⭐️
  • June 24, 2024

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!


Forum|alt.badge.img+3
  • Author
  • Seasoned ⭐️⭐️
  • June 25, 2024

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 ? 
     

Anders Hafreager
Practitioner ⭐️⭐️⭐️
  • Practitioner ⭐️⭐️⭐️
  • June 25, 2024

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).


Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Forum|alt.badge.img+2
  • Expert ⭐️⭐️⭐️⭐️
  • July 19, 2024

Hi @Ankit Kothawade,

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


Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Forum|alt.badge.img+2
  • Expert ⭐️⭐️⭐️⭐️
  • July 19, 2024

Hi @Ankit Kothawade,

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


Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Forum|alt.badge.img+2
  • Expert ⭐️⭐️⭐️⭐️
  • Answer
  • August 30, 2024

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.