Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'skbuild' #387

Closed
4 tasks done
maifeeulasad opened this issue Sep 9, 2020 · 16 comments
Closed
4 tasks done

ModuleNotFoundError: No module named 'skbuild' #387

maifeeulasad opened this issue Sep 9, 2020 · 16 comments

Comments

@maifeeulasad
Copy link

maifeeulasad commented Sep 9, 2020

Expected behaviour

I was trying to install it with :

!{sys.executable} -m pip install --user opencv-python

Actual behaviour

Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-rnhk49o3/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-rnhk49o3/opencv-python/

Steps to reproduce

  • Ubuntu 18 LTS
  • Jupyter Notebook
  • x86
  • opencv-python version : to-be installed
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python
@skvark
Copy link
Member

skvark commented Sep 9, 2020

https://github.com/skvark/opencv-python#frequently-asked-questions

@skvark skvark closed this as completed Sep 9, 2020
@maifeeulasad
Copy link
Author

@skvark I have pip version 20+

@skvark
Copy link
Member

skvark commented Sep 10, 2020

Send the output of !{sys.executable} -m pip -V. Your pip started building opencv-python from sources which means that your pip is too old to understand manylinux2014 pre-built wheel format.

@maifeeulasad
Copy link
Author

ok, the problem was in pip of jupyter-notebook.. thanks..

@Semnodime
Copy link

ok, the problem was in pip of jupyter-notebook.. thanks..

Please let us know what allowed you to conclude that.
Also, (how) did you solve the problem in the end?

@maifeeulasad
Copy link
Author

@Semnodime I removed jupyter and installed it again

@TM6501
Copy link

TM6501 commented Oct 2, 2020

I have the same problem with pip version 20.0.2. I'm on Ubuntu 20.04 on a Raspberry Pi 4.

@skvark
Copy link
Member

skvark commented Oct 2, 2020

@TM6501 You are using an ARM platform and that has been never supported by this project. Please have a look at PiWheels project as explained in the README. arm64 support will be added at some point: #366

@TM6501
Copy link

TM6501 commented Oct 2, 2020

@skvark Installing scikit-build before attempting to install opencv made opencv successful on my Raspberry Pi 4. My end goal is still to get stable-baselines to function properly, and it won't finish its install. However, it is no longer getting stopped by its opencv requirements. It is always one step forward and three steps back trying to get anything to work on Pis. I just thought I'd let you know that it at least seemed to install properly when I took care of the scikit-build requirement manually as such:

pip3 install scikit-build
pip3 install opencv-python

@skvark
Copy link
Member

skvark commented Oct 2, 2020

Thanks for the info. It's a bit odd it worked via that way - if your pip is up-to-date, then scikit-build should install automatically when you run pip install opencv-python because it's defined as a build dependency in pyproject.toml (given that the source tarball was downloaded from PyPI).

@howardjones
Copy link

It's definitely not as simple as "pip is too old". Ubuntu 18.04, python 3.8 and pip 20.2.3 give me this same error. I wanted to build a wheel for local virtualenvs from source. Installing scikit-build seems to have resolved it.

@skvark
Copy link
Member

skvark commented Oct 3, 2020

Please post full list of commands you used when you encountered the error so I can try to reproduce it - if there's some bug in how build dependencies are defined in pyproject.toml I'm happy to fix it. If there's some bug in pip I will report it to pip maintainers. However, in my experience from answering tens of these questions the answer has been always too old pip. On arm64 architectures (and on arm in general) the story is a bit different, since scikit-build depends on cmake arm64 binary which is currently broken and prevents scikit-build from working properly.

As noted above, also the original issue here was about too old pip: the problem was that system pip was used instead of the jupyter-notebook's own pip (or something, I don't know how jupyter works behind the scenes).

Ubuntu and other Linux systems ship usually with very old pip versions (< 10) and there are usually many different pip executables in those systems. For example, pip usually points to Python 2.7 and pip3 points to some Python 3 version. When you try to update those with pip itself the update might fail due to the fact that they are provided via Linux system package repositories and not via get-pip.py. Therefore, the build should be run always in a clean virtualenv with fresh tools.

All this boils down to Python's package management system. I hope it will be some day a bit simpler to use and update. See https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support for more info about how pip uses pyproject.toml to install build dependencies.

@howardjones
Copy link

howardjones commented Oct 4, 2020

Sure, here's an example, on Ubuntu 18.04 LTS, x86_64, with Python 3.8 and pip 20.2.3 in a fresh virtualenv.

I got my wheel, and some simple tests indicate it's working for me, so thank you for all your hard work. All I wanted to point out was that it (also) may NOT be related to old pip.

howie@jubjubuntu-ng:~
▶ mkdir test-cv2

howie@jubjubuntu-ng:~
▶ cd test-cv2

howie@jubjubuntu-ng:~/test-cv2
▶ virtualenv -p python3.8 venv
Running virtualenv with interpreter /usr/bin/python3.8
Using base prefix '/usr'
/usr/lib/python3/dist-packages/virtualenv.py:1086: DeprecationWarning: the imp module is deprecated in favour of importlib; see the                     module's documentation for alternative uses
  import imp
New python executable in /home/howie/test-cv2/venv/bin/python3.8
Also creating executable in /home/howie/test-cv2/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

howie@jubjubuntu-ng:~/test-cv2
▶ source venv/bin/activate
(venv)
howie@jubjubuntu-ng:~/test-cv2
▶ pip -V
pip 20.2.3 from /home/howie/test-cv2/venv/lib/python3.8/site-packages/pip (python 3.8)
(venv)
howie@jubjubuntu-ng:~/test-cv2
▶ uname -a
Linux jubjubuntu-ng 5.4.0-47-generic #51~18.04.1-Ubuntu SMP Sat Sep 5 14:35:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
(venv)
howie@jubjubuntu-ng:~/test-cv2
▶ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
(venv)
howie@jubjubuntu-ng:~/test-cv2
▶ pip install --no-binary :all: opencv-python
Collecting opencv-python
  Using cached opencv-python-4.4.0.44.tar.gz (88.9 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/howie/test-cv2/venv/bin/python3.8 /home/howie/test-cv2/venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-6ct04o7f/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"''
       cwd: None
  Complete output (22 lines):
  Ignoring numpy: markers 'python_version == "3.5"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.6"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.7"' don't match your environment
  Collecting setuptools
    Using cached setuptools-50.3.0.zip (2.2 MB)
  Collecting wheel
    Using cached wheel-0.35.1.tar.gz (59 kB)
  Collecting scikit-build
    Using cached scikit-build-0.11.1.tar.gz (132 kB)
  Collecting cmake
    Using cached cmake-3.18.2.post1.tar.gz (28 kB)
      ERROR: Command errored out with exit status 1:
       command: /home/howie/test-cv2/venv/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-796_mmlu/cmake/setup.py'"'"'; __file__='"'"'/tmp/pip-install-796_mmlu/cmake/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-g7dav2e8
           cwd: /tmp/pip-install-796_mmlu/cmake/
      Complete output (5 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/tmp/pip-install-796_mmlu/cmake/setup.py", line 7, in <module>
          from skbuild import setup
      ModuleNotFoundError: No module named 'skbuild'
      ----------------------------------------
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/howie/test-cv2/venv/bin/python3.8 /home/howie/test-cv2/venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-6ct04o7f/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' Check the logs for full command output.
(venv)
howie@jubjubuntu-ng:~/test-cv2                                                                                                                       ⍉
▶ pip install scikit-build
Collecting scikit-build
  Using cached scikit_build-0.11.1-py2.py3-none-any.whl (72 kB)
Requirement already satisfied: setuptools>=28.0.0; python_version >= "3" in ./venv/lib/python3.8/site-packages (from scikit-build) (50.3.0)
Requirement already satisfied: wheel>=0.29.0 in ./venv/lib/python3.8/site-packages (from scikit-build) (0.35.1)
Collecting distro
  Using cached distro-1.5.0-py2.py3-none-any.whl (18 kB)
Collecting packaging
  Using cached packaging-20.4-py2.py3-none-any.whl (37 kB)
Collecting pyparsing>=2.0.2
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting six
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: distro, pyparsing, six, packaging, scikit-build
Successfully installed distro-1.5.0 packaging-20.4 pyparsing-2.4.7 scikit-build-0.11.1 six-1.15.0
(venv)
howie@jubjubuntu-ng:~/test-cv2
▶ pip install --no-binary :all: opencv-python
Collecting opencv-python
  Using cached opencv-python-4.4.0.44.tar.gz (88.9 MB)
  Installing build dependencies ... -
  {build continues to completion}

@skvark
Copy link
Member

skvark commented Oct 4, 2020

Thanks for the detailed logs. When you compare the tracebacks in this issue and in the output you provided you'll notice a difference.

Original error:

File "/tmp/pip-build-rnhk49o3/opencv-python/setup.py", line 9, in

vs. error you encountered:

File "/tmp/pip-install-796_mmlu/cmake/setup.py", line 7, in

This is a known issue in cmake and is not related to opencv-python directly. You can probably avoid it by running pip install --no-binary opencv-python opencv-python (replace :all: with opencv-python) so that pip will compile only opencv-python from sources and uses pre-built packages for the dependencies. If you need to compile the whole dependency tree from sources, then you must install scikit-build beforehand until the cmake issue has been solved.

@IMperiumX
Copy link

It's always because the too old pip, Thankx

@ajaykumaar
Copy link

@skvark Installing scikit-build before attempting to install opencv made opencv successful on my Raspberry Pi 4. My end goal is still to get stable-baselines to function properly, and it won't finish its install. However, it is no longer getting stopped by its opencv requirements. It is always one step forward and three steps back trying to get anything to work on Pis. I just thought I'd let you know that it at least seemed to install properly when I took care of the scikit-build requirement manually as such:

pip3 install scikit-build
pip3 install opencv-python

Hi, I'm still unable to install. I get the errror: TypeError: 'NoneType' object is not iterable
how do I resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants