How to run notebooks with user created packages?

Problem

I have created my own utils.py package and I would like to import it in the Neptune cloud notebooks. How can I do that?

Solution

Step 1

First, you need to upload your file or package to Neptune. You can do that by going to your projects Uploads section on the left, and navigating to your file:

image

Step 2

Then, you need to fire-up your notebook. Choose the worker and environment that suits you best.

Remember to mount the /uploads path.

image

Step 3

Finally, you need to add your package to the system path. To do so, add the following snippet at the top of your notebook:

1
2
import sys
sys.path.append('../input/uploads')

Now you can use your utils.py package with no problems:

1
from utils import great_function

This is how it looks in Neptune:

image

See also