Skip to content Skip to sidebar Skip to footer

How To Install Opencv 2.4 If It Is No Longer Supported?

I am trying to run this code here https://github.com/feichtenhofer/gpu_flow/ which requires me to first install OpenCV 2.4. But I get the error below when trying to do so and I rea

Solution 1:

Please note that OpenCV 2.x has been removed from PyPI due to future deprecation. You can figure this out by listing out all possible formulae for opencv-python using pip:

$pipinstallopencv-python==ERROR:Couldnotfindaversionthatsatisfiestherequirementopencv-python==(fromversions:3.4.2.16,3.4.2.17,3.4.3.18,3.4.4.19,3.4.5.20,3.4.6.27,3.4.7.28,3.4.8.29,3.4.9.31,3.4.9.33,4.0.0.21,4.0.1.24,4.1.0.25,4.1.1.26,4.1.2.30,4.2.0.32,4.2.0.34)ERROR:Nomatchingdistributionfoundforopencv-python==

The earliest version available on pip is 3.4. Is there a particular reason why you want to specifically use OpenCV 2.4?

However, if it is your desire to do so, I would recommend visiting the repo that actually automatically releases OpenCV to PyPI through the opencv-python package: https://github.com/skvark/opencv-python

From here, you must manually build the package yourself to generate a wheel installable through pip then install it yourself. First you will need to use git to clone the repo. Next, you will need to run the setup configuration to build the OpenCV package and compile it with version 2.4, then install it on your machine.

$ git clone --recursive https://github.com/skvark/opencv-python.git$ cd opencv-python/opencv$ git checkout 2.4$ cd ..$ python setup.py bdist_wheel

The above ensures that the OpenCV source that accompanies the effort for building the Python package for OpenCV is set to version 2.4.

You'll have to wait a bit for this to build. When it's finally ready, you will see a dist directory in the repo you just cloned. Open this up and you'll see a .whl file that you can use to install OpenCV on your computer via pip:

$ cd dist$ pip install <name of opencv 2.4>.whl

<name of opencv 2.4> should be the filename of the OpenCV 2.4 wheel that was built. There should only be one file here with extension .whl.

Good luck!


P.S. I would highly suggest you look for another package or do some code migrations to move to OpenCV 3 or 4. There have been substantial improvements in these newer versions that are not seen with OpenCV 2 that help with performance and maintainability.

Post a Comment for "How To Install Opencv 2.4 If It Is No Longer Supported?"