Could not build wheels for opencv-python

Hi everyone,

We noticed that submissions failed for few participants with the following error:

e[0me[91m  ERROR: Failed building wheel for opencv-python
e[0m  Running clean for opencv-python
Failed to build opencv-python

e[91mERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly


Since opencv-python version 4.3.0.*, manylinux1 wheels were replaced by manylinux2014 wheels. If your pip is too old, it will try to use the new source distribution introduced in to manually build OpenCV because it does not know how to install manylinux2014 wheels. However, source build will also fail because of too old pip because it does not understand build dependencies in pyproject.toml . To use the new manylinux2014 pre-built wheels (or to build from source), your pip version must be >= 19.3. Please upgrade pip with pip install --upgrade pip .


Are you using requirements.txt?
In that case, the quickest solution would be pinning opencv to older version, by opencv-python<4.3.

Are you using environment.yml or want to use newer opencv version?
In this case you need to install new version of pip i.e. >=19.3. Other way can be using py-opencv conda package instead.

Meanwhile, it is good opportunity to move away from requirements.txt to conda environment for dependency management. :wink:

We have added environment.yml in MineRL starter kit as well, to ease the migration.