Skip to content

Cmake error: ModuleNotFoundError: No module named 'skbuild' #103

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

Closed
armunday opened this issue May 28, 2020 · 12 comments
Closed

Cmake error: ModuleNotFoundError: No module named 'skbuild' #103

armunday opened this issue May 28, 2020 · 12 comments
Labels
Type: Bug Something's not working correctly.

Comments

@armunday
Copy link

armunday commented May 28, 2020

I have been troubleshooting this error for a day and a half now to no avail. Not sure what is going on. I saw a solved issue but those fixes are not working for me. Below is the error code.

Collecting line_profiler
  Using cached line_profiler-3.0.2.tar.gz (45 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\DisasterConsult\COVID-19-Disaster-Consult\venv\Scripts\python.exe' 'C:\DisasterConsult\COVID-19-Disaster-Consult\venv\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\12066\AppData\Local\Temp\pip-build-env-yt9ionzt\overlay' --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=41.0.1' wheel Cython 'scikit-build>=0.9.0' cmake ninja
       cwd: None
  Complete output (21 lines):
  Collecting setuptools>=41.0.1
    Using cached setuptools-47.1.0.zip (870 kB)
  Collecting wheel
    Using cached wheel-0.34.2.tar.gz (58 kB)
  Collecting Cython
    Using cached Cython-0.29.19.tar.gz (2.1 MB)
  Collecting scikit-build>=0.9.0
    Using cached scikit-build-0.11.1.tar.gz (132 kB)
  Collecting cmake
    Using cached cmake-3.17.2.tar.gz (28 kB)
      ERROR: Command errored out with exit status 1:
       command: 'C:\DisasterConsult\COVID-19-Disaster-Consult\venv\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\12066\\AppData\\Local\\Temp\\pip-install-lbq2lcg6\\cmake\\setup.py'"'"'; __file__='"'"'C:\\Users\\12066\\AppData\\Local\\Temp\\pip-install-lbq2lcg6\\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 'C:\Users\12066\AppData\Local\Temp\pip-pip-egg-info-9b0a6ibk'
           cwd: C:\Users\12066\AppData\Local\Temp\pip-install-lbq2lcg6\cmake\
      Complete output (5 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "C:\Users\12066\AppData\Local\Temp\pip-install-lbq2lcg6\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: 'C:\DisasterConsult\COVID-19-Disaster-Consult\venv\Scripts\python.exe' 'C:\DisasterConsult\COVID-19-Disaster-Consult\venv\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\12066\AppData\Local\Temp\pip-build-env-yt9ionzt\overlay' --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=41.0.1' wheel Cython 'scikit-build>=0.9.0' cmake ninja Check the logs for full command output.
@armunday
Copy link
Author

I have C++ Build Tools installed, I have cmake installed and it is in my environment variables. Just have no clue what is happening

@jcfr
Copy link
Contributor

jcfr commented Jun 5, 2020

It looks like you are installing the line_profiler package (either directly or indirectly by installing an other package having line_profiler as a dependency)

As we can see here, the latest version of line_profiler do not provide window wheels (file with the .whl extension).

A wheel is a convenient "archive" containing everything ready to be installed for the current platform.

Considering there are no convenient .whl file for windows, python try to build the wheel locally before installing it.

For some reason, on your platform .. it also tries to build cmake wheel from source. Which is strange because, we provide wheel for windows. See https://pypi.org/project/cmake/#files

We can see here the build time dependencies.

For convenience, here is the content of requirements/build.txt :

Cython
scikit-build
cmake
ninja

@jcfr
Copy link
Contributor

jcfr commented Jun 5, 2020

What happen if you run the following:

python --version
python -m pip install cmake

@jcfr jcfr added the Status: Awaiting response ⏳ Waiting for a response/more information label Jun 5, 2020
@henryiii
Copy link
Contributor

Can you try updating pip (should be trivial in the virtual environment, and if that doesn't work by itself, with --prefer-binary? Also try purging your cache, just in case. I see a --no-binary :all: --only-binary :none: which sounds like it is turning off all binaries.

@econchick
Copy link

Hey there - came across this issue myself today trying to install line_profiler. It also happens when I just try to install cmake directly as well. However, using --prefer-binary seems to resolve it.

I'm on macOS 10.15.6.

(env) $ python -V
3.6.11
(env) $ pip list
Package    Version
---------- -------
pip        20.2.2
setuptools 49.6.0
(env) $ pip install cmake --no-cache-dir # same with python -m pip install cmake --no-cache-dir
Collecting cmake
  Using cached cmake-3.18.2.tar.gz (28 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/lynn/.pyenv/versions/3.6.11/envs/tmp-cmake/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/g0/7rcby3gn13d06kt_3vtvz3gw0000gn/T/pip-install-00r12zvs/cmake/setup.py'"'"'; __file__='"'"'/private/var/folders/g0/7rcby3gn13d06kt_3vtvz3gw0000gn/T/pip-install-00r12zvs/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 /private/var/folders/g0/7rcby3gn13d06kt_3vtvz3gw0000gn/T/pip-pip-egg-info-5e2ydx33
         cwd: /private/var/folders/g0/7rcby3gn13d06kt_3vtvz3gw0000gn/T/pip-install-00r12zvs/cmake/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/g0/7rcby3gn13d06kt_3vtvz3gw0000gn/T/pip-install-00r12zvs/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.
(env) $ pip install cmake --no-cache-dir --prefer-binary
Collecting cmake
  Downloading cmake-3.18.0-py3-none-macosx_10_6_x86_64.whl (43.0 MB)
     |████████████████████████████████| 43.0 MB 8.7 MB/s
Installing collected packages: cmake
Successfully installed cmake-3.18.0

(same thing happens when installing line_profiler: --prefer-binary works)

@henryiii
Copy link
Contributor

henryiii commented Aug 21, 2020

This is because of #112 , there is no binary for 3.18.2 for CMake on macOS with Python 3.

You can also set PIP_ONLY_BINARY="cmake" in your environment, or --only-binary cmake.

@henryiii
Copy link
Contributor

This would be very much improved if there was a pyproject.toml file. Then you might fail due to missing system libraries, but not due to "scikit-build" missing. Currently, inside a pyproject.toml file including cmake, it is impossible to build from source, since it creates a temporary virtual environment for building with just the items listed in this file, and then when trying to build cmake, scikit-build is not available (in the new, temporary environment), so it doesn't work.

@skvark
Copy link

skvark commented Oct 4, 2020

I would also recommend to add pyproject.toml to this project. For example, this case could have been avoided with pyproject.toml: opencv/opencv-python#387 (comment)

@jcfr
Copy link
Contributor

jcfr commented Nov 11, 2020

I would also recommend to add pyproject.toml to this project. For example, this case could have been avoided with pyproject.toml

@skvark :

  • Arm64 wheel should be available in the next 30mins or so
  • we also added pyproject.toml (thanks @yoav-orca for the contribution)
  • I created an issue so that we update the build system to display a warning when the wheel is built from source as this should be reported so that we can add support for distributing the corresponding wheel.

@skvark
Copy link

skvark commented Nov 12, 2020

Thanks!

@henryiii
Copy link
Contributor

This should be solved now!

@henryiii
Copy link
Contributor

(Where now might mean some time ago, or with the 3.20.2 release)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something's not working correctly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants