8000 GitHub - Python3pkg/opencv-python at 3defe68568f61d2158e7a0d734aa1f7036e71d41
[go: up one dir, main page]

Skip to content

OpenCV on wheels. This repository generates precompiled opencv-python and opencv-contrib-python packages and uploads them to PyPI.

License

Notifications You must be signed in to change notification settings

Python3pkg/opencv-python

Repository files navigation

Platform Status
Windows buildstatus
Manylinux Build Status

OpenCV on wheels

Work in progress!

The aim of this repository is to provide means to package each new OpenCV release for the most used Python versions and platforms.

At the same time it allows anyone to build a custom version of OpenCV for any Python version: just fork this repo and modify the build files and scripts to fit your needs.

Why?

  1. Installation of OpenCV for Python is pretty hideous:
    1. Download OpenCV
    2. Find cv2.pyd from the package
      • If it exists, copy it to the root of Python site-packages
      • If it does not exist for some reason for your setup, you have to setup the build environment and compile it manually
    3. Try to import cv2 and hope it works
  2. Everyone should be able to install OpenCV (or any package for that matter) with pip with a single command without building anything
  3. Python wheels are nice, we should use them more

Documentation

The project is structured like a normal Python package with a standard setup.py file. The build process is as follows (see appveyor.yml):

  1. Checkout OpenCV (TO DO: pull only latest tag)
  2. Find OpenCV version from the sources
  3. Upgrade pip and install numpy for each Python version
  4. Build OpenCV
    • tests are disabled, otherwise build time increases too much
  5. Copy each .pyd/.so file to cv2 folder of this project and generate wheel
  6. Install the generated wheels for each Python version
  7. Test that the Python versions can import them
  8. TO DO: upload the wheels to PyPi

Currently the setup.py file parses OpenCV version information from the OpenCV sources. OpenCV depends on numpy, so setup.py checks the numpy version also with the help of pip.

As described earlier, for example the .pyd file on Windows is normally copied to site-packages. I don't want to pollute the root folder, so the __init__.py file in cv2 folder handles the import logic correctly by importing the actual .pyd module and replacing the imported cv2 package in sys.modudes with the cv2 module to retain backward compatibility.

Manylinux wheels

Linux wheels are built using manylinux. These wheels should work out of the box for most of the distros out there since they are built against an old version of glibc.

Versioning

Currently the find_version.py script searches for the version information from OpenCV sources. The CI build number is then added after the actual OpenCV version to differentiate packages (this repo might have modifications but OpenCV version stays same).

Supported Python versions

Windows:

There's a build time limitation (AppVeyor open source builds may take max. 1 hour) which restricts the supported Python versions to two. As Python's 2.x releases are slowly approaching legacy state, 2.7.x releases will be the only supported 6925 Python 2 versions on Windows. On Python 3 side, builds will be run only for the latest release.

However, if you wan't to get some other versions, just fork this repo and change the dependencies.

Linux

Manylinux wheels are built for all the Python versions which are supported by the manylinux containers.

OS X

TODO

About

OpenCV on wheels. This repository generates precompiled opencv-python and opencv-contrib-python packages and uploads them to PyPI.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 62.5%
  • Python 28.0%
  • Batchfile 8.2%
  • CMake 1.3%
0