It might be because @mdegans’script uses single job if not more than 5 cpus are available. This saves memory issues, but would make it slower for building, of course.
That’s the idea, yeah. I figure it has 6 cores or more it’s a Tegra model with enough memory to build in parallel. Otherwise it tends to fail towards the end of the build (at least with the gui enabled and without a swap file).
It’s a really fragile way of doing it tho. Since I wrote that the assumption is broken by at least the NX’s default configuration which ships with only 4 cores enabled by default. in the future I’ll probably just parse the output from
free or read from
/proc/meminfo. A PR accomplishing either would be welcome.
I would not blame that scheme at all. I think the faster way would be running 3 or 4 jobs in a loop until everything is built, but it should be fine for one night…most people don’t need to build opencv so frequently.
Hello, thank you for your build script for the nano. I ran the script overnight and I think it finished building, however is there a way to check if it built successfully? And is there any way you know how to get this built opencv to work with a virtual environment on the nano, i ran the script from inside the virtual environment but it still doesn’t find module cv2. Help would be super appreciated thank you!
currently in my /tmp/ folder i see a folder build-opencv, however I don’t know if it is supposed to be like that.
The github link leads to a 404 error. That project seems to no longer exist.
If you get a 404 for a GitHub link to a file, you can often find what you’re looking for it by chopping off parts of the url. If you’re interested in Aastanv’s build script, here you go. The link to my own script above should still work.
I did that but there wasn’t anything OpenCV related on that level.
– edit –
Strange, I could have sworn that I didn’t find anything when I looked at the higher directories.
Is there any difference between the final results of either of your and AastaNV scripts?
GitHub has been some problems recently. It could be when you checked there was an issue.
Re: script differences
Off the top of my head:
- optional packages and additional dependencies are installed/enabled by my script…
- Including the non-free stuff (SIFT and SURF are patent encumbered. This might not matter to you depending on your use and since many countries do not recognize software parents.).
- Mine is also designed to not be tolerant of any errors (fail fast). If configure fails, make is not run and if make fails install is not done. That’s a design choice and there’s no real right answer.
- Mine will update the system with apt-get update, for repeatability sake, so you might want to be aware of that if you’re interested in DeepStream, which runs on the DP release of 4.4 but not the GA (I have no idea why not. This is still an unsolved mystery.).
- It will not update 4.3 to 4.4, but if you use 4.3 you might want to comment out the cuDNN version line, since breaking changes to cuDNN were made just prior to the JetPack 4.4 release.
When you first run the scripts, you’ll see the configuration output and you can compare between the two versions to see the details.
Later, once it’s installed, you can check with
Hey thank you very much!! I had the same problem with Nvidia Xavier, the virtual env could not import OpenCV. I did the link and it works! I wasted 2 days on this problem.
@AastaLLL Is this CUDA enabled?
I create a virtual environment using miniconda in xavier nx and try to install opencv in the virtual environment using pip install opencv-python, but I get an error related to PEP 517.
I have built opencv in xavier nx using your script, is there any way to make it available in virtual environment?
Thank you very much!!!
Hi, I used this script and it finally finished but I still have problem. I used to have openCv 4.3 in my python 2.7 and 3.01 in my python 3.6, after installing completed it upgraded openCv version in python 2.7 but the openCv in python 3.6 remains same. How can I apply this script to my python3?
Mdegans script is cream, it install even opencv 3.4.6. I just miss an option to uninstall previous versions. Thanks!!
I got the same problem here:
after I run opencv_version --verbose
The following are what i got:
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
Interpreter: /usr/bin/python3 (ver 3.6.9)
numpy: NO (Python3 wrappers can not be generated)
install path: -