Skip to content

Commit 893430f

Browse files
authored
add more guidance, fix typos, drop Python 3.5
1 parent 099ed15 commit 893430f

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Check the manual build section if you wish to compile the bindings from source t
99
### Installation and Usage
1010

1111
1. If you have previous/other manually installed (= not installed via ``pip``) version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts.
12-
2. Make sure that your `pip` version is at minimum 19.3: `pip install --upgrade pip`. Check version with `pip -V`. For example Linux distributions ship usually with very old `pip` versions which cause a lot of unexpected problems expecially with the `manylinux` format.
12+
2. Make sure that your `pip` version is up-to-date (19.3 is the minimum supported version): `pip install --upgrade pip`. Check version with `pip -V`. For example Linux distributions ship usually with very old `pip` versions which cause a lot of unexpected problems especially with the `manylinux` format.
1313
3. Select the correct package for your environment:
1414

1515
There are four different packages (see options 1, 2, 3 and 4 below) and you should **SELECT ONLY ONE OF THEM**. Do not install multiple different packages in the same environment. There is no plugin architecture: all the packages use the same namespace (`cv2`). If you installed multiple different packages in the same environment, uninstall them all with ``pip uninstall`` and reinstall only one package.
@@ -19,9 +19,9 @@ Check the manual build section if you wish to compile the bindings from source t
1919
- Option 1 - Main modules package: ``pip install opencv-python``
2020
- Option 2 - Full package (contains both main modules and contrib/extra modules): ``pip install opencv-contrib-python`` (check contrib/extra modules listing from [OpenCV documentation](https://docs.opencv.org/master/))
2121

22-
**b.** Packages for server (headless) environments (such as Docker, cloud environments etc.)
22+
**b.** Packages for server (headless) environments (such as Docker, cloud environments etc.), no GUI library dependencies
2323

24-
These packages are smaller than the two other packages above because they do not contain any GUI functionality (not compiled with Qt / other GUI components). This means that the packages avoid a heavy dependency chain to X11 libraries and you will have for example smaller Docker images as a result. You should always use these packages if you do not use `cv2.imshow` et al. or you are using some other package than OpenCV to create your GUI.
24+
These packages are smaller than the two other packages above because they do not contain any GUI functionality (not compiled with Qt / other GUI components). This means that the packages avoid a heavy dependency chain to X11 libraries and you will have for example smaller Docker images as a result. You should always use these packages if you do not use `cv2.imshow` et al. or you are using some other package (such as PyQt) than OpenCV to create your GUI.
2525

2626
- Option 3 - Headless main modules package: ``pip install opencv-python-headless``
2727
- Option 4 - Headless full package (contains both main modules and contrib/extra modules): ``pip install opencv-contrib-python-headless`` (check contrib/extra modules listing from [OpenCV documentation](https://docs.opencv.org/master/))
@@ -131,16 +131,18 @@ If some dependency is not enabled in the pre-built wheels, you can also run the
131131

132132
1. Clone this repository: `git clone --recursive https://github.com/skvark/opencv-python.git`
133133
2. ``cd opencv-python``
134+
- you can use `git` to checkout some other version of OpenCV in the `opencv` and `opencv_contrib` submodules if needed
134135
3. Add custom Cmake flags if needed, for example: `export CMAKE_ARGS="-DSOME_FLAG=ON -DSOME_OTHER_FLAG=OFF"` (in Windows you need to set environment variables differently depending on Command Line or PowerShell)
135-
4. Select the version which you wish to build with `ENABLE_CONTRIB` and `ENABLE_HEADLESS`: i.e. `export ENABLE_CONTRIB=1` if you wish to build `opencv-contrib-python`
136-
5. Run ``pip wheel . --verbose``. NOTE: make sure you have the latest ``pip``, the ``pip wheel`` command replaces the old ``python setup.py bdist_wheel`` command which does not support ``pyproject.toml``.
137-
- Optional: on Linux use the `manylinux` images as a build hosts if maximum portability is needed and run `auditwheel` for the wheel after build
138-
- Optional: on macOS use ``delocate`` (same as ``auditwheel`` but for macOS)
136+
4. Select the package flavor which you wish to build with `ENABLE_CONTRIB` and `ENABLE_HEADLESS`: i.e. `export ENABLE_CONTRIB=1` if you wish to build `opencv-contrib-python`
137+
5. Run ``pip wheel . --verbose``. NOTE: make sure you have the latest ``pip`` version, the ``pip wheel`` command replaces the old ``python setup.py bdist_wheel`` command which does not support ``pyproject.toml``.
138+
- this might take anything from 5 minutes to over 2 hours depending on your hardware
139139
6. You'll have the wheel file in the `dist` folder and you can do with that whatever you wish
140+
- Optional: on Linux use some of the `manylinux` images as a build hosts if maximum portability is needed and run `auditwheel` for the wheel after build
141+
- Optional: on macOS use ``delocate`` (same as ``auditwheel`` but for macOS) for better portability
140142

141143
#### Source distributions
142144

143-
Since OpenCV version 4.3.0, also source distributions are provided in PyPI. This means that if your system is not compatible with any of the wheels in PyPI, ``pip`` will attempt to build OpenCV from sources.
145+
Since OpenCV version 4.3.0, also source distributions are provided in PyPI. This means that if your system is not compatible with any of the wheels in PyPI, ``pip`` will attempt to build OpenCV from sources. If you need a OpenCV version which is not available in PyPI as a source distribution, please follow the manual build guidance above instead of this one.
144146

145147
You can also force ``pip`` to build the wheels from the source distribution. Some examples:
146148

@@ -149,7 +151,7 @@ You can also force ``pip`` to build the wheels from the source distribution. Som
149151

150152
If you need contrib modules or headless version, just change the package name (step 4 in the previous section is not needed). However, any additional CMake flags can be provided via environment variables as described in step 3 of the manual build section. If none are provided, OpenCV's CMake scripts will attempt to find and enable any suitable dependencies. Headless distributions have hard coded CMake flags which disable all possible GUI dependencies.
151153

152-
Please note that build tools and ``numpy`` are required for the build to succeed. On slow systems such as Raspberry Pi the full build may take several hours. On a 8-core Ryzen 7 3700X the build takes about 6 minutes.
154+
On slow systems such as Raspberry Pi the full build may take several hours. On a 8-core Ryzen 7 3700X the build takes about 6 minutes.
153155

154156
### Licensing
155157

@@ -187,17 +189,14 @@ These artifacts can't be and will not be uploaded to PyPI.
187189

188190
### Manylinux wheels
189191

190-
Linux wheels are built using [manylinux](https://github.com/pypa/python-manylinux-demo). These wheels should work out of the box for most of the distros (which use GNU C standard library) out there since they are built against an old version of glibc.
192+
Linux wheels are built using [manylinux2014](https://github.com/pypa/manylinux). These wheels should work out of the box for most of the distros (which use GNU C standard library) out there since they are built against an old version of glibc.
191193

192-
The default ``manylinux`` images have been extended with some OpenCV dependencies. See [Docker folder](https://github.com/skvark/opencv-python/tree/master/docker) for more info.
194+
The default ``manylinux2014`` images have been extended with some OpenCV dependencies. See [Docker folder](https://github.com/skvark/opencv-python/tree/master/docker) for more info.
193195

194196
### Supported Python versions
195197

196-
Python 3.x releases are provided for officially supported versions (not in EOL).
198+
Python 3.x compatible pre-built wheels are provided for the officially supported Python versions (not in EOL):
197199

198-
Currently, builds for following Python versions are provided:
199-
200-
- 3.5 (EOL in 2020-09-13, builds for 3.5 will not be provided after this)
201200
- 3.6
202201
- 3.7
203202
- 3.8

0 commit comments

Comments
 (0)