I've built OpenCV 4.5.5 on Windows with Cmake / VS19. I did PATH and copy&paste .pyd file as well. Now I am getting the Fatal Python error, I have no clue what is the problem.
Fatal Python error: _PyInterpreterState_GET: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)
Python runtime state: unknown
The reason I built opencv myself was to use some library I wanted to use which requires the Nonfree OpenCV module. So I removed the OpenCV package which I installed by pip install opencv-python. Then I followed Cmake build instructions with OpenCV/OpenCV-contrib source. Is there any possibility that I installed the OpenCV module before?
I've tried to modify / repair Python but no luck. When I import other library (for example : Numpy) it works fine. Any suggestions?
Related
i tried many solutions for that error but didn't solved
ImportError: DLL load failed while importing cv2: The specified module could not be found.
Make sure you have installed right versions. Follow the below link for the compatible versions installed.
https://www.tensorflow.org/install/source_windows#gpu
https://www.drdataking.com/post/install-gpu-support-to-tensoflow-on-windows/
I was too getting similar issue:
DLL load failed while importing _multiarray_umath: The specified module could not be foundDLL load failed while importing _multiarray_umath: The specified module could not be found
Solution was the environment variable path was not set properly. Please find the image below:
Solution
in python 3.8 i fixed a similar error when compiling with cxfreeze cv2 dll load failed ,
the problem was that i had another version of python 3.6 installed and although environment variable path from python 3.8 was first, cxfreeze still loaded opencv from python 3.6 causing the error in the output file,
I fixed it by moving python 3.6 to another location so not get detected by cxfreeze, be careful with the environments variable path if you have other versions of python installed when compiling.
try miniconda with Python 3.6 is more stable ,
https://repo.continuum.io/miniconda/
Miniconda3-4.5.4 was the last Python 3.6 miniconda package.
Try to Install other versión of opencv
pip install opencv-contrib-python
Install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
Install media feature pack only if you use win10
https://www.microsoft.com/en-us/software-download/mediafeaturepack
this article may interest you
DLL load failed error when importing cv2
I am trying to install OpenCV 4.5.5 with CUDA support. I installed the source from their GitHub and the additional OpenCV contrib and built it with CMAKE. I checked BUILD_opencv_python3 when it was done configuring and generating it showed that it had detected python3 and had installed cv2 in site-packages.
But cv2 isn't in the site-packages.
So it doesn't load in python. But it does give an interesting error
What should I do?
I already tried doing a fresh build with CMAKE but it didn't work.
After building OpenCV it generates a PYD file in the lib folder. I don't know if that is helpful or not.
Thanks
You must have missed a step in the process.
"Configure" step in cmake-gui, investigates the environment (various paths, e.g. where python wants packages to go) and prepares information for the build
"Generate" step in cmake-gui, generates the actual build files (VS Solution)
open the .sln in Visual Studio
build the ALL_BUILD target
build the INSTALL target, and this installs the files, also the python package
I was trying to install opencv for python using this link. After running the Cmake command, it exited with errors stating C++11 is not supported Although I have Xcode installed. I Also tried forcing Cmake to use C++ 11 using $ set(CMAKE_CXX_STANDARD 11) (because my Cmake version is 3.10.2), but I got this error:
syntax error near unexpected token `CMAKE_CXX_STANDARD'
Moreover, I tried installing gcc to check if my system supports the C++ 11 compiler through this link, where again I ran into terminal errors stating ./fixincludes: No such file or directory after running $ make install . What should I do?
Adrian has a more recent blog post on compiling OpenCV for the macOS. The instructions work both for 3.3.0 and 3.3.1.
First open python by python2 or python3 command in terminal after type import cv2 and everything is right now.
I was running python3.6 (32 bit) with opencv3.3.1.
I saw this tutorial so I was trying out the brute force matching with SIFT descriptors: http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_feature2d/py_matcher/py_matcher.html
I read that some modules including SIFT were no longer included in the default installation and needed to be installed separately. I found on the official python website a download for opencv3 with the contrib modules (which I assumed contains SIFT). Specifically I downloaded opencv_contrib_python-3.3.0.10-cp36-cp36m-win32.whl (md5) from here: https://pypi.python.org/pypi/opencv-contrib-python#downloads
I have uninstalled my previous opencv and installed and imported this new version of opencv and verified that I am running the new version.
However, still when I try to use cv2.SIFT() I am still getting the error that module cv2.cv2 has no attribute 'SIFT'.
Did I download the correct package? Are all opencv modules including SIFT supposed to be included in the package I installed?
For enabling opencv-contrib modules, you have to rebuild your opencv lib from source. In CMake config, you have to enable it, specifying variable OPENCV_EXTRA_MODULES_PATH with path where you have opencv_contrib modules such as ...wherever_you_downloaded_it/opencv_contrib/opencv_contrib-master/modules.
Then, building opencv with make will build modules, and make install will install these libs with other opencv libs.
Problem
I am trying to install both plotly and cufflinks. However I had a problem.
The installation of both plotly and cufflinks were successful. Although, I can't import cufflinks.
Below is a picture of the problem. It seems to be a dependency error:
I tried manually downloading and installing "talib" but I keep getting failures. (Shown below).
talib\common.c(240): fatal error C1083: Cannot open include file: 'ta_libc.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Any Ideas? I tried re-installing both modules and Anaconda. Nothing So far.
Other infos:
Cufflinks version: 0.11.0
Plotly version: 2.0.10
Anaconda version: 3-4.4.0 (But I don't think it have anything to do with it)
Python version: 3.6.1
try installing this version of cufflinks, it eliminated the error for me.
pip install cufflinks==0.8.2
From this link: github.com/mrjbq7/ta-lib#troubleshooting
Troubleshooting
Sometimes installation will produce build errors like this:
func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory
compilation terminated.
This typically means that it can't find the underlying TA-Lib library, a dependency which needs to be installed. On Windows, this could be caused by installing the 32-bit binary distribution of the underlying TA-Lib library, but trying to use it with 64-bit Python.
Windows
Download ta-lib-0.4.0-msvc.zip and unzip to C:\ta-lib
This is a 32-bit release. If you want to use 64-bit Python, you will need to build a 64-bit version of the library.
My Fix
So, for windows, we need a 64-bit version of the library? Luckly I found a lot of modules built for 32 and 64 bits python:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
search for "ta-lib" and click on the module you need (In my case cp36 64 bits).
Then, open the command prompt.
Change to where you downloaded the file: cd path/to/file
Type: pip install NameOfFile (in my case pip install TA_Lib‑0.4.10‑cp36‑cp36m‑win_amd64.whl )
Now the 64-bits Ta-Lib module should be installed in your machine. I tested the previous line of codes and it worked!
Thanks for the help :)
I have now removed all dependencies on talib. All studies are pure python based now and you should not face any of this errors.