Unable to set up detectron2 on Jetson NX

Hi

I’m thinking of using Detectron 2 with Jetson NX.
However, I get an error during the installation.

(environment)
Jetpack 4.4
CUDA 10.2
cuDNN 8.0
Python 3.6.9
Pytorch 1.5
torchvision 0.2.2.post3

(Execution command)
python3 -m pip install ‘git+https://github.com/facebookresearch/detectron2.git’

Defaulting to user installation because normal site-packages is not writeable Collecting git+https://github.com/facebookresearch/detectron2.git Cloning https://github.com/facebookresearch/detectron2.git to /tmp/pip-req-build-2knyo1_1 ERROR: Command errored out with exit status -11: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-2knyo1_1/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-2knyo1_1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-7yagxbxv cwd: /tmp/pip-req-build-2knyo1_1/ Complete output (0 lines): ---------------------------------------- ERROR: Command errored out with exit status -11: python setup.py egg_info Check the logs for full command output.

Do you know the cause?

1 Like

Hi,

We can build detectron2 with the following command.
Could you give it a try?

$ sudo apt-get install libjpeg-dev zlib1g-dev
$ git clone https://github.com/facebookresearch/detectron2.git
$ python3 -m pip install -e detectron2

Thanks.

2 Likes

Hi

Thank you for your reply.

I ran them in order.
However, an error occurred while executing the last line.
By the way, I’m using pip-20.3.3.

python3 -m pip install -e detectron2

ERROR: Command errored out with exit status -11:
 command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jetson/Desktop/detectron2/setup.py'"'"'; __file__='"'"'/home/jetson/Desktop/detectron2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zg8yg74a
     cwd: /home/jetson/Desktop/detectron2/
Complete output (0 lines):
----------------------------------------

ERROR: Command errored out with exit status -11: python setup.py egg_info Check the logs for full command output.

what is the reason.

Hi,

Just confirm we can install it without issue.
Could you follow our steps and try it again?

1. Reflash your device with JetPack4.4.1

2. Install PyTorch v1.7.0 from the instruction below:

3. Install Detectron2
Please see the instruction shared on Jan 8.

$ python3 -m pip install -e detectron2
Obtaining file:///home/nvidia/detectron2
Collecting Pillow>=7.1 (from detectron2==0.3)
...
Successfully built fvcore iopath matplotlib pycocotools termcolor pyyaml kiwisolver grpcio
Installing collected packages: Pillow, cloudpickle, future, portalocker, tqdm, iopath, numpy, pyyaml, tabulate, termcolor, yacs, fvcore, six, cycler, kiwisolver, pyparsing, python-dateutil, matplotlib, cython, setuptools, pycocotools, pydot, grpcio, tensorboard-plugin-wit, idna, urllib3, certifi, chardet, requests, oauthlib, requests-oauthlib, pyasn1, rsa, pyasn1-modules, cachetools, google-auth, google-auth-oauthlib, absl-py, protobuf, werkzeug, wheel, zipp, typing-extensions, importlib-metadata, markdown, tensorboard, detectron2
  Running setup.py develop for detectron2
Successfully installed Pillow-8.1.0 absl-py-0.11.0 cachetools-4.2.0 certifi-2020.12.5 chardet-4.0.0 cloudpickle-1.6.0 cycler-0.10.0 cython-0.29.21 detectron2 future-0.18.2 fvcore-0.1.2.post20210112 google-auth-1.24.0 google-auth-oauthlib-0.4.2 grpcio-1.34.0 idna-2.10 importlib-metadata-3.4.0 iopath-0.1.2 kiwisolver-1.3.1 markdown-3.3.3 matplotlib-3.3.3 numpy-1.19.5 oauthlib-3.1.0 portalocker-2.0.0 protobuf-3.14.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycocotools-2.0.2 pydot-1.4.1 pyparsing-2.4.7 python-dateutil-2.8.1 pyyaml-5.3.1 requests-2.25.1 requests-oauthlib-1.3.0 rsa-4.7 setuptools-51.1.2 six-1.15.0 tabulate-0.8.7 tensorboard-2.4.0 tensorboard-plugin-wit-1.7.0 termcolor-1.1.0 tqdm-4.56.0 typing-extensions-3.7.4.3 urllib3-1.26.2 werkzeug-1.0.1 wheel-0.36.2 yacs-0.1.8 zipp-3.4.0

Thanks.

Hi

Unused I re-set up and installed using the new Jetson NX and MicroSD (32GB).
(Unused item purchased as a spare)
However, I get an error when installing Detectron2.

Here are the steps I took:

①, Jetson NX initial settings
I flashed Jetpack 4.4.1 to MicroSD.
The procedure was performed with reference to the following.(Windows steps)
https://developer.nvidia.com/embedded/learn/get-started-jetson-xavier-nx-devkit#prepare
As a result, Jetson NX has started.

②、apt upgrade
I updated the package by following the steps below.
$ sudo apt update
$ sudo apt upgrade

③, install Pytorch 1.7
I installed Pytorch by referring to the following Pytorch description.
Jetson Zoo - eLinux.org

The specific command is:
$ sudo apt-get install python3-pip
$ pip3 install Cython
$ pip3 install numpy torch-1.7.0-cp36-cp36m-linux_aarch64.whl

④, installation of Detectron 2
With reference to the previous answer, I ran the command as follows:
But the last command gives an error.

$ sudo apt-get install libjpeg-dev zlib1g-dev
$ git clone GitHub - facebookresearch/detectron2: Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
$ python3 -m pip install -e detectron2

Obtaining file:///home/jetson/Desktop/detectron2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “/home/jetson/Desktop/detectron2/setup.py”, line 10, in
import torch
File “/home/jetson/.local/lib/python3.6/site-packages/torch/init.py”, line 189, in
_load_global_deps()
File “/home/jetson/.local/lib/python3.6/site-packages/torch/init.py”, line 142, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File “/usr/lib/python3.6/ctypes/init.py”, line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: libmpi_cxx.so.20: cannot open shared object file: No such file or directory

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /home/jetson/Desktop/detectron2/

what is the reason?
Are there any fatal mistakes?

Hi,

The error indicates a missing library.
Please install it with the following command and try it again.

$ sudo apt-get install libopenmpi2

Thanks.

1 Like