Install OpenCV

Hi I would like some computer vision libraries in an app I'm developing. To install opencv I need to sudo and apt-get, yet I know both of these commands are not available. What best alternative do I have?


You need to ask the developers very nicely :-)

I would start by wishing them a happy new year...

We'll have a look at installing it for our next upgrade.

Ok thank you! I think it has great potential specially for image related websites! (Which are catching fire in popularity)

Happy New Years!

And a very happy New Year to everyone from all of us at PythonAnywhere HQ!

Hi, for the app that I would like to host at PythonAnywhere, OpenCV is a requirement. Are you planning to install it? Oh yeah, and a happy Eid-ul-fitr by the way! ;-)

We have a ticket for that and we'd like to get it done (no promises on when, unfortunately). I have upvoted the ticket for you.

Thanks. Sorry if I sound pushy, but for my project I'm going to need it very soon (as in this week). I would be willing to beta-test it for you under my account before you roll it out for all ;-).

Sorry. Our architecture doesn't work like that. We'd like to change it so we can do this sort of thing, but at the moment, we can't.

Hi Glenn, have you guys made any steps with this? I find myself in some serious need of OpenCV - what are my options? Thanks.

Hi there -- which Python wrapper for the OpenCV library would you prefer? (A PyPI link would be ideal :-)

...actually, if you have any hints at all on installing it properly on Ubuntu, they'd be much appreciated :-)

Hi Giles, thanks for getting back to me on this one. Have you tried this >> ?

I am running perfectly on my Fedora, but that's because we have a yum repo, so it was pretty easy for me... ;)

I did see that, it looked kind of terrifying -- lots of extra dependencies to clash with the stuff we already have installed... will give it a go on a test environment, though. Which Python versions do you need to use it with?

It is terrifying - I know. I need to use it with any release of 2.7 - (Python 2.7.*) I have 2.7.5 here.

OK. We'll see if we can get it in to the next release. I can't promise, though -- it might conflict with other modules that we have installed. But if it all goes smoothly, it'll be there.

Alright. Thanks.

Just an update here -- the install is looking pretty good so far. We still have a bunch of tests to run, but we should be able to get that going over the weekend.

Giles, thanks :)

...and it's in the automated testing loop now. We'll see how things look after the weekend.

OK, we've finally managed to get it live. Any feedback much appreciated!

You may receive an error when importing the OpenCV module:

>>> import cv2
libdc1394 error: Failed to initialize libdc1394

Fear not... The module does actually load:

>>> a = np.array([255],dtype=np.uint8)
>>> cv2.add(a,a)
array([[255]], dtype=uint8)

OpenCV is sending a warning about not being able to use a USB camera driver.

I actually contacted support on this one, so I figured this might help out someone else.

How can I use OpenCV 3.0 on python anywhere?

Try installing it into a virtualenv?

I need the OpenCV inside a virtual env because im using it along with Djago 1.7. But we have no permission to install it. How can I do it?

We can have a look at upgrading OpenCV, but we can't promise anything about when it might be available. In the meantime you could try building and installing from source into your home directory.

how do you install the openc cv on pythonanyhwere in virtual env is it pip install opencv?

it's not that easy I'm afraid. You'd have to download and compile opencv yourself first. there are some instructions here, but you'd have to modify them to do a user/local install instead of a system-wide one

from the "pip install numpy" step onwards.

If you're not experienced with C library compilation, probably best to wait until we get time to try and install it ourselves into the standard system image. I'm not sure when we might be able to do that, but we'll post an update here when we do...

It looks like OpenCV has been made available on the standard system image. Nice! But how can I use this installation of OpenCV ("import cv2") within a virtualenv that I've created. (There are other libraries that I need to make available to the same script.)

If you need access to system-level modules, I think your best bet is to install any additional modules using the --user method described here

Another possibility is (if you're using virtualenvwrapper) to run toggleglobalsitepackages as described here

i need to install opencv.. can you please guide me how to do this?

Are you using a virtualenv? If not, OpenCV should already be installed.

yes i am using virtual envirnment and need to use opencv3

Can you please help me?

Unfortunately we don't have OpenCV 3 installed. If you're experienced in compiling C libraries, then you may be able to get it installed locally using these instructions here but if not, unfortunately you'll have to wait until we can install it system-wide, which will take quite a while -- it would need to go through testing against all of the other modules we have installed, which could take months.

Hello! It is already possible to use opencv and dlib tools in pythonanywhere I need to do some tests with these libraries.

You can use OpenCV 2 with Python 2.7 right now -- all of the appropriate libraries are already installed.

I think we may use pyopencv as an alternative for OpenCV for Python 3. It is a pre-compiled version of OpenCV and doesn't clash with dependencies. I personally faced problems with OpenCV on Python 3. Installing pyopencv solved them for me. All the syntax is the same as OpenCV, with the removed hassle of compiling the libraries.

Interesting! We're actually working on a new system image where we're planning to upgrade to OpenCV 3, which will mean that it's available for Python 3 but not for Python 2. We'll have to look at pyopencv as a way to perhaps make sure that we can support both.

That'd be great!

btw, I think I named the wrong package mistakenly. The correct one is opencv-python. Homepage:

thanks for letting us know!

Help: "2018-12-09 15:49:22 VIDEOIO ERROR: V4L: can't open camera by index 0" How to fix this...

It sounds like you're running some code that is trying to access a camera and getting an error. If this is happening on PythonAnywhere, it's presumably because our servers don't have cameras attached.

Aun siguen sin soporte para OpenCV??

You can try using "opencv-python" (

ayuda , ocupo incorporar OpenCv alguien me dice como trabajarlo

@danny001you need to provide more details on your issue, if you want to get some help.