Skip to content
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

OpenCV bindings for Python 3 not installed #55

Open
laclouis5 opened this issue May 20, 2021 · 6 comments
Open

OpenCV bindings for Python 3 not installed #55

laclouis5 opened this issue May 20, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@laclouis5
Copy link

laclouis5 commented May 20, 2021

I installed OpenCV 4.5.2 via this script on a fresh Jetson Nano and checked the installation with the procedure described in this issue. This was working properly, Cuda was enabled and OpenCV version was 4.5.2 both using command opencv_version and in a Python 3 interpreter.

However, I restarted the Jetson Nano and now in a Python 3 interpreter I got version 4.1.1. If I open an interpreter in sudo mode it still shows version 4.5.2.

Do you know the cause of this issue? However, solving the issue does not seem hard, I guess that copying the system Python cv2 shared library to the local Python dist-package folder should do the trick.

@laclouis5
Copy link
Author

Ok, this did the trick:

sudo cp /usr/local/lib/python3.6/dist-packages/cv2/python-3.6/*.so /usr/lib/python3.6/dist-packages/cv2/python-3.6/

@mdegans
Copy link
Owner

mdegans commented May 20, 2021

Thanks for spotting this. I'd consider it still an open issue. Looks like it might be a good idea to purge any existing opencv before installing since it'll likely use the old version.

@mdegans mdegans reopened this May 20, 2021
@mdegans mdegans self-assigned this May 20, 2021
@mdegans mdegans added the bug Something isn't working label May 20, 2021
@mdegans
Copy link
Owner

mdegans commented May 20, 2021

Jsut a fyi, to anybody experiencing this, the above fix will work, but removing these apt package will also do the trick and possibly avoid other issues:

libopencv          libopencv-dev      libopencv-python   libopencv-samples

so sudo apt purge or sudo apt remove those and you should be fine.

@Randy37773
Copy link

unfortunately this does not the trick for me.
build_opencv.sh runs without errors (4.4 and 4.5.5), but cuda-support is only available in python2.7 not in python3.6.

sudo cp /usr/local/lib/python3.6/dist-packages/cv2/python-3.6/*.so /usr/lib/python3.6/dist-packages/cv2/python-3.6/

@tsubasa9647
Copy link

@Randy37773
I was able to resolve the issue by running the script below.
sudo cp /usr/local/lib/python3.6/site-packages/cv2/python-3.8/*.so /usr/lib/python3.8/dist-packages/cv2/python-3.8/

@IraeMare
Copy link

IraeMare commented Sep 19, 2023

Solve it for me:
ln -s /usr/local/lib/python3.6/site-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so cv2.so

UPD:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants