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

[Bug]: Cannot build wheel v19.24.4 #2943

Open
FedericoCozziVM opened this issue Apr 4, 2024 · 17 comments
Open

[Bug]: Cannot build wheel v19.24.4 #2943

FedericoCozziVM opened this issue Apr 4, 2024 · 17 comments

Comments

@FedericoCozziVM
Copy link

FedericoCozziVM commented Apr 4, 2024

What Operating System(s) are you seeing this problem on?

Linux (x86-64)

dlib version

19.24.4

Python version

3.10.12

Compiler

Cmake 3.29.0

Expected Behavior

It should install dlib at its latest version with pip installing syntax:

pip install --upgrade dlib

Current Behavior

pip install dlib

Collecting dlib
  Using cached dlib-19.24.4.tar.gz (3.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "/home/user/Desktop/venv/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      
      ERROR: CMake must be installed to build dlib
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
Failed to build dlib

Steps to Reproduce

pip install --upgrade pip
pip install ---upgrade wheel cmake
pip install dlib

Anything else?

(cmake is installed correctly and it successfully install dlib==19.24.2)

@davisking
Copy link
Owner

cmake isn't really installed right. Try apt install cmake. For whatever reason the version of cmake that comes from pip is broken on a lot of systems.

@FedericoCozziVM
Copy link
Author

@davisking Unfortunately I already tried that :( Running sudo apt install cmake gives me cmake is already the newest version (3.22.1-1ubuntu1.22.04.2)

@arrufat
Copy link
Contributor

arrufat commented Apr 4, 2024

Are you sure you're using the system-wide CMake instead of the one installed by pip?

@FedericoCozziVM
Copy link
Author

@arrufat you're right, I was using pip's one I guess, as you can see from the error traceback it takes it from virtualenv... however, I tried to uninstall it and the error is the same, this time taking the system-wide cmake (in /.local):

Collecting dlib
  Using cached dlib-19.24.4.tar.gz (3.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "/home/user/.local/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      
      ERROR: CMake must be installed to build dlib
      
      [end of output]

I checked, and the version installed in venv (via pip) was 3.29.0.1 and the system-wide is 3.25.2. Do you know how to force some cmake version during pip install command?

Also, I tried to re-install dlib==19.24.2 forcing it the build (pip install --no-cache-dir) and it ran correctly

@FedericoCozziVM
Copy link
Author

@arrufat that's what I tried, in fact the command in error comes from /home/user/.local/bin/cmake ... but still no success

@arrufat
Copy link
Contributor

arrufat commented Apr 4, 2024

I would try the following things

  • remove all cmake installations (until which cmake returns nothing)
  • build dlib in a new and clean virtualenv (python -m venv venv && source venv/bin/activate && pip install cmake==3.25 && pip install dlib)

FYI, I am using CMake 3.29.1 and it works fine.

@Goktug
Copy link

Goktug commented Apr 9, 2024

I am experiencing the same issue as well. dlib==19.24.2 is working fine but I am having an issue with the latest release.

P.S. Trying it in dockerized env.

@FedericoCozziVM
Copy link
Author

I still haven't solved it in my env, but I must say that it's probably a cmake installation issue as @arrufat and @davisking suggested. In fact, I tried to install everything from scratch in an Ubuntu docker image and version 19.24.4 is build and installed just fine

@escalate007
Copy link

I am experiencing the same issue as well. dlib==19.24.2 is working fine but I am having an issue with the latest release.

P.S. Trying it in dockerized env.

I tried again and again about 19.24.4 but failed, then follow your advice, replace it with 19.24.2 .It's working now.

@Yuanyuan-888
Copy link

I am using linux system, and now the cmake version is okay (>3.8)

However, I can not "pip install dlib"

It showed the following error " cmd_obj.run()
File "/tmp/pip-build-env-_31gghmv/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/tmp/pip-build-env-_31gghmv/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "/tmp/pip-build-env-_31gghmv/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 967, in run_command
super().run_command(command)
File "/tmp/pip-build-env-_31gghmv/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "", line 130, in run
File "", line 170, in build_extension
File "/opt/insy/miniconda/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j64']' returned non-zero exit status 2.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects"

I think the same with this bug --cannot build wheels for dlib.

@AlanFRL
Copy link

AlanFRL commented Apr 27, 2024

  • I had the same problems installing the face-recognition library and got it working after trying these versions of cmake and dlib:

pip install cmake==3.25.2
pip install dlib==19.24.2

  • I'm using a virtual environment with Python 3.9.1 and Windows 11, Also in python global I do not have cmake or dlib installed, only in my virtual environment

@Yuanyuan-888
Copy link

  • I had the same problems installing the face-recognition library and got it working after trying these versions of cmake and dlib:

pip install cmake==3.25.2 pip install dlib==19.24.2

  • I'm using a virtual environment with Python 3.9.1 and Windows 11, Also in python global I do not have cmake or dlib installed, only in my virtual environment

I am using linux system:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.9.2009 (Core)
Release: 7.9.2009
Codename: Core
This method did not work for me, still "ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects"

@davisking
Copy link
Owner

Try getting cmake from cmake.org and installing it with their official installer. The versions of cmake available in pip are often broken. I would really only use the official cmake.

@LTPPPP
Copy link

LTPPPP commented May 13, 2024

Collecting dlib
Using cached dlib-19.24.4.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
Building wheel for dlib (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for dlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
:210: SyntaxWarning: invalid escape sequence '('
:211: SyntaxWarning: invalid escape sequence '('
:212: SyntaxWarning: invalid escape sequence '('
running bdist_wheel
running build
running build_ext

  ERROR: CMake must be installed to build dlib

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects

help me, i have this problem when downloading dlib

@jeltiy
Copy link

jeltiy commented May 14, 2024

This worked for me (CentOS 8)

yum install python3-devel
yum groupinstall 'Development Tools'
pip install dlib

@LTPPPP
Copy link

LTPPPP commented May 15, 2024

but i use win 11

@davisking
Copy link
Owner

Cmake isn't installed correctly. You should get cmake from cmake.org. That will work. There are lot of other places that repackage it into semi-broken cmake installers. You probably have one of those.

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

9 participants