Where are modules in Jupyter Labs Python files stored?

Hello there,
I am currently working on a project which uses a Jetson nano and an Arduino Uno and I am working on a serial connection between them.
FYI I am using this set of documentation: Sign In
(Sorry if the link does not work in advance)

So the question I have is where are the modules from Jupyter Labs in python files stored? As seen by the screenshots below, I tried to import pyserial and I was able to get the Notebook to store locally on the Jetson but I cant figure out how to get pyserial to also install locally in the “data” directory which is the directory which is loaded when I load the docker file using this command: ./docker_dli_run.sh

Here is a screenshot of the files which I managed to get locally loaded to the Jetson:

And here is a screenshot of the code which gives an error that says it could not find the pyserial module:

What I can do is install pyserial every time I want to run this although it would become more difficult as I add more things to my project. If anyone can give advice as to what I should do/can tell me where the imports are stored in Jupyter labs, that would be great! Also please tell me if I have to include any more information as to what my issue is.


See your docker_dli_run.sh. Maybe it has --rm option.
See also the docker run documentation.

The --rm option deletes the container when it is exited.
This provides the same environment upon restart as the first time. This means that if you accidentally delete a code or something, a restart will restore the original environment.

However, as in your case, it also undoes the necessary updates.

It is recommended that you are at least familiar with the following docker commands.

docker images
docker ps -a
docker pull IMAGE
docker run IMAGE
docker stop CONTAINER_ID
docker start CONTAINER_ID
docker rm CONTAINER_ID
docker rmi IMAGE_ID
1 Like

Hello naisy,
I will look through the documentation and another quick question I have is that as seen in the screenshot below (I manually installed pyserial for this demo), it shows with an error that it could not open /dev/ttyACM0’s port and I was wondering is it something to do with what is inside the docker.sh script? and how would I change it? Would I just add /dev/ttyACM0/seperated by a comma after the /dev/video0line?

The error:

SerialException: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'

The docker.sh file:

sudo docker run --runtime nvidia -it --rm --network host     --volume ~/nvdli-data:/nvdli-nano/data     --device /dev/video0     nvcr.io/nvidia/dli/dli-nano-ai:v2.0.1-r32.6.1

Ok never mind I figured out the answer to my question about the device, all I have to do is use the --device= tag for every device I want to add

and turns out it does not work as i still get the “could not open port” error

try this for launch container. (only once)

sudo docker run \
  --runtime nvidia \
  -itd \
  --network host \
  -v ~/nvdli-data:/nvdli-nano/data \
  -v /dev/:/dev \

next, see your container status and container_id.

sudo docker ps -a

next, enter your container

sudo docker exec -it CONTAINER_ID /bin/bash

After reboot, container is still alive. but container is stopping.
So you need to start it.

sudo docker ps -a # see your container id
sudo docker start CONTAINER_ID
sudo docker exec -it CONTAINER_ID /bin/bash
1 Like

Hello again, Sorry for being such as mess but I got it to work, looks like I forgot to save the edits to the docker file and instead I just quit it without saving. All works now! thanks for the help!

Did you run docker commit? commit updates the docker image.
A container is created from the image. And you are working in the container.
--rm option deletes container if you exit docker container.
If the container remains, you can simply use the same container next time.
You don’t need to save the container to image, if you remove --rm option from docker run command.

How would I run the docker commit command because yesterday i tried out docker commit IMAGES and it did not save the module and i had to install pyserial again. What would I put after docker commit?

If you read the docker commit documentation, CONTAINER_ID and IMAGE_NAME are all you need.

For example, IMAGE_NAME is a string like mytest.

You can check the CONTAINER_ID with the following command

sudo docker ps -a

Once you know the CONTAINER_ID, you can commit with the following command
Committing means saving the CONTAINER to IMAGE.

sudo docker commit CONTAINER_ID IMAGE_NAME

After committing, check the IMAGE.

sudo docker images

Next time, change the IMAGE_NAME in the docker run command argument to use the image you saved.

sudo docker run ...

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.