I recently upgraded to python 3 using Anaconda and found there is a problem when trying to load bigtiff files.
ERROR 4: This is a BigTIFF file. BigTIFF is not supported by this version of GDAL and libtiff.
Below is the code that generates the error:
gdalobj = gdal.Open(path\to\bigtiff\file)
Opening small tif files works. I'm using Windows 10, 64 bit, python 3.7.4, gdal 2.3.3, libtiff 4.0.10. I have tried upgrading gdal using conda, conda-forge, and pip as suggested by previous posts with similar problems. Either nothing changes or errors occur during the upgrade. Any suggestions? Thanks in advance for your help.
Have you tried using a newer version of gdal from conda or conda-forge? Like 2.4.1 or 3.0.4?
If that doesn't work you can try installing a .whl file from this page (where it is already built, unlike pip):
https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
This page doesn't have 2.3.3 butit has 2.4.1 instead, make sure to install the amd64 version if you have a 64bit SO (Windows Key + Pause to check).
Install it from inside your enviroment using this command:
pip install C:/dir/to/file/location/gdal-2.4.1.whl
Thanks to Parrawk's suggestions, I created a new conda environment that uses python 3.7.6 (the default installation with Anaconda3 was 3.7.4). From within this env, I ran conda install gdal, which installed gdal 3.0.2. After a few additional installations (matplotlib, statsmodels, etc.) my code worked as expected!
How to install opencv with python 3.6 and anaconda 3.6?
I tried conda install -c https://conda.binstar.org/menpo opencv3
but i get the following error:
UnsatisfiableError: The following specifications were found to be in conflict:
- opencv3 -> python 2.7*
- python 3.6*
Use "conda info <package>" to see the dependencies for each package.
I am using Windows 10 64-bit, with python 3.6, and anaconda 3.6 installed.
Is it even available for python3.6 at the moment or should i rollback my python version to 3.5.*?
search anaconda prompt
open and run the command.
> pip install opencv-python
this single command help's you to install opencv easily.
you can take help from the video link below.
video link
From menpo file page, it shows that the OpenCV 3.2 binary there are only for Python 2.7/3.4/3.5 and on linux-64 platform
You may go to the this site to get the exact version you need.
opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl is the basic one.
opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl is the one
with opencv-contrib modules such as the text module for binding to tesseract OCR engine and many others.
Both binary are for OpenCV 3.2 with Python 3.6 binding for Windows 64-bit. To install it, 1) download the binary to local drive, 2) open your Anaconda command prompt and 3) type the command below in the directory the binary locates.
pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl
Hope this help.
Update on 2018-02-22:
OpenCV 3.4.0 wheel files are now available in the unofficial site and replaced OpenCV 3.3.0
Update on 2019-01-30:
OpenCV 4.0.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.
I managed to get it working by doing the following:
Download and install python3.6 from official python site
https://www.python.org/downloads/release/python-360/
Download and install Anaconda 4.4.0 from the official anaconda site
https://www.continuum.io/downloads
Open command line and run:
pip install opencv-python
Open command line and run:
pip install opencv-contrib-python
I am using Windows 10 and it worked for me.
It's pretty simple..
Install Anaconda 3.6. Check anaconda is added to System Variable Path.
Open CMD and type conda install -c conda-forge opencv.
This will install latest OpenCV version available (3.6).
Open IDE editor and try import cv2.
It will probably don't work...don't worry.
You have to add cv2 command to editor.
For Eclipse (with PyDev):
Create firs a project and then do the following:
For PyCharm:
cv2 module probably won't work. Go to the Anaconda folder/Lib/site-packages/cv2 and copy the file cv2.cp36-win_amd64.pyd to the site-packages folder. Rename it cv2.pyd
Now try to write a command... cv2.imread(). If auto-completition don't work, try cv2.cv2.imread().
This will work for sure.
I am using Python 3.6.2 and Anaconda 4.3.23 (It should also work with your case).
I did the following:
Download the Numpy version corresponding to your Python installation from here. In my case, I’ve used numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl
Download the OpenCV version corresponding to your Python installation from here. In my case, I’ve used opencv_python-3.3.0-cp36-cp36m-win_amd64.whl
Now go to the folder where you downloaded these files and run the following:
pip install numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl
pip install opencv_python-3.3.0-cp36-cp36m-win_amd64.whl
Note the Successfully installed … message after each command.
At this point, you should be able to play with OpenCV and Python. Let’s try a small test first. Start the Python interpreter or Jupyter Notebook and write:
import cv2
print(cv2.__version__)
If everything was correctly installed, you should see the version number of your OpenCV install, in my case this was 3.3.0.
I see you found a solution but this may be helpful for others. The package is not available for Python 3.6. You can check this by going to that package channel on anaconda.org and selecting the files tab. You will see the package tarballs with the Python version listed as py27, py34, py35,etc. This is a good way to check for Python versions of a specific package.
You can also run the following to see the package versions and Python versions available for your OS from the Anaconda channel:
conda search <package_name>
Or to search a particular channel and package you can do this:
conda search -c <channel_name> <package_name>
As of March 2018, OpenCV 3.4 can be installed directly from conda-forge or anaconda in Windows/OSX/Linux for Python 3.6
conda install -c conda-forge opencv
or
conda install -c anaconda opencv
Using:
conda install -c conda-forge opencv
worked for me
If you have installed anaconda then you should uninstall it, then try
pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl
It worked for me.
Thank You.
I am using python 3.6 and the following worked for me:
Download and install opencv (Win pack) on your computer from the official website:
https://opencv.org/releases.html (I took version 3.4.2)
Go to the website of Christoph Gohlke and download the wheel file corresponding to your system. (I took opencv_python-3.4.2-cp36-cp36m-win_amd64.whl)
As mentioned on the website of Christoph Gohlke, make sure you installed 'numpy1.14' & 'mkl' package. Also make sure you use pip with version 9 or newer.
Start the 'Anaconda Prompt'
Change the directory in the 'Anaconda Prompt' to the folder where you downloaded the wheel file from Gohlke's website (via the MS-DOS command 'cd').
In the 'Anaconda Prompt' type 'pip install opencv_python-3.4.2-cp36-cp36m-win_amd64.whl') (change the name of the wheel file accordingly).
When starting spyder, test your installation as follows:
import cv2
print(cv2.__version__)
If the version is printed in the console (in my case 3.4.2), your installation was successful.
IMPORTANT REMARK:
If you created a dedicated environment within Anaconda (in my case 'py36'), make sure you installed spyder for this dedicated environment ('conda install spyder'). If not, your installation of opencv will not be recognised within the environment you are working in. Maybe this is obvious and straightforward but in my case I struggled to find this solution.
First Download Anaconda Python 3.6 from official site. After installing anaconda, simply open command prompt and type following statement and press enter of course -
conda install -c conda-forge opencv
It may take some time. After the completion, check your conda packages by typing conda list - opencv should be there.
However, Before proceed to install opencv, you can check whether opencv for python 3.6 is available or not. We can check it by typing conda info opencv in command prompt and press enter of course, you'll see following -
opencv 3.3.1 py36h20b85fd_1
---------------------------
file name : opencv-3.3.1-py36h20b85fd_1.tar.bz2
name : opencv
version : 3.3.1
build string: py36h20b85fd_1
build number: 1
channel : https://repo.anaconda.com/pkgs/main/win-64
size : 96.7 MB
arch : None
constrains : ()
license : BSD 3-clause
license_family: BSD
md5 : e65c68524073445511ace8ade7ae3641
platform : None
subdir : win-64
timestamp : 1512689066576
url : https://repo.anaconda.com/pkgs/main/win-64/opencv-3.3.1-py36h20b85fd_1.tar.bz2
dependencies:
jpeg >=9b,<10a
libpng >=1.6.32,<1.7.0a0
libtiff >=4.0.9,<5.0a0
numpy >=1.11.3,<2.0a0
python >=3.6,<3.7.0a0
vc 14.*
zlib >=1.2.11,<1.3.0a0
By this we can also get ensure that opencv 3.3.1 py36h20b85fd_1 is available. And this is available for python 3.6
I think this way is straight forward. Just install anaconda from official page and follow the image.
Using Anaconda3's package manager directly will be more reliable and cross-platform:
conda install opencv
I have installed opencv on my windows machine using python 3.6 without any issues, using:
pip install opencv-python
but when I try to import cv2 I get the following error
ImportError: DLL load failed: The specified module could not be found.
I have seen this post
It says cv2 doesn't work with python 3 I was wondering if this has been fixed or if there is a way around it
I took a lot of time to solve this error!
Run command
pip install opencv-contrib-python
You can download the latest OpenCV 3.2.0 for Python 3.6 on Windows 32-bit or 64-bit machine, look for file starts withopencv_python‑3.2.0‑cp36‑cp36m, from this unofficial site. Then type below command to install it:
pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl (32-bit version)
pip install opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl (64-bit version)
I think it would be easier.
Update on 2017-09-15:
OpenCV 3.3.0 wheel files are now available in the unofficial site and replaced OpenCV 3.2.0.
Update on 2018-02-15:
OpenCV 3.4.0 wheel files are now available in the unofficial site and replaced OpenCV 3.3.0.
Update on 2018-06-19:
OpenCV 3.4.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support, and replaced OpenCV 3.4.0.
Update on 2018-10-03:
OpenCV 3.4.3 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support, and replaced OpenCV 3.4.1.
Update on 2019-01-30:
OpenCV 4.0.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.
Update on 2019-06-10:
OpenCV 3.4.6 and OpenCV 4.1.0 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.
Update on 2023-02-11:
OpenCV 4.5.5 wheel files are now available in the unofficial site with CPython 3.7/3.8/3.9/3.10/3.11 support.
If you are using Anaconda with python 3.5, this is a problem in the Anaconda release. (Refer this issue)
You can fix this issue by copying python3.dll file to Anaconda3 folder (where python.exe is located)
How to get "python3.dll"
In cmd, type python --version to find whether your installation is 64-bit or 32-bit
download python 3.x embeddable zip file from here
Extract the zip file and copy python3.dll file to Anaconda3 folder
But if you can move to Anaconda with python 3.6 you will not face this issue. If it is possible for you, then it is the recommended way..
Recently I have faced the similar issue in Azure Windows Server 2012 r2 . Tried all option with and without Anaconda but none of them helped. After lot of findings I found that mfplat.dll was missing which is related to Window Media Service.
Hence you have to manually install the features so that you can get dll related to window media service.
1.Turn windows features on or off
2.Skip the roles screen and directly go to Feature screen
3.Select "Desktop Experience" under "User Interfaces and Infrastructure"
After this all required dll of media services for opencv would be available.
So if you are planning to run your code in cloud(Window Server) then please dont forget to select Desktop Experience feature.
I ran into this problem on Windows 10 (N) with a new Anaconda installation based on Python 3.7 (OpenCV version 4.0). None of the above advice helped (such as installing OpenCV from the unofficial site nor installing VC Redistributable).
I checked DLL dependencies of ...\AppData\Local\conda\conda\envs\foo\Lib\site-packages\cv2\cv2.cp37-win_amd64.pyd using dumpbin.exe according to this github issue. I noticed a library MF.dll, which I figured out belongs to Windows Media Foundation.
So I installed Media Feature Pack for N versions of Windows 10 and voilà, the issue was resolved!
After spending too much time on this issue and trying out all different answers, here is what found:
The accepted answer by #thewaywewere is no longer applicable. I think this was applicable when opencv-python module still wasn't available.
This is indeed a bug in Anaconda 4.2 because they forgot to ship python3.dll. They have fixed this in next releases but unfortunately 4.2 is the last release with Python 3.5 as default. If you are stuck with Python 3.5 (for example VS2015 is only aware of versions up to 3.5) then you must manually download python3.dll as described in answer by #Ramesh-X.
If you can move on to Python 3.6 (which at present bit difficult if you are using OpenCV and VS2015) then just install latest Anaconda version and you don't have to deal with any of these.
There are many questions on that and many suggestions. None of them helped me for the recent Opencv 3.4.16 and Python 3.6/3.7.
Finally I switched to Pyhon 2.7.15 and installed opencv 3.1.0. The DLL-problem was solved.
When I look in cv2.pyd with dependency walker, the 3.1 has no dependency to one missing dll. Opencv 3.4 has this missing dependency to this dll:
API-MS-WIN-DOWNLEVEL-SHLWAPI-L1-1-0.DLL
may be this is the problem.
P.S.: I have Win7 pofessional 64Bit, 32Bit Python 2.7.15
Frankly there are a lot of very smart and complicated answers here. Mine is dumb and simple. I deleted my conda environment, re-installed from scratch, taking pains to install opencv first. This fixed my problems. Environments are meant to be temporary and diaphanous -- don't get too attached.
So if my environment was called fubar first make sure every instance is deactivated (including any IDEs that are using it). Then remove it:
conda remove --name fubar --all
Now I simply recreate my environment and add opencv first:
conda create --name fubar
conda activate fubar
conda install opencv
And then go from there. First open python and make sure import cv2 works. Then you should be on your way. Note I always (always) install Spyder last as it tends to screw things up when I don't.
Note, if that doesn't work, we have had some cases where people have to uninstall and reinstall Anaconda, and then things worked. Obviously a last resort.
In my case a major update of Windows 10 removed some Windows packages, so other methods (reinstalling opencv etc.) did not help. To fix it, install:
a) Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019
b) Media Feature Pack for N versions - needed only if you have Windows 10 N
Both need restart of PC.
I had the same issue when installing opencv 2.4.13 on Anaconda3 (Python 3.6)... I managed to fix this issue by reverting to Anaconda2 (Python 2.7)
this happens because the compiler or the interpreter is finding more than one package of the file, delete all the number of same package you have and then keep only one and then try to install. It serves
The issue is due to the missing python3.dll file in Anaconda3.
To fix the issue, you should simply copy the python3.dll to C:\Program Files\Anaconda3 (or wherever your Anaconda3 is installed).
You can get the python3.dll by downloading the binaries provided at the bottom of the Python's Release page and extracting the python3.dll from the ZIP file.
I had the same issue with python 3.6(Anaconda3) and OpenCV 3.4.1 for spyder to work. Even after copying cv2.pyd into Anaconda3 Users/home/Anaconda3/Lib/site-packages, it didn't work.
But found a solution
Later I installed OpenCV and Dlib on Anaconda and copied the generated cv2.cp36-win_amd64.pyd and dlib.cp36-win_amd64.pyd into Anaconda3 Users/home/Anaconda3/Lib/site-packages. These can be copied from environment folder C:\Users\home\Anaconda3\envs\opencv\Lib\site-packages.
Finally spyder started to work
I managed to get it to work by installing python 3.9.12 in a new environment (using conda), and then installing opencv in that environment. Because of my python version, opencv version 4.5.5 was installed instead of version 4.60.
(I had already updated VC2015-2022 and added the python3.dll to PATH; neither of these worked.)
I have the same problem. when I install WinPython programming, and run opencv after copy the cv2.pyd file from my opencv directory, it will be like this: C:\Users.....\Downloads\opencv\build\python\2.7\x64, x64 or x86 is depend on your 32 or 64 bit devices. and paste to C:\Users.....\Downloads\WinPython-64bit-3.5.4.1Qt5\python-3.5.4.amd64\Lib\site-packages, I prefer the previous python 3.5 than 3.6. Because when I "import cv2" installed (python 3.6) it shows directly: "ImportError: DLL load failed: The specified module could not be found"
Then I install python 3.5 and open WinPyhton Command prompt and type "pip install opencv-python".
The command prompt download opencv automatically, it shows the process like this "Successfully installed opencv-python-3.3.0.10"
Finally, I try to run open cv by type "import cv2", it works
i try to type "cv2.version", and shows: '3.3.0'
Under Winpython : the Winpython-64bit-.../python_.../DLLs directory the file cv2.pyd should be renamed to _cv2.pyd
(base) C:\WINDOWS\system32>conda install C:\Users\Todd\Downloads\opencv3-3.1.0-py35_0.tar.bz2
I ran this command from anaconda terminal after I downloaded the version from
https://anaconda.org/menpo/opencv3/files
This is the only way I could get cv2 to work and I tried everything for two days.
If this helps someone, on official python 3.6 windows docker image, to make this thing work I had to copy following libraries from my desktop:
C:\windows\system32
aepic.dll
avicap32.dll
avifil32.dll
avrt.dll
Chakra.dll
CompPkgSup.dll
CoreUIComponents.dll
cryptngc.dll
dcomp.dll
devmgr.dll
dmenterprisediagnostics.dll
dsreg.dll
edgeIso.dll
edpauditapi.dll
edputil.dll
efsadu.dll
efswrt.dll
ELSCore.dll
evr.dll
ieframe.dll
ksuser.dll
mf.dll
mfasfsrcsnk.dll
mfcore.dll
mfnetcore.dll
mfnetsrc.dll
mfplat.dll
mfreadwrite.dll
mftranscode.dll
msacm32.dll
msacm32.drv
msvfw32.dll
ngcrecovery.dll
oledlg.dll
policymanager.dll
RTWorkQ.dll
shdocvw.dll
webauthn.dll
WpAXHolder.dll
wuceffects.dll
C:\windows\SysWOW64
aepic.dll
avicap32.dll
avifil32.dll
avrt.dll
Chakra.dll
CompPkgSup.dll
CoreUIComponents.dll
cryptngc.dll
dcomp.dll
devmgr.dll
dsreg.dll
edgeIso.dll
edpauditapi.dll
edputil.dll
efsadu.dll
efswrt.dll
ELSCore.dll
evr.dll
ieframe.dll
ksuser.dll
mfasfsrcsnk.dll
mfcore.dll
mfnetcore.dll
mfnetsrc.dll
mfplat.dll
mfreadwrite.dll
mftranscode.dll
msacm32.dll
msvfw32.dll
oledlg.dll
policymanager.dll
RTWorkQ.dll
shdocvw.dll
webauthn.dll
wuceffects.dll`
Please Remember if you want to install python package/libraries for windows,
you should always consider Python unofficial Binaries
Step 1:
Search for your package, download dependent version 2.7 or 3.6 you can find it under Downloads/your_package_version.whl its called python wheel
Step 2:
Now install using pip,
pip install ~/Downloads/your_packae_ver.whl
this will install without any error.
I had the same problem and spent 3 full days wrestling with it. I tried everything suggested: upgrading pip, updating Visual C++, updating Anaconda, manually downloading files and basically every solution I could find on the web. Here's what finally worked maybe it'll help someone else:
1- I ditched Python 3 and Anaconda-based downloads since I noticed they had several problems and downloaded Python 2.7.16 64-bits instead.
2- Navigated to where Pip was located on my drive (for me the path is C:\Python27\Scripts) highlighted the path by selecting it, and typed "cmd" then enter so the Command Prompt opens on that path (I noticed skipping this usually brings about a couple errors)
3- Updated Pip using python -m pip install --upgrade pip on the CMD (again, skipping this and not updating it didn't let this procedure go through)
4- Downloaded the appropriate Wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv (after trying several the one that worked for me was opencv_python-2.4.13.7-cp27-cp27m-win_amd64.whl) I copy-pasted it to the same folder Pip was in (C:\Python27\Scripts for me) and then installed it through CMD using: pip install opencv_python-2.4.13.7-cp27-cp27m-win_amd64.whl. Always through CMD opened on that path as showed in step 2
5- After step 4 when I imported OpenCV using import cv2 I didn't have the DLL error anymore but an error related to numpy (since I had just installed that version of Python and so Numpy wasn't installed yet). I installed numpy by typing pip install numpy and voilà ! The problem was solved and OpenCV imported correctly.
Hope this helps someone.
In my case, I had to install an older version of openCV (windows 10, Python 3.6.8)
pip install opencv-python==3.3.0.9
This error can be caused by missing the following dll
To have this dll install:
https://www.microsoft.com/en-us/software-download/mediafeaturepack
as already explained above
Running python 3.8.8 from windows 10 powershell from an anaconda 4.10.1 environment I installed opencv with
conda install opencv
I could import opencv no problem when I launched python from the command line.
However, when I tried to run code from inside pydev using the python interpreter for the specific anaconda environment I had activated, pydev couldn't find whichever dll it was looking for when importing opencv.
Setting the following environment variable resolved the issue:
CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
Source: PyDev/Eclipse not loading _mklinit when run from a Conda environment
Which points to this trouble shooting description for a different library loading issue: https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#numpy-mkl-library-load-failed
If you are using a server or docker enviroment without a gui (e.g. Windows Core Server) make sure that you use the headless version of cv2:
pip install opencv-contrib-python-headless
I had the same problem, it seems openCV requires Windows Media Feature pack which is not installed on Windows 10 N by default, please install it using the following link:
https://www.microsoft.com/en-us/software-download/mediafeaturepack
Windows 11 N
This a final fix for the people who don't use anaconda.
simply there are missing DLL files, that's it
download the latest version of
https://sourceforge.net/projects/opencvlibrary/
Then after you extract it search for .dll files and copy all of them and paste into C:\Windows\System32 and approve for replacing.
That's it !
Install python using:
pip install opencv-python(It will take the latest version)
Make sure opencv-python is installed in path(\Python\Python36\Lib\site-packages),
you will find cv2 folder over there.
To check the version of cv2:
import cv2
print(cv2.__version__)
Can you tell me how can I configure point cloud library to be used with anaconda, I have never used point cloud before. I have installed pcl1.6.0 all in one installer, openNI and PrimeSense. But even after this when I run my python code in anaconda it gives me the error:
ImportError: No module named pcl
Do I need to copy my pcl1.6.0 folder in the site-package folder if anaconda?
the code is here:
import pcl
p = pcl.PointCloud()
p.from_file("C:\Users\Kangkan\Desktop\ikea.png")
fil = p.make_statistical_outlier_filter()
fil.set_mean_k (50)
fil.set_std_dev_mul_thresh (1.0)
fil.filter().to_file("inliers.pcd")
You can try this:
conda install -c sirokujira python-pcl --channel conda-forge
Found solution on this website [https://anaconda.org/sirokujira/python-pcl] yesterday.
I am using Python 3.6 in Anaconda3 for Windows10(64).Hope this would be useful for you.
You could try:
conda install -c https://conda.anaconda.org/ccordoba12 python-pcl
This references wasn't available when you asked the question, but using it worked for me! https://anaconda.org/ccordoba12/python-pcl.
I am using windows and ran the conda install line with cygwin.