dlib icon indicating copy to clipboard operation
dlib copied to clipboard

[Bug]: Cannot build wheel v19.24.4

Open FedericoCozziVM opened this issue 10 months ago • 22 comments

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)

FedericoCozziVM avatar Apr 04 '24 10:04 FedericoCozziVM

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.

davisking avatar Apr 04 '24 11:04 davisking

@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)

FedericoCozziVM avatar Apr 04 '24 13:04 FedericoCozziVM

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

arrufat avatar Apr 04 '24 13:04 arrufat

@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 avatar Apr 04 '24 13:04 FedericoCozziVM

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

FedericoCozziVM avatar Apr 04 '24 14:04 FedericoCozziVM

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.

arrufat avatar Apr 04 '24 14:04 arrufat

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.

Goktug avatar Apr 09 '24 07:04 Goktug

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

FedericoCozziVM avatar Apr 09 '24 08:04 FedericoCozziVM

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.

escalate007 avatar Apr 19 '24 01:04 escalate007

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.

Yuanyuan-888 avatar Apr 24 '24 15:04 Yuanyuan-888

  • 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

AlanFRL avatar Apr 27 '24 04:04 AlanFRL

  • 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"

Yuanyuan-888 avatar Apr 27 '24 06:04 Yuanyuan-888

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.

davisking avatar Apr 27 '24 13:04 davisking

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

LTPPPP avatar May 13 '24 16:05 LTPPPP

This worked for me (CentOS 8)

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

jeltiy avatar May 14 '24 11:05 jeltiy

but i use win 11

LTPPPP avatar May 15 '24 10:05 LTPPPP

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.

davisking avatar May 15 '24 11:05 davisking

  • 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.

slothPete7773 avatar May 31 '24 08:05 slothPete7773

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`

nmww avatar Jun 12 '24 08:06 nmww

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 avatar Jun 19 '24 11:06 ben13300

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.

ben13300 avatar Jun 25 '24 14:06 ben13300

  • 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.

DuySota avatar Jul 29 '24 03:07 DuySota

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 avatar Sep 02 '24 08:09 dlib-issue-bot

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 avatar Sep 10 '24 08:09 dlib-issue-bot

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.

dlib-issue-bot avatar Sep 12 '24 08:09 dlib-issue-bot