-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't Import cv2 after Jetson Update #41
Comments
Are you sure your JetPack version is 4.2 on NX, @ben-mcdonnell-hacksmith ? |
@mdegans the version I installed was r32.4.2. Is there something else I should check? |
Gotcha. That's JetPack 4.4. It's super confusing since the r32.xx versions do not align with the JetPack version. I am running a test build now on an NX of the same release. I will let you know if I hit the same error. |
So, I can't replicate. Here are my steps to a working install. My starting point is a more or less unmodified, fully-updated JetPack 4.4. To build and install, I did:
My output from
To verify import (and CUDA) works, i did:
It looks like the version you have build is not 4.4.0, rather 4.4.0-dev. Did you build from master? Since I first suggested that, 4.4.0 has been tagged for release, so the above command should be used. I will change the default version so only For your issue, I would suggest that if OpenCV is important to you, it might be easier to backup, reflash, fully update, and then start the script again. Alternatively you can retry with an umodified script and |
Okay, thanks! I figured the issue is with my system having an old version linked somewhere. I will try the 4.4 build tomorrow. maybe try to find the old version and unlink it. If all else fails I will rebuild the system. Thanks, I will report back as soon I have figured it out. |
So I removed the old OpenCV entirely, I installed using your script and cv 4.4. Still have the same import error, but when I run |
I suspect there may be another version of OpenCV installed in python path other than the one under the /usr/local prefix. Did you run Can you open a python3 interpreter and provide the results of this:
(you should see something slightly different) If you see a file/dir in If that still doesn't work, the only thing I can suggest is to backup, reflash, update, and retry |
This is what the output of that looks like
Does that look right? |
That looks right, @ben-mcdonnell-hacksmith Let's try something new.
If Also, Now that you've rebuilt |
That sadly didn't fix it. So something else is the issue. Apparently it is somewhat common to happen with python, so I am not too worried. But the output is: General configuration for OpenCV 4.4.0 ===================================== Extra modules: Platform: CPU/HW features: C/C++: OpenCV modules: GUI: Media I/O: Video I/O: Parallel framework: pthreads Trace: YES (with Intel ITT) Other third-party libraries: NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH) cuDNN: YES (ver 8.0) OpenCL: YES (no extra features) Python 2: Python 3: Python (for build): /usr/bin/python2.7 Java: Install to: /usr/local It still doesn't work... |
@ben-mcdonnell-hacksmith If you moved cv2 out of the python path and it still crashes when you do Can you cause a crash with If one of those fails, then that would be the root cause. If that's the case, can you the same code as above, just for numpy or scipy instead of cv2 like:
(that's not from Tegra, but your results should be similar). |
None of those throw errors. The cv error is probably related to an old version somewhere, but I can't find anything anywhere. I may try making a new image, but I do have a variety of other stuff installed and it would take a while to rebuild. And if this happens again I would like to figure out how to fix it. |
Oh, I'm pretty sure it can be fixed by reflashing, updating, and running the script again, but like you, I'd like to know what's causing this. Can you try this, only substituting
|
I have no idea how to interpret the output of this, but I think it could have something to do with the shared list library issue. $ gdb --args python3 -c "import cv2" GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "aarch64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from python3...(no debugging symbols found)...done. (gdb) (gdb) run Starting program: /usr/bin/python3 -c import\ cv2 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1". [New Thread 0x7fb6d541f0 (LWP 18223)] [New Thread 0x7fb55531f0 (LWP 18224)] [New Thread 0x7fb3d521f0 (LWP 18225)] [New Thread 0x7fb25511f0 (LWP 18226)] [New Thread 0x7fb0d501f0 (LWP 18227)] warning: Corrupted shared library list: 0xc3b390 != 0xd17d40 Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 96, in <module> bootstrap() File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 86, in bootstrap import cv2 ImportError: /usr/local/lib/libopencv_dnn.so.4.4: undefined symbol: cudnnGetConvolutionBackwardDataAlgorithm [Thread 0x7fb6d541f0 (LWP 18223) exited] [Thread 0x7fb55531f0 (LWP 18224) exited] [Thread 0x7fb25511f0 (LWP 18226) exited] [Thread 0x7fb0d501f0 (LWP 18227) exited] [Thread 0x7fb3d521f0 (LWP 18225) exited] [Inferior 1 (process 18220) exited with code 01] (gdb) bt 20 No stack. (gdb) |
Nevermind. I was thinking of another issue on a separate project with a core dump. Can you try a
That should give you something like:
|
I get an output from the ldconfig that appears to have some errors, but it doesn't fix the import issue: /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_adv_infer.so.8 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn.so.8 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_cnn_infer.so.8 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_ops_infer.so.8 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_adv_train.so.8 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn.so.7 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_cnn_train.so.8 is not a symbolic link /sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_ops_train.so.8 is not a symbolic link From the other command I get the output: |
Looks like there is somethign wrong with your cudnn install maybe? Try:
That shuould perform a full reinstall of cudnn8. Cv2 may just start working after that. I'd imagine if you are getting the above errors, other things that use cuDNN will also crash in the same way. |
So that didn't fix it, but the error still appears when running ldconfig, is there a way to manually uninstall cudnn and reinstall it? |
That would be the manual way :( At this point, I'm really not sure what's wrong. Although i'm pretty sure a reflash will fix it, as you say, I can't guarantee it won't happen again. One way to find out is maybe to build OpenCV first and keep applying your other changes, testing after each one to see what breaks cv2. If you can figure out what did it, that would be very helpful. I'll leave this issue open. |
@mdegans I made a new SD Card with a fresh install of JetPack, It did fix it as we figured. I still have the old card laying around in case I want to revisit it. But thanks for all your help! |
Sorry we couldn't figure it out. Hopefully (?) somebody else has this issue and reopens this. I don't much like these kinds of mysteries :) |
I am running an Xavier NX with Jetpack 4.2. After an OTA update cv2 won't import (before or after building with this script). To on my system I can build OpenCV running
![image](https://user-images.githubusercontent.com/68559799/87968591-aa53b200-ca8e-11ea-8d55-491599205e77.png)
sudo ./build_opencv.sh master
and trying to import cv2 in python 3.6.9My OpenCV build information is:
General configuration for OpenCV 4.4.0-dev =====================================
Version control: e65e23b
Extra modules:
Location (extra): /tmp/build_opencv/opencv_contrib/modules
Version control (extra): 4.4.0
Platform:
Timestamp: 2020-07-20T13:29:52Z
Host: Linux 4.9.140-tegra aarch64
CMake: 3.17.3
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline: NEON FP16
required: NEON
disabled: VFPV3
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 7.5.0)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed
Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed
ccache: NO
Precompiled headers: NO
Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
3rdparty dependencies:
OpenCV modules:
To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cnn_3dobj cvv hdf java js julia matlab ovis sfm ts viz
Applications: apps
Documentation: NO
Non-free algorithms: YES
GUI:
GTK+: YES (ver 3.22.30)
GThread : YES (ver 2.56.4)
GtkGlExt: NO
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
WEBP: build (ver encoder: 0x020f)
PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
JPEG 2000: build Jasper (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (57.107.100)
avformat: YES (57.83.100)
avutil: YES (55.78.100)
swscale: YES (4.8.100)
avresample: YES (3.7.0)
GStreamer: YES (1.14.5)
v4l/v4l2: YES (linux/videodev2.h)
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: YES (/usr/lib/aarch64-linux-gnu/liblapack.so /usr/lib/aarch64-linux-gnu/libcblas.so /usr/lib/aarch64-linux-gnu/libatlas.so)
Eigen: YES (ver 3.3.4)
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)
NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
NVIDIA GPU arch: 53 62 72
NVIDIA PTX archs:
cuDNN: YES (ver 8.0)
OpenCL: YES (no extra features)
Include path: /tmp/build_opencv/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.17)
Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python2.7/dist-packages/cv2/python-2.7
Python 3:
Interpreter: /usr/bin/python3 (ver 3.6.9)
Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python3.6/dist-packages/cv2/python-3.6
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: /usr/local
The text was updated successfully, but these errors were encountered: