How do I install Python OpenCV through Conda?
Solution 1
You can install it using binstar:
conda install -c menpo opencv
Solution 2
conda install opencv
currently works for me on UNIX/python2. This is worth trying first before consulting other solutions.
Solution 3
This worked for me (on Ubuntu and conda 3.18.3):
conda install --channel https://conda.anaconda.org/menpo opencv3
The command above was what was shown to me when I ran the following:
anaconda show menpo/opencv3
This was the output:
To install this package with conda run:
conda install --channel https://conda.anaconda.org/menpo opencv3
I tested the following in python without errors:
>>> import cv2
>>>
Solution 4
I have summarized my now fully working solution, OpenCV-Python - How to install OpenCV-Python package to Anaconda (Windows). Nevertheless I've copied and pasted the important bits to this post.
At the time of writing I was using Windows 8.1, 64-bit machine, Anaconda/ Python 2.x. (see notes below - this works also for Windows 10, and likely Python 3.x too).
NOTE 1: as mentioned mentioned by @great_raisin (thank you) in comment section however, this solution appears to also work for Windows 10.
NOTE 2: this will probably work for Anaconda/Python 3.x too. If you are using Windows 10 and Anaconda/Python 3.x, and this solution works, please add a comment below. Thanks! (Update: noting from comment "Working on Windows 10")
NOTE 3: depending on whether you are using Python 2.x or 3.x, just adjust the
print
statement accordingly in code snippets. i.e. in Python 3.x it would beprint("hello")
, and in Python 2.x it would beprint "hello"
.
TL;DR
To use OpenCV fully with Anaconda (and Spyder IDE), we need to:
- Download the OpenCV package from the official OpenCV site
- Copy and paste the
cv2.pyd
to the Anaconda site-packages directory. - Set user environmental variables so that Anaconda knows where to find the FFMPEG utility.
- Do some testing to confirm OpenCV and FFMPEG are now working.
(Read on for the detail instructions...)
Prerequisite
Install Anaconda
Anaconda is essentially a nicely packaged Python IDE that is shipped with tons of useful packages, such as NumPy, Pandas, IPython Notebook, etc. It seems to be recommended everywhere in the scientific community. Check out Anaconda to get it installed.
Install OpenCV-Python to Anaconda
Cautious Note: I originally tried out installing the binstar.org OpenCV package, as suggested. That method however does not include the FFMPEG codec - i.e. you may be able to use OpenCV, but you won't be able to process videos.
The following instruction works for me is inspired by this OpenCV YouTube video. So far I have got it working on both my desktop and laptop, both 64-bit machines and Windows 8.1.
Download OpenCV Package
Firstly, go to the official OpenCV site to download the complete OpenCV package. Pick a version you like (2.x or 3.x). I am on Python 2.x and OpenCV 3.x - mainly because this is how the OpenCV-Python Tutorials are setup/based on.
In my case, I've extracted the package (essentially a folder) straight to my C drive (C:\opencv
).
Copy and Paste the cv2.pyd file
The Anaconda Site-packages directory (e.g. C:\Users\Johnny\Anaconda\Lib\site-packages
in my case) contains the Python packages that you may import. Our goal is to copy and paste the cv2.pyd
file to this directory (so that we can use the import cv2
in our Python codes.).
To do this, copy the cv2.pyd
file...
From this OpenCV directory (the beginning part might be slightly different on your machine). For Python 3.x, I guess, just change the 2.x
to 3.x
accordingly.
# Python 2.7 and 32-bit machine:
C:\opencv\build\python\2.7\x84
# Python 2.7 and 64-bit machine:
C:\opencv\build\python\2.7\x64
To this Anaconda directory (the beginning part might be slightly different on your machine):
C:\Users\Johnny\Anaconda\Lib\site-packages
After performing this step we shall now be able to use import cv2
in Python code. BUT, we still need to do a little bit more work to get FFMPEG (video codec) to work (to enable us to do things like processing videos).
Set Environmental Variables
Right-click on "My Computer" (or "This PC" on Windows 8.1) → left-click Properties → left-click "Advanced" tab → left-click "Environment Variables..." button.
Add a new User Variable to point to the OpenCV (either x86 for 32-bit system or x64 for 64-bit system). I am currently on a 64-bit machine.
| 32-bit or 64 bit machine? | Variable | Value |
|---------------------------|--------------|--------------------------------------|
| 32-bit | `OPENCV_DIR` | `C:\opencv\build\x86\vc12` |
| 64-bit | `OPENCV_DIR` | `C:\opencv\build\x64\vc12` |
Append %OPENCV_DIR%\bin
to the User Variable PATH
.
For example, my PATH
user variable looks like this...
Before:
C:\Users\Johnny\Anaconda;C:\Users\Johnny\Anaconda\Scripts
After:
C:\Users\Johnny\Anaconda;C:\Users\Johnny\Anaconda\Scripts;%OPENCV_DIR%\bin
This is it we are done! FFMPEG is ready to be used!
Test to confirm
We need to test whether we can now do these in Anaconda (via Spyder IDE):
- Import OpenCV package
- Use the FFMPEG utility (to read/write/process videos)
Test 1: Can we import OpenCV?
To confirm that Anaconda is now able to import the OpenCV-Python package (namely, cv2
), issue these in the IPython console:
import cv2
print cv2.__version__
If the package cv2
is imported OK with no errors, and the cv2
version is printed out, then we are all good! Here is a snapshot:
(source: mathalope.co.uk)
Test 2: Can we Use the FFMPEG codec?
Place a sample input_video.mp4
video file in a directory. We want to test whether we can:
- read this
.mp4
video file, and - write out a new video file (can be
.avi
or.mp4
etc.)
To do this we need to have a test Python code, call it test.py
. Place it in the same directory as the sample input_video.mp4
file.
This is what test.py
may look like (I've listed out both newer and older version codes here - do let us know which one works / not work for you!).
(Newer version...)
import cv2
cap = cv2.VideoCapture("input_video.mp4")
print cap.isOpened() # True = read video successfully. False - fail to read video.
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter("output_video.avi", fourcc, 20.0, (640, 360))
print out.isOpened() # True = write out video successfully. False - fail to write out video.
cap.release()
out.release()
(Or the older version...)
import cv2
cv2.VideoCapture("input_video.mp4")
print cv2.isOpened() # True = read video successfully. False - fail to read video.
fourcc = cv2.cv.CV_FOURCC(*'XVID')
out = cv2.VideoWriter("output_video.avi",fourcc, 20.0, (640,360))
print out.isOpened() # True = write out video successfully. False - fail to write out video.
cap.release()
out.release()
This test is VERY IMPORTANT. If you'd like to process video files, you'd need to ensure that Anaconda / Spyder IDE can use the FFMPEG (video codec). It took me days to have got it working. But I hope it would take you much less time! :)
Note: One more very important tip when using the Anaconda Spyder IDE. Make sure you check the current working directory (CWD)!!!
Conclusion
To use OpenCV fully with Anaconda (and Spyder IDE), we need to:
- Download the OpenCV package from the official OpenCV site
- Copy and paste the
cv2.pyd
to the Anaconda site-packages directory. - Set user environmental variables so that Anaconda knows where to find the FFMPEG utility.
- Do some testing to confirm OpenCV and FFMPEG are now working.
Good luck!
Solution 5
It doesn't seem like the page you linked includes opencv
any more. (Funny, I do recall it being included at a previous point as well.)
In any case, installation of OpenCV into Anaconda, although unavailable through conda, is pretty trivial. You just need to download one file.
- Download OpenCV from https://opencv.org/releases/ and extract
- From the extracted folder, copy the file from the extracted directory: opencv/build/python/2.7/(either x86 or x64, depending on your Anaconda version)/cv2.pyd to your Anaconda site-packages directory, e.g., C:\Anaconda\Lib\site-packages
- To get FFmpeg within
opencv
to work, you'll have to add the directory that FFmpeg is located in to the path (e.g., opencv/sources/3rdparty/ffmpeg). Then you'll have to find the DLL file in that folder (e.g., opencv_ffmpeg_64.dll) and copy or rename it to a filename that includes theopencv
version you are installing, (e.g., opencv_ffmpeg249_64) for 2.4.9.
Now at the Python prompt you should be able to type "import cv2"...to verify that it works, type "print cv2.__version__", and it should print out the OpenCV version you downloaded.
Related videos on Youtube
Chet
Updated on January 18, 2022Comments
-
Chet over 2 years
I'm trying to install OpenCV for Python through Anaconda, but I can't seem to figure this out.
I tried
conda install opencv conda install cv2
I also tried searching
conda search cv
No cigar. I ran across this which lists
opencv
as an included package:http://docs.continuum.io/anaconda/pkgs.html
After running
conda info
I noticed my version is 3.4.1, but I couldn't seem to find any information about this version online. I'm pretty confused about this.Am I missing something pretty obvious here? If
opencv
was available for a previous version of Anaconda, then why wouldn't it be available for the newer version? And why does that link only show me documentation for version 1.9.2?-
berak about 10 yearsthe current opencv wrapper module is called cv2. (the first one in you list is an outdated 3rd party wrapper, the 3rd one is the outdated c-api wrapper, you should use none of those) - unfortunately, i never met a person running it successfully on anaconda. can't you use a regular python 2.7 ?
-
M4rtini about 10 yearsThere's nothing with anaconda that prevents you from using it with opencv. It's just not included in the conda install except for linux. You can get install binaries files from here for windows.
-
berak about 10 yearsah, thanks, M4rtini, i was obviously wrong above.
-
Chet about 10 yearsI'm on MacOSX. Only available on linux? whats with that? how did you find that?
-
M4rtini about 10 years@Chet In the table you linked, there's an L behind the listing of opencv. If you look beneath the table you will se that that L means it's only for Linux.
-
fviktor almost 9 yearsIt works already from the standard repo:
conda install opencv
-
Farhan Ahmed almost 7 yearsI just installed OpenCV 3 on python 3.6.1 on a windows 10 machine using solarianprogrammer.com/2016/09/17/…
-
RaúlMG almost 7 yearseverybody. I found that using other owners of the Anaconda Cloud Repository works as well. e.g. instead of using menpo's opencv y used conda-forge's. here are the owners of several OpenCVs listed with the respective OSs: anaconda.org/search?q=openCV I ran this code: conda install -c conda-forge opencv=3.2.0 Good luck!
-
ng0323 over 5 yearswhy not just use pip install ?
-
Vivek Subramanian about 5 years@ng0323, take a look at this: anaconda.com/using-pip-in-a-conda-environment. It is not recommended to use both pip and conda because it can result in instability.
-
ambar mishra over 4 yearsWith anaconda 3, type
conda install opencv
command on annaconda prompt. Installs 3.4.1 opencv and various dependent packages with it. Worked for me and also it did not require any custom installing specification. -
AMC about 4 yearsNOTE: There is likely a version of the package for your system available on the official Anaconda channel or the popular conda-forge. Check there before trying to install things from github or random channels, or using pip.
-
-
Ivo Flipse over 9 yearsSomebody also created a binstar package, which you should be able to download through Conda now: binstar.org/menpo/opencv/files
-
venuktan over 9 yearscan you tell me how to download opencv via conda ? I downloaded the mac package in the above link what do I do from there?
-
freespace over 9 years@venuktan conda install opencv should do it.
-
cogle over 9 yearsI tried using this method to install OpenCV, but am running into an issue where when I type import cv I get the error DLL load failed: The specified module could not be found. I was wondering if you ran into this issue during your install.
-
Rafael_Espericueta about 9 yearsIt worked for me three, on Ubuntu 14.04. :-) THANKS!
-
Paul almost 9 years@eculeus could you elaborate a little more on verifying ffmpeg. I can read from my webcam but am having trouble reading/writing video files. I looked in that directory 3rdparty/ffmpeg and renmaed dll to: opencv_ffmpeg300_64.dll You mention that ffmpeg should be in path. Do you mean path of windows PATH or of sys.path in python?
-
user391339 almost 9 yearsNote that you may need to import sys, then do a sys.path.append("C:/Anaconda/Lib/site-packages"). The above had suddenly stopped working and this solution came from here: stackoverflow.com/questions/19876079/…
-
waldol1 almost 9 yearsWorked for me on windows 7
-
BeRecursive almost 9 yearsThis was a bug in me copying the files, it should work now
-
Andy Hayden over 8 yearsNot with python 3.4:
Error: Unsatisfiable package specifications.
-
Andy Hayden over 8 yearsYes! Works for me on OSX, python 3.4. Installs opencv3.0 (presumably conda's default still has opencv 2.x which wasn't py3 compatible)
-
Andy Hayden over 8 yearsHmmm, although this doesn't allow me to
import cv2.cv
(am I missing something obvious?) -
BeRecursive over 8 years@AndyHayden
cv2.cv
was deprecated in OpenCV3 -
Andy Hayden over 8 years@BeRecursive Thanks! Do you know if there is a list/porting guide somewhere (for code that uses cv2.cv functions/constants) ? e.g. cv.X becomes cv2.Y?
-
cod3monk3y over 8 yearsBrilliant answer! Note that if you're using conda environments,
cv2.pyd
should be added to the environment'ssite-packages
folder (e.g.C:\Users\cod3monk3y\Anaconda\envs\foo\Lib\site-packages\cv2.pyd
). Also worth noting, the .pyd file is just a Windows DLL with a specific interface to play nicely with Python. -
mercergeoinfo over 8 yearsThis works on OSX 10.10.5 with conda 13.8.4 The only "minor" issue is that it requires numpy 1.10.1 which is ok but I ran conda update --all and some libraries required a downgrade to 1.9 in order to run.
-
Merlin over 8 yearsTrying many other ways to install opencv3, this finally worked for me on OSX 10.10.5
-
Phil Glau over 8 yearsUsing just "conda install opencv" on Ubuntu 14.04 with Anaconda 2.7 and PyCharm throws an error when I use 'cv2.imshow('name',img) that indicates that the package needs to be rebuilt with "GTK+ 2.x" support, so does not appear to be useful for somebody using PyCharm as an IDE on ubuntu.
-
Phil Glau over 8 yearsI found that this worked for my when using PyCharm IDE, Anaconda 2.7 and Ubuntu 14.04 whereas "conda install opencv" did not. Thanks!
-
Phil Glau over 8 yearsI'm finding that cv2.VideoCapture does not work. I'm using Ubuntu 14.04, Anaconda 2.7 and PyCharm IDE. Is there a way to tell if this conda package is compiled with ffmpeg support? (I'm fairly new to both anaconda and Ubuntu)
-
Evan Zamir over 8 years@PhilGlau I got the same error trying to install this way. It's a shame b/c it's so much easier installing with conda than manually (which I still haven't got working correctly).
-
Aruna Tebel over 8 yearsUp you go sir! This worked for Ubuntu 14.04, Anaconda with Python 3.5
-
exhuma over 8 yearsCan someone please elaborate the part for the ffmpeg DLL? I found it, but I have no clue what to rename it to, where to put it, and what's meant by "path". Is that
sys.path
orPATH
? -
dshgna about 8 yearsWorked for me too on Windows 10
-
Gustavo Bezerra about 8 yearsIt looks like it would work but it is trying to downgrade my numpy from 1.10 to 1.7 which is unacceptable.
-
Natarajan Raman about 8 yearsSuperb. Worked wonderfully well. tried many other options and thank fully I found this. Thank you so much. Windows 8.1 X64
-
Indrajit about 8 yearsWorked for me. Thanks
-
usmanayubsh about 8 yearsWorked for me too. Thanks alot @singular.
-
aquagremlin about 8 yearsinterestingly this installs a cv2.pyd that is ~2.3 MB. But if you go to the openCV website and download the binary, the opencv2.pyd from there is >44MB. Furthermore , both pyd files pass the 'import' test. So I wonder why the anaconda repo is much smaller?
-
aquagremlin about 8 yearsthe code you posted above prints out true, true for me but the output is an empty 6kb video file. However, the code below writes properly to a file. (how do i get line breaks in these comments?)
-
aquagremlin about 8 years
import cv2
cap = cv2.VideoCapture("BBunny_360x240_1mb.mp4")
print cap.isOpened()
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter("output_video.avi", fourcc, 30.0, (320, 240))
print out.isOpened()
while True:
` ret, frame = cap.read()` ` out.write(frame)` ` cv2.imshow('frame',frame)` ` if cv2.waitKey(1) & 0xFF ==ord('q'):` ` break`cap.release()
out.release()
cv2.destroyAllWindows()
-
aquagremlin about 8 yearsthe bunny video i used came from here [sample-videos.com/video/mp4/240/big_buck_bunny_240p_1mb.mp4]
-
Anton Schwaighofer about 8 yearsThis worked fine with Anaconda 2.7 on Win10 64bit, whereas
conda install opencv
did not. -
opetroch almost 8 yearsThank you, your post helped me a lot. I am getting an error with cv2.VideoWriter_fourcc ('module' object has no attribute 'VideoWriter_fourcc'), however I successfully read from a file which is what I wanted for a start. Do you have any clue what might be causing the above error? Thanks again.
-
user2561747 almost 8 yearsThis binstar package is not compiled with ffmpeg support. You can check with
print cv2.getBuildInformation().split("Video I/O:")[-1].split("\n\n")[0]
. I found thatmsarahan
has 3.1 compiled with ffmpeg for OS X, but I still can't find one for linux; don't know about windows. -
yety over 7 yearsSir, you saved me a day :) python3.5 ubuntu16.04 Working like a charm!
-
jdelange over 7 yearsI get two times false. Don't know why. I did install FFmpeg and added it to the path. Using the "new version" code, but with the older line fourcc = cv2.cv.CV_FOURCC(*'XVID') because print cv2.isOpened() generates an Attribute error: 'module'object has no attribute 'isOpened'. Also, the cap.release in the "old version" does not make sense as it is not defined. Win 7, 64 bit, Anaconda, VS15
-
user3731622 over 7 yearsDoes
conda search opencv
return results for you? It didn't for me. -
stoves over 7 yearsit really depends on platform. for example this doesn't work for windows. can do a
conda search --platform {win-32 / win-64 / osx-64 / etc...} opencv
to see what is available -
Mickey Perlstein over 7 yearsIf i could up it more i would, best answer ever. I would just add, if you've installed python, uninstall it, conda has its own
-
pcomitz over 7 yearsThis worked for me on Win 10, 64 bit. Works in Spyder.
-
linbianxiaocao about 7 yearsBe sure to type opencv rather than opencv3 at end of the command. It doesn't work for me with opencv3 and looks like it's because depended packages are not downgraded that caused conflicts.
-
ehecatl about 7 yearsWhy was this answer downvoted? It offers helpful advice beyond the numerous silly dupes of "conda install --c menpo opencv" that keep getting upvoted. May I suggest to remove or review the Caution part, because it does not add value, only clutter.
-
ollerend almost 7 yearsThanks for this! One more suggested test that took me awhile to figure out. After confirming that the video can be opened, I wanted to confirm that I could extract a frame (frame 100) as an array. In openCV 2.4.9, the command for this was cap.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, 100). In openCV 3.2.0, the equivalent command has changed to cap.set(cv2.CAP_PROP_POS_FRAMES, 100)
-
drevicko almost 7 yearsNOTE: this repo has opencv 2.4.11 as of writing. For opencv 3.2 you'll need another method.
-
Dhiego Magalhães almost 7 yearsThis is the only solution that worked for me (python 3.5, win64)
-
Yamaneko almost 7 years+1 came here just to post this. However, one has to keep in mind that there is an issue with loopbio's OpenCV version 3.2.0 as of today. It silently fails to read and write videos. It is due to a combination of an upstream OpenCV issue in combination with an old GCC. More details here. There is a PR on its way to solve the issue.
-
Ibrahim Amer almost 7 yearsThank you sir for this awesome and well explained answer. You are making the life easier for many newbies sir !
-
Mona Jalal almost 7 years@drevicko what's the other method?
-
drevicko almost 7 years@MonaJalal to be honest I don't have one. There's quite a few install scripts out there for various setups, some of which may work. I didn't find a good solution, but didn't look especially hard. If you're super keen, you may want to update the menpo conda install script
-
dashesy over 6 yearsthere is no
opencv3
it must beopencv=3.1.0
-
Mona Jalal over 6 yearsUsing this >>> import cv2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/Users/mona/anaconda/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libopenblasp-r0.2.19.dylib Referenced from: /Users/mona/anaconda/lib/libopencv_core.3.3.dylib Reason: image not found
-
Yaron over 6 yearsWhile this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
-
OxLearnIT over 6 years@Yaron. that's probably will happen in the future.
-
waspinator about 6 years
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-1-c8ec22b3e787> in <module>() ----> 1 import cv2 ImportError: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
-
waspinator about 6 years
apt-get install libgtk2.0-0
is required -
J.Treutlein about 6 yearsYou my friend are a genius!! This is like the only way and best way to install OpenCV! Thank you so much!
-
michael over 5 yearsmenpo repo no longer supported, github.com/menpo/conda-opencv3 ; now recommended to use conda-forge github.com/conda-forge/opencv-feedstock
-
michael over 5 years(this is duplicate existing answer, w/ edits, not sure which came first) menpo repo no longer supported, github.com/menpo/conda-opencv3 ; now recommended to use conda-forge github.com/conda-forge/opencv-feedstock
-
michael over 5 years(this is duplicate existing answer, w/ edits, not sure which came first) menpo repo no longer supported, github.com/menpo/conda-opencv3 ; now recommended to use conda-forge github.com/conda-forge/opencv-feedstock
-
Failed Scientist over 5 yearsWorked like a charm! (Ubuntu16 LTS)
-
RTbecard over 5 yearsI also down voted this, as the question specifically asks for installation via the cross-platform
conda
package manager, notapt-get
(which is debian/ubuntu specific). Note the user did not specify a platform, so I don't think linux specific answers are appropriate here. -
David Jung over 5 yearsWorks under Ubuntu 16.04 with Python 3.6. Thanks.
-
Stepan Yakovenko over 5 yearsmportError: DLL load failed: The specified module could not be found.
-
Nathan over 5 years@mercergeoinfo is there any way this can be resolved? I'm trying to use both
numpy
1.15-exclusive functions (np.unique(x,axis=0)
) and funcs fromimport cv2
in my code. I am willing to try a mix of conda and pip if necessary. I'm guessing the issue iscv2
uses oldnumpy
functions which are deprecated? -
Oliver Zendel about 5 yearsIf using miniconda under ubuntu 18.04; the "Solving environment" stage will take very long if you have the newest anaconda package installed. create a clean miniconda env without the anaconda bulk (e.g.
conda create --name abc python=2.7
) -
Nagabhushan S N about 5 yearsWorks with Ubuntu 18.04 and Python 3.6
-
Vivek Subramanian about 5 yearsWorks on Windows 10, Python 3.7. You may need to run cmd with admin privileges.
-
Dang Manh Truong about 5 yearsUPDATE : opencv-python 3.4.0.12 has supported video related functions, so we can use pip install opencv-python as normal. . Just "pip install opencv-python" and it worked :)
-
eric about 5 years@michael really the conda-forge is the right answer at this point and it is pretty much buried in antiquated answers. :(
-
michael about 5 yearsI went ahead & added an update to this answer to remove
menpo
, and updated the syntax for installingopencv
as per theconda-forge
instructions. The answer itself is not fundamentally changed, asmenpo
was just for installing "newer" opencv3, and we're already on opencv4. -
fulvio almost 5 yearsWorks on Mac OSX Mojave 10.14.5
-
Suisse almost 5 yearswill this install "cv2" ?
-
mLstudent33 almost 5 years@AdamErickson was this in Anaconda Prompt run as Admin?
-
Adam Erickson almost 5 years@mLstudent33 The command was run in Bash and the Anaconda installation was in a local folder, so no
sudo
was necessary. I would avoid runningconda
assudo
unless you manage a system-wide install for multiple users, which I also do. In that case, I am usually careful to activate the conda environment and thensudo ./conda ...
from the/bin
folder of that environment as an extra precaution, sincesudo
changes yourPATH
even when using the-E
flag. -
Brett almost 5 years@AdamErickson this worked for me, but I got v3.4.2 instead. Any ideas?
-
Brett almost 5 yearsupdate to above: I think I already had an earlier version of
libopencv
installed already. After removing it runningconda install opencv
installed the latest version. -
HelloGoodbye almost 5 yearsHow comes you are installing
opencv3
but importingcv2
? Why are the version numbers different? -
Great_Raisin almost 5 yearsWorking on Windows 10
-
john ktejik over 4 yearsThis is how to install opencv WITHOUT using conda. -1
-
Nuhman about 4 yearsWorks for opencv3 -> python[version='2.7.*|3.4.*|3.5.*']. Failed for Python 3.7.
-
AMC about 4 yearsIs there any reason to do this instead of simply installing it from conda-forge? By the way, using the base environment for development is a bad idea, just don't touch it.
-
AMC about 4 yearsNothing about this is specific or unique to Anaconda Navigator.
-
Nuhman about 4 years@AMC I didn't use it. Anyways, is there a working method for 3.7?
-
AMC about 4 years@Nuhman Yes, you can get opencv from the official Anaconda channel, as well as from conda-forge (here).
-
AMC about 4 yearsThis seems unnecessarily lengthy. More importantly, why would you use pip to install libraries like NumPy?
-
AMC about 4 yearsThe opencv package from menpo is unmaintained since late 2017, possibly earlier. Combined with the fact that both the official/main Anaconda channel and conda-forge offer opencv, there hasn't been a reason to use this in years.
-
AMC about 4 yearsThe opencv package from menpo is unmaintained since late 2017, possibly earlier. Combined with the fact that both the official/main Anaconda channel and conda-forge offer opencv, there hasn't been a reason to use this in years.
-
Shahir Ansari about 4 yearsThe above method worked for me when i was installing it about 6 months ago.
conda-forge
didn't worked for me.But thanks for providing the details info. -
MeadowMuffins almost 3 yearswon't work this python3.7, hence
pip install opencv-python
-
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. Please update answer. -
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. Please update answer. -
merv over 2 yearsUnless "System Administrator" is your job title and you are managing environments for others to use, you shouldn't be elevating privileges to use Conda. It only complicates the installation.
-
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. Please consider updating. -
merv over 2 yearsThis information is mostly outdated. Conda Forge coverage is more reliable these days and should be sufficient.
-
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. -
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. -
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. -
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. -
merv over 2 yearsDo not use the
broken
tag! That opens up the solver to use every package that has been tagged asbroken
. Conda package maintainers use that tag to prevent packages that have identified bugs in their build from being installed. -
merv over 2 yearsThis adds nothing that hasn't already been recommended previously (e.g., this answer).
-
merv over 2 yearsOutdated answer. The
menpo
channel is no longer actively maintained. Please considering updating answer. -
merv over 2 yearsPlease do not casually recommend manually changing anything within Conda. Conda tightly orchestrates the management of dependencies. Manual tinkering can lead to undefined behavior.
-
merv over 2 yearsWow.
binstar
haven't seen that in years! Just-c conda-forge
works these days. -
merv over 2 yearsThis adds nothing that hasn't been said in earlier answers.
-
merv over 2 yearsFirst,
menpo
is no longer maintained, so this answer is outdated. Second, please do not casually recommend manually adding files into Conda environments. Conda tightly orchestrates the management of environments. Manual tinkering can lead to undefined behavior. -
merv over 2 yearsThis information was already present in earlier answers. Please consider updating and commenting on those instead.
-
merv over 2 yearsThis information was already available in earlier answers. Please consider upvoting those instead.
-
Jesuisme almost 2 yearsAs of May 2022, using Anaconda 3 or newer, installing with conda-forge is the most straightforward.