Opencv-python: Pip install is broken (missing requirement)

Created on 10 Aug 2020  路  7Comments  路  Source: opencv/opencv-python

Downloading https://files.pythonhosted.org/packages/a1/d6/8422797e35f8814b1d9842530566a949d9b5850a466321a6c1d5a99055ee/opencv-python-4.3.0.38.tar.gz (88.0MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-exxdkf3j/opencv-python/setup.py", line 9, in <module>
        import skbuild
    ModuleNotFoundError: No module named 'skbuild'

Expected behaviour

Should be able to install.

Most helpful comment

I added a FAQ entry to the README about the importance of upgrading pip: https://github.com/skvark/opencv-python#frequently-asked-questions

All 7 comments

No, it's not. Most likely your pip is too old. Upgrade with pip install --upgrade pip. However, hard to say what's the exact issue because you didn't fill the issue template and all the relevant info about your environment is missing.

^ I had likely the same issue and your suggestion of upgrading pip fixed it:

(_test_opencv) travis@travis-job$ pip install opencv-python
Collecting opencv-python
  Using cached https://files.pythonhosted.org/packages/a1/d6/8422797e35f8814b1d9842530566a949d9b5850a466321a6c1d5a99055ee/opencv-python-4.3.0.38.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ddocw2xk/opencv-python/setup.py", line 9, in <module>
        import skbuild
    ModuleNotFoundError: No module named 'skbuild'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ddocw2xk/opencv-python/

After upgrading:

(_test_opcv) travis@travis-job:~/$ pip install --upgrade pip && pip install opencv-python
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/bd/b1/56a834acdbe23b486dea16aaf4c27ed28eb292695b90d01dff96c96597de/pip-20.2.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-20.2.1
Collecting opencv-python
  Using cached opencv_python-4.3.0.38-cp36-cp36m-manylinux2014_x86_64.whl (49.3 MB)
Collecting numpy>=1.13.3
  Using cached numpy-1.19.1-cp36-cp36m-manylinux2010_x86_64.whl (14.5 MB)
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.19.1 opencv-python-4.3.0.38

Thanks for the work that you do @skvark ! And thanks for the suggestion.

This was on Ubuntu Bionic travis image + python 3.6. I tried to create a small replication, but my team uses a pretty strange config and I couldn't get a working example together.

@abrahamq Thanks!

For anyone who might have similar issues:

The last two releases require pip version 19.3 or greater. Older pip versions do not understand the new manylinux2014 tag. Similarly, a fresh pip version is required for the source distribution build because it uses pyproject.toml and that's why the ModuleNotFoundError: No module named 'skbuild' pops up: support for PEP 517 and PEP 518 are missing.

manylinux2014 requires pip >= 19.3
manylinux2010 requires pip >= 19.0
manylinux1 requires pip >= 8.1.0

In general, it's best practice to keep pip up-to-date. See the official guide https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip.

Since 4.3.0.36 opencv-python wheels have been built as manylinux2014 wheels. This is explained also in the release notes: https://github.com/skvark/opencv-python/releases/tag/36

See this issue for more background https://github.com/skvark/opencv-python/issues/309

I added a FAQ entry to the README about the importance of upgrading pip: https://github.com/skvark/opencv-python#frequently-asked-questions

Hello, @skvark. Could you please help me with connected issue?

I have a project that I install directly running setup.py and upgrading pip doesn't solve my problem with ModuleNotFoundError: No module named 'skbuild' error.

If you mean the setup.py in this project, you must run the build with pip wheel . --verbose (--verbose being optional depending on do you want to see build output or not). Directly running setup.py is not supported because the build system dependencies are defined in pyproject.toml. Therefore, for example python setup.py bdist_wheel does not pick scikit-build up and the build won't succeed (https://github.com/skvark/opencv-python/issues/43#issuecomment-660216741).

Detailed build guide is in the README: https://github.com/skvark/opencv-python#manual-builds
More reading about how modern Python packages are created: https://snarky.ca/what-the-heck-is-pyproject-toml/

Thank you very much, @skvark.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghimireadarsh picture ghimireadarsh  路  3Comments

Breakthrough picture Breakthrough  路  6Comments

gldraphael picture gldraphael  路  6Comments

Borda picture Borda  路  4Comments

chtsngn picture chtsngn  路  3Comments