Hi there!
I just got a Jetson Nano, and flashed it by using the jetson-nano-jp451-sd-card-image file and Etcher.
I need to install MxNet and GluonCV, so I did the following:
ATTEMPT #1
I tried installing MXNet by using the compiled package, as described here
Installed dependencies
sudo apt-get install -y git build-essential libatlas-base-dev libopencv-dev graphviz python3-pip
and added:
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
to my .bashrc file (before that, I couldn’t use nvcc --version)
I saw that most of the instructions suggest installing stuff by using ‘sudo pip install…’, but I prefer to keep stuff in virtual environments, so I adapted the instructions accordingly.
I created a venv with
python3 -m venv gluon
source envs/gluon/bin/activate
I downloaded the wheel file: mxnet-1.6.0-py3-none-any.whl and ran
pip3 install cython
pip3 install mxnet-1.6.0-py3-none-any.whl
got the output:
Failed to build numpy
Installing collected packages: urllib3, chardet, certifi, idna, requests, numpy, mxnet
Running setup.py install for numpy ... done
I ran pip list, and I got:
certifi (2021.5.30)
chardet (4.0.0)
Cython (0.29.23)
graphviz (0.8.4)
idna (2.10)
mxnet (1.6.0)
numpy (1.19.5)
pip (9.0.1)
pkg-resources (0.0.0)
requests (2.25.1)
setuptools (39.0.1)
urllib3 (1.26.5)
So, mxnet is installed, but it seems it’s not version supporting the GPU (it should be something like mxnet-cu102)
When trying to import mxnet, moreover, I got the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/context.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/base.py", line 214, in <module>
_LIB = _load_lib()
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/base.py", line 204, in _load_lib
lib_path = libinfo.find_lib_path()
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/libinfo.py", line 74, in find_lib_path
'List of candidates:\n' + str('\n'.join(dll_path)))
RuntimeError: Cannot find the MXNet library.
List of candidates:
/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/libmxnet.so
/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/../../lib/libmxnet.so
/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/../../build/libmxnet.so
../../../libmxnet.so
Turned out that the file libmxnet.so was created, but in this other folder:
/home/lews/envs/gluon/mxnet
I added
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lews/envs/gluon/mxnet
to my to my .bashrc file, and now whenever I open a terminal session it shows the error:
bash: ::/home/lews/envs/gluon/mxnet: No such file or directory
However, in spite of the message it seems to be finding the file, because now I’m getting another error when importing mxnet:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/context.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/base.py", line 214, in <module>
_LIB = _load_lib()
File "/home/lews/envs/gluon/lib/python3.6/site-packages/mxnet/base.py", line 205, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libcudart.so.10.0: cannot open shared object file: No such file or directory
It seems to be looking for CUDA 10.0, while I have 10.2:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_21:14:42_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
PS: I tried all the steps described in the post even WITHOUT using a virtual environment, and I’m having the same issues.
ATTEMPT #2
This time, I tried building from source, following this procedure.
I didn’t flash the SD card clean yet (I’ll try to do that and to start Attempt #2 from scratch), but I’m having two issues with this method as well:
- When building directly on the Nano, it’s painfully slow. I saw you can cross-compile it on a PC and…somehow transfer the compiled library to the Nano? But I didn’t find any tutorial for that.
- I’m getting the following error:
In file included from src/io/image_aug_default.cc:31:0:
src/io/./image_augmenter.h:31:10: fatal error: opencv2/opencv.hpp: No such file or directory
#include <opencv2/opencv.hpp>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:461: recipe for target 'build/src/io/image_aug_default.o' failed
make: *** [build/src/io/image_aug_default.o] Error 1
make: *** Waiting for unfinished jobs....