Fundamental problem with an import of the additional packages in the docker container/Container cant import from the folder in the folder

Hello.I installed dokcer container [].
I installed 2 additional packages as well.
GitHub - NVIDIA-AI-IOT/torch2trt: An easy to use PyTorch to TensorRT converter
GitHub - NVIDIA-AI-IOT/trt_pose: Real-time pose estimation accelerated with NVIDIA TensorRT

I have problems with import and i need help.
First of all, i couldnt import torch2trt and trt_pose after installation.I copied these folders into the folder Jupiter0 (my folder for program execution in the docker container) and as a result i could import them.

But, unfortunatelly i couldnt import dependecies.(For example TRTMODULE from which is located in the torch2trt folder)

I copied and as a result i could import TRTMODULE

But there is a lot of other dependencies and i just cant copy all of them, because i have the same problem on the each level of the folder.Container can import programm only directly from the Jupiter0 folder and cant import programm from the folder which is located in the Jupiter0 folder.

How can i import all dependencies from torch2trt and trt_pose into the docker container ?

Hi @A98, it’s hard to dissect from your screenshots, but when you install these packages in the container, clone them to a different folder than your project exists in. And do not have your file called because that is the name of another module.

I think what’s happening is that you have a file called and also a folder of that, and when you try import torch2trt it is calling those local files instead of the ones that got installed under /usr/local/lib/python3.6

import will look for files/directories under your local CWD before searching the installed packages for them.

Also, just FYI, jetson-inference already includes the pose estimation models from trt_pose (used by jetson_inference.poseNet)

Hi.Thanks for your reply.I cant get how to clone the folders to a different folder than my project exists in, becuase ,in my point of view, i dont have any other folders.

To execute programm in the docker conatiner i do these steps: jetson-infrence
2.docker/ --volume /my/host/path:/my/container/path (/my/host/path is atlas/desktop/Jupiter0) /home/atlas/jetson-inference

As a result, i can execute (or import) programms, only if they are located directly in the Jupiter0 folder (and cant execute (or import) programms if they are located in the folder which is located in the Jupiter0 folder.Unfortunatelly i couldnt solve this problem by changing the matching names of the folders and programms).

As i said before, In my point of view i dont have any other folders,so :

Should i create 1 more folder by the command :docker/ --volume /my/host/path:/my/container/path , and clone my packages in it ?(In my point of view problem will be the same in this situation. For some reason docker container cant import packages from the folder, which is located in the /my/host/path and can import packages only directly from it)

Or maybe i should clone these packages in the jetson-inference folder?

Or maybe another folder ?If so, could you give me the path to it ?

@A98 you should clone the packages into a different folder inside the container, like /opt, and install them from there. It needn’t be mounted. After they are installed, you can save the changes to the container with docker commit or by making your own Dockerfile that uses jetson-inference as a base.

Thanks for your reply.I installed container by these commands:
git clone --recursive --depth=1 GitHub - dusty-nv/jetson-inference: Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
cd jetson-inference
So it is located in the jetson-inference folder, right ?
So i need to clone thess packages in the jetson-inference folder?

Hi @A98, clone the packages inside the container once it’s running - the container has a different filesystem, and you want to install them inside the container.

Once you run docker/ the prompt will change to # and those commands are run in the container. Then clone the other libraries you want to a directory different from your project’s so you don’t get the namespace collisions that you were with import (and try not naming your python files the same as another module is called)

Hello.Unfortunatelly, I did wrong conclusions about the sources of my problems.

Problems are associated with the impossibility of the import of the .cpp file and impossibility of the import of the packages directly from the lib/python3.6 .

I created 2 more topics, because name of this topic does not matches with the discussed problem anymore.

@A98, based on your new topics, it would seem that you are not installing these packages in the container itself, rather just copying the directories from your host into the container. You need to run pip/ to install the packages in the running container (or create/build your own Dockerfile). None of this process is specific to Jetson and there are many Docker tutorials out there that you can familiarize yourself with first before doing more complex things with them.

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