PyTorch on Docker L4T image

Hi,
I am trying to build a docker which includes PyTorch starting from the L4T docker image. The docker build compiles with no problems, but when I try to import PyTorch in python3 I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/torch/__init__.py", line 81, in <module>
    from torch._C import *
ImportError: libnvToolsExt.so.1: cannot open shared object file: No such file or directory

I have installed PyTorch from the wheel provided here https://devtalk.nvidia.com/default/topic/1049071/jetson-nano/pytorch-for-jetson-nano-version-1-3-0-now-available/

Are there some dependencies I would need to include in my Dockerfile in order to have pytorch work?

Hi,

We try to reproduce this issue first.
Could you share the Dockerfile you use for creating the image?

Thanks

I am having the same problem with both l4t docker images:
nvcr.io/nvidia/deepstream-l4t:4.0.1-19.09-iot
nvcr.io/nvidia/l4t-base:r32.2

Hi, fagundo_michael

We want to reproduce this issue in our environment.

The Dockerfile shared in comment#3 doesn’t support pyTorch.
Do you meet the same issue when running other command?
If yes, could you share which command do you use?

Thanks.

We haven’t heard back from you in a couple weeks, so marking this issue resolved by “accepting” this comment as answer.
Please open a new forum issue when you are ready and we’ll pick it up there.

Hello, I’m geting the same error. Here is the Dockerfile. Can you please look into it? Thanks

FROM nvcr.io/nvidia/l4t-base:r32.3.1

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
	python3-opencv ca-certificates python3-dev git wget sudo python-setuptools && \
  rm -rf /var/lib/apt/lists/*

ENV PATH="/home/appuser/.local/bin:${PATH}"
RUN wget https://bootstrap.pypa.io/get-pip.py && \
	python3 get-pip.py && \
	rm get-pip.py

RUN wget https://nvidia.box.com/shared/static/phqe92v26cbhqjohwtvxorrwnmrnfx1o.whl -O torch-1.3.0-cp36-cp36m-linux_aarch64.whl
RUN pip3 install numpy torch-1.3.0-cp36-cp36m-linux_aarch64.whl

After that if I do

docker build -t jetson-pytorch:latest .
docker run -it jetson-pytorch:latest bash

root@21592ebf82b0:/# python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/torch/__init__.py", line 81, in <module>
    from torch._C import *
ImportError: libnvToolsExt.so.1: cannot open shared object file: No such file or directory
>>> exit()
root@21592ebf82b0:/# exit
exit

Have a look here (solved it for me):

https://github.com/NVIDIA/nvidia-docker/issues/1033

Don’t forget to restart the docker daemon (or the complete device)