How to repair the dusty nv jetson-inference training?

Hi, the dusty nv inference was working fine until I install python 3.9 and other stuff… :<
I tried to rebuild it but it still give me this error, may I know how to repair it? Thx

nvidia@nvidia-desktop:~/jetson-inference/python/training/detection/ssd$ python3 --dataset-type=voc --data=data/$NET --model-dir=models/$NET
Traceback (most recent call last):
  File "", line 16, in <module>
    from vision.ssd.vgg_ssd import create_vgg_ssd
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/ssd/", line 6, in <module>
    from .predictor import Predictor
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/ssd/", line 4, in <module>
    from .data_preprocessing import PredictionTransform
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/ssd/", line 1, in <module>
    from ..transforms.transforms import *
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/transforms/", line 5, in <module>
    from torchvision import transforms
  File "/usr/local/lib/python3.6/dist-packages/torchvision/", line 6, in <module>
    from torchvision import models
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/", line 8, in <module>
    from .mobilenet import *
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/", line 1, in <module>
    from .mobilenetv2 import MobileNetV2, mobilenet_v2, __all__ as mv2_all
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/", line 8, in <module>
    from ..ops.misc import ConvNormActivation
  File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/", line 12, in <module>
    from .stochastic_depth import stochastic_depth, StochasticDepth
  File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/", line 2, in <module>
    import torch.fx
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/fx/", line 85, in <module>
    from .graph_module import GraphModule
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/fx/", line 3, in <module>
    import torch.overrides
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/", line 31, in <module>
    from torch._C import (
ImportError: cannot import name '_has_torch_function'

Hi @AK51, can you run with python3.6? You might want to verify you can still run the jetson-inference container, which should include a working PyTorch environment for you to run the training in.

Hi Dusty,

Yes, if I use container method, I can train the model and get the onnx file.
I have removed the python 3.9 and tried to uninstall/reinstall the torch, is it possible to repair my python and torch?

Are your python3 and pip3 now showing as python3.6?

$ python3 --version
Python 3.6.9

$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

You should be able to install the PyTorch wheel again. If you continue having problems with your environment, it may be easier to just backup your work and reflash your SD card to start with a clean slate.

Dear Dusty,

I ended up copying my files to a new SD card. Tired of fixing it…

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