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

Closed
FedericoCozziVM opened this issue Apr 4, 2024 · 25 comments
Closed

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

FedericoCozziVM opened this issue Apr 4, 2024 · 25 comments
Labels

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.

@slothPete7773
Copy link

slothPete7773 commented May 31, 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

This worked out for me while developing for Python in Docker container. Manually changed the version of the package.

@nmww
Copy link

nmww commented Jun 12, 2024

win11

`pip install cmake==3.25.2

pip install dlib==19.24.2`

(CentOS 8)

`yum install python3-devel

yum groupinstall 'Development Tools'

pip install dlib`

@ben13300
Copy link

Dear ALL,
SAme issued.
UBUNTU : Ubuntu 24.04 LTS (Noble)
CMAKE installed with APT : cmake version 3.28.3
PIP INSTALL DLIB (19.24.2 or 19.24.4) : ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects
Could you please help me ?
Thanks

@ben13300
Copy link

Dear ALL, SAme issued. UBUNTU : Ubuntu 24.04 LTS (Noble) CMAKE installed with APT : cmake version 3.28.3 PIP INSTALL DLIB (19.24.2 or 19.24.4) : ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects Could you please help me ? Thanks

SOLVED WITH DOCKER.

@Sotatek-DuyHoang
Copy link

Sotatek-DuyHoang commented Jul 29, 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

I have this error when installing
pip install cmake==3.25.2 && pip install dlib==19.24.2
Collecting cmake==3.25.2
Using cached cmake-3.25.2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.8 kB)
Using cached cmake-3.25.2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.7 MB)
Installing collected packages: cmake
Successfully installed cmake-3.25.2
Collecting dlib==19.24.2
Using cached dlib-19.24.2.tar.gz (11.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
Traceback (most recent call last):
File "/home/miniconda3/envs/elegan/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/home/miniconda3/envs/elegan/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/sotatek/miniconda3/envs/elegan/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-jg7xvqok/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/pip-build-env-jg7xvqok/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-jg7xvqok/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "", line 190, in
ModuleNotFoundError: No module named 'setuptools.command.test'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

@dlib-issue-bot
Copy link
Collaborator

Warning: this issue has been inactive for 35 days and will be automatically closed on 2024-09-12 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

@dlib-issue-bot
Copy link
Collaborator

Warning: this issue has been inactive for 43 days and will be automatically closed on 2024-09-12 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

@dlib-issue-bot
Copy link
Collaborator

Notice: this issue has been closed because it has been inactive for 45 days. You may reopen this issue if it has been closed in error.

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

No branches or pull requests