Unable to import opencv with python3

I flashed the Jetson Nano image into an SD card and booted my nano for the first time. With python 2, I am able to import cv2, but with python3, the command import cv2 gives the following error:

ImportError: numpy.core.multiarray failed to import.

I have not connected the nano to the network or updated any packages, so it seems that this problem is present in the SD image itself. How should I solve this?

Installing tensorflow fixed the problem.

Hi @jaiyamsharma How did you installed tensorflow and dont you think tensorflow should come pre installed in jetson os image.? Thanks

Hi @jaiyamsharma, I have installed tensorflow-gpu as https://docs.nvidia.com/deeplearning/dgx/install-tf-xavier/index.html. But when I import cv2 in python3:

(tensorflow-gpu) alex@alex-jetson-nano:~$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import cv2
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘cv2’

I have solved it:

sudo apt-get install python3-opencv

I am not sure why you needed to install opencv. I don’t recall having to install it manually. Also, I installed tensorflow with the official wheel file for jetson naon posted on these forums, not using generic instructions. I think the default installation of opencv comes compiled with CUDA and such for better performance. I am not sure if the aarch64 installation via apt is compiled with CUDA.

That is odd. I just flashed a new image last night and OpenCV 3.3.1 is installed after all the updates.

I would imagine so. They claim to in their documentation.

I haven’t specifically tested with the apt package version of OpenCV, but you can find that out for sure from a python3 interpreter by doing:

>>> import cv2
>>> print(cv2.getBuildInformation())

I’m concerned that this fixed the error but installed non-GPU versions?

Either way, installing tensorflow will also fix it ( https://devtalk.nvidia.com/default/topic/1048776/jetson-nano/official-tensorflow-for-jetson-nano-/ ) as it installs a new numpy