" No module named 'dlib' " - howdy

I’m trying to add face unlock to my system but howdy needs dlib. and dlib cannot be installed with
pip.

I tried doing it the same way as numpy like
zypper in python311-numpy
but it doesn’t exist.

looking through yast, I do have python310-dlib installed but
pip show dlib says

WARNING: Package(s) not found: dlib

So… how do i install this dlib module?

My system is not prepared to compile C/C++ programs, so that part of the installation failed. But before that:

(venv) mennoh@192:~/python/test1> pip install dlib
Collecting dlib
  Downloading dlib-19.24.2.tar.gz (11.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.8/11.8 MB 2.1 MB/s eta 0:00:00
  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
  ╰─> [191 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Building extension for Python 3.11.5 (main, Sep 06 2023, 11:21:05) [GCC]

The building of the extension failed (of course), I spare you the output :dizzy_face:. The package does exist.

it exists yeah… but i can’t install with pip
pip install dlib

This environment is externally managed
╰─> To install Python packages system-wide, try
zypper install python311-xyz, where xyz is the package
you are trying to install.

If you read the whole message, it also tells you what to do to force installation using pip.

Can you tell me how? I’ve tried
zypper install python311-dlib

pip install dlib --break-system-packages

pipx install dlibx

All of them give some sort of error. What should I do then?

Normally you read the error message, determine the reason for it and fix it. If you post the full output, someone may even do it for you.

pipx install dlib

Fatal error from pip prevented installation. Full pip output in file:
/home/evirac/.local/pipx/logs/cmd_2023-10-16_17.39.20_pip_errors.log

pip failed to build package:
dlib

Some possibly relevant errors from pip install:
error: subprocess-exited-with-error
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/tmp/pip-install-wpihpg96/dlib_8629d13d112b423ea892485dd6865405/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-wpihpg96/dlib_8629d13d112b423ea892485dd6865405/build/lib.linux-x86_64-cpython-311’, ‘-DPYTHON_EXECUTABLE=/home/evirac/.local/pipx/venvs/dlib/bin/python’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1.

Error installing dlib.

pip install dlib --break-system-packages

Defaulting to user installation because normal site-packages is not writeable
Collecting dlib
Using cached dlib-19.24.2.tar.gz (11.8 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
╰─> [76 lines of output]
running bdist_wheel
running build
running build_ext
Building extension for Python 3.11.5 (main, Aug 31 2023, 07:57:41) [GCC]
Invoking CMake setup: ‘cmake /tmp/pip-install-26trbtvn/dlib_3f4010cc24c64df397d35087bc6fb066/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-26trbtvn/dlib_3f4010cc24c64df397d35087bc6fb066/build/lib.linux-x86_64-cpython-311 -DPYTHON_EXECUTABLE=/usr/bin/python3.11 -DCMAKE_BUILD_TYPE=Release’
– The C compiler identification is unknown
– The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:14 (project):
No CMAKE_C_COMPILER could be found.

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.
  
  
  CMake Error at CMakeLists.txt:14 (project):
    No CMAKE_CXX_COMPILER could be found.
  
    Tell CMake where to find the compiler by setting either the environment
    variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
    to the compiler, or to the compiler name if it is in the PATH.
  
  
  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 434, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
      exec(code, locals())
    File "<string>", line 218, in <module>
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 364, in run
      self.run_command("build")
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
      self.run_command(cmd_name)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-o_dlofpi/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "<string>", line 130, in run
    File "<string>", line 167, in build_extension
    File "/usr/lib64/python3.11/subprocess.py", line 413, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-26trbtvn/dlib_3f4010cc24c64df397d35087bc6fb066/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-26trbtvn/dlib_3f4010cc24c64df397d35087bc6fb066/build/lib.linux-x86_64-cpython-311', '-DPYTHON_EXECUTABLE=/usr/bin/python3.11', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
  [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

As was already mentoined by @mennoholscher, you need C++ compiler. E.g.

zypper install gcc-c++

It is quite possible that your software needs some more libraries. Check documentation for installation description and prerequisites.

You could also try to contact the maintainer of your python310-dlib package and ask, whether it is possible to build it for Python 3.11.

Okay, So what I did was zypper search dlib and install the one that matches dlib from pip which was python310-dlib but what I wanted was python311-dlib

but I didn’t find it but now I’ve found it here,

https://software.opensuse.org/package/python311-dlib

so my problem is solved🤦

The original may be solved, but likely you have created a new one waiting to bite you. Installing from software.opensuse.org commonly causes repos corruption. If you want to avoid being bitten, please post here input/output from sudo zypper lr -d either using PRE tags (</> icon above input window), or ~~~, on lines above and below it.

Many “solutions” create problems of their own. :wink:

opi uses a broader search:

erlangen:~ # opi python311-dlib
Searching repos for: python311-dlib
1. python311-dlib
Pick a number (0 to quit): 1
You have selected package name: python311-dlib
1. home:badshah400:howdy !                   | 19.24.2                   | x86_64
2. home:edogawa !                            | 19.24.2                   | x86_64
Pick a number (0 to quit): 
erlangen:~ # 

opi also warns about the repo and asks how to proceed.

evirac@localhost ~> sudo zypper lr -d
[sudo] password for root:

| Alias | Name | Enabled | GPG Check | Refresh | Priority | Type | URI | Service

—±--------------------------------±-------------------------------------------------------±--------±----------±--------±---------±-------±---------------------------------------------------------------------------------------------±-------
1 | brave-browser | Brave Browser | Yes | (r ) Yes | Yes | 99 | rpm-md | https://brave-browser-rpm-release.s3.brave.com/x86_64 |
2 | dmafanasyev | dmafanasyev | Yes | (r ) Yes | Yes | 99 | rpm-md | https://download.opensuse.org/repositories/home:/dmafanasyev/openSUSE_Tumbleweed |
3 | ftp.gwdg.de-openSUSE_Tumbleweed | Packman Repository | Yes | (r ) Yes | Yes | 99 | rpm-md | http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/ |
4 | home_badshah400_howdy | Pkgs needed to get Howdy working (openSUSE_Tumbleweed) | Yes | (r ) Yes | No | 99 | rpm-md | https://download.opensuse.org/repositories/home:/badshah400:/howdy/openSUSE_Tumbleweed/ |
5 | openSUSE-20230914-0 | openSUSE-20230914-0 | No | ---- | ---- | 99 | rpm-md | hd:/?device=/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_D067E51599A7F111E608444F-0:0-part2 |
6 | repo-debug | openSUSE-Tumbleweed-Debug | No | ---- | ---- | 99 | NONE | http://download.opensuse.org/debug/tumbleweed/repo/oss/ |
7 | repo-non-oss | openSUSE-Tumbleweed-Non-Oss | Yes | (r ) Yes | Yes | 99 | rpm-md | http://download.opensuse.org/tumbleweed/repo/non-oss/ |
8 | repo-openh264 | Open H.264 Codec (openSUSE Tumbleweed) | Yes | (r ) Yes | Yes | 99 | rpm-md | http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed |
9 | repo-oss | openSUSE-Tumbleweed-Oss | Yes | (r ) Yes | Yes | 99 | rpm-md | http://download.opensuse.org/tumbleweed/repo/oss/ |
10 | repo-source | openSUSE-Tumbleweed-Source | No | ---- | ---- | 99 | NONE | http://download.opensuse.org/source/tumbleweed/repo/oss/ |
11 | repo-update | openSUSE-Tumbleweed-Update | Yes | (r ) Yes | Yes | 99 | rpm-md | http://download.opensuse.org/update/tumbleweed/ |
12 | vscode | vscode | Yes | (r ) Yes | No | 99 | rpm-md | https://packages.microsoft.com/yumrepos/vscode

#5 should be removed or disabled for multiple reasons. e.g. it can lead to backleveling of newer packages that came from optional repos that are no longer available, and it can cause zypper to appear to hang when you don’t have the stick or can’t find it to have it attached when using zypper or YaST. Eventually a very large number of packages on it will have been superceded by patched versions from updates repos.

#2 & #4 are personal repos made public. Their content can change at whim, including disappearing. They are not subjected to standard QA. They may include newer versions of packages with unknown bugs that can conflict with standard packages. Rather than removing, better to simply disable them to help with tracking package inventory. You may want to upgrade from them later the same package(s) you previously installed from them. Do you know why you have them, or what packages you installed from these two repos?

yeah #2 and #4 are the ones I added for howdy. Ones I want for face authentication