ilian6806 / stable-diffusion-webui-eyemask

Stable Diffusion extension that marks eyes and faces
MIT License
54 stars 6 forks source link

CMake must be installed to build dlib #16

Open TWIISTED-STUDIOS opened 1 year ago

TWIISTED-STUDIOS commented 1 year ago

This is a very interesting error especially when inside the venv of SD CMAKE is already installed

Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Requirement already satisfied: cmake

and this is most of the error you recive, the rest is just the same thing over and over again when it trys to load the mask commands.

Couldn't install dlib.
Command: "E:\Artificial-Inteligence\Applications\ImageCreations\ImageGeneration\Automatic1111\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install dlib==19.24.0
Error code: 1
stdout: Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting dlib==19.24.0
  Downloading dlib-19.24.0.tar.gz (3.2 MB)
     ---------------------------------------- 3.2/3.2 MB 40.9 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py): started
  Building wheel for dlib (setup.py): finished with status 'error'
  Running setup.py clean for dlib
Failed to build dlib

stderr:   error: subprocess-exited-with-error

  python setup.py bdist_wheel did not run successfully.
  exit code: 1

  [7 lines of output]
  running bdist_wheel
  running build
  running build_py
  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
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects

----------------------------------------------
Failed building wheel for dlib
ERROR: CMake must be installed to build dlib
Install cmake from https://cmake.org/download/

It's an easy fix I just launch the env and directly install it pip install dlib and it's done but I thought you would like to know that the script is saying cmake isn't installed when it is so it cant build the wheel, but you can manually do it directly in the env.

ilian6806 commented 1 year ago

In the install.py script I install it in the sd way along with cmake:

run(f'"{python}" -m pip install cmake', desc="Installing cmake", errdesc="Couldn't install cmake")
run(f'"{python}" -m pip install dlib==19.24.0', desc="Installing dlib", errdesc="Couldn't install dlib")

Cmake is required to build dlib wheel. I install it in the venv but it seems that sometimes this do not work so I add this message in the install script to point the users to https://cmake.org/download/

I will look into this, thanks.

Sarolta commented 1 year ago

changing the dlib version to 19.24.1 in install.py seems to make it work-- not sure if the new version breaks anything. This is for ubuntu 23.04 installs.

      dlib==19.24.1
magestyx commented 1 year ago

I must've tried 50 different ways to get dlib installed but nothing seems to work (Windows 10, SD 1.4.0RC). I have Visual Studio Community 2022 and Visual Studio Build Tools 2022 installed (they seem to be redundant) along with scads of C++ Workloads and Individual Components.

I did try this one that seems to have worked for many but didn't for me: https://stackoverflow.com/questions/59336845/installation-of-dlib-with-pip-fails-on-windows-10

I think I finally got it working by downloading from source, compiling, and installing: https://github.com/ageitgey/face_recognition/issues/894#issuecomment-609104862

git clone https://github.com/davisking/dlib.git

cd dlib

mkdir build; cd build; cmake ..; cmake --build .

cd ..

python setup.py install

Maybe that'll save someone some time. dlib REALLY didn't want to install for me. Note that the last step he had python3 but that didn't work for me, just using 'python' did, though.

HazEaSSaSSin commented 1 year ago

This was actually really difficult for me to install - probably the one extension I had the most trouble with, and similar to when I started using Diffusion and had issues with WD Tagger and similar extensions (Prompt Travel was a nightmare). I don't use CMake at all, really, and so I was sort of out of my element. I kept getting random errors about CMake not having a compiler, or CMake needs to be installed to install dlib. I also wanted to keep most of the things I use for SD strictly within the python environment.

I had tried for hours probably, to get this extension to work, and just gave up. I came back to it and I was at the point of trying to manually compile dlib with the CMake GUI and I had no clue wtf I was doing. What I ended up doing was completely uninstalling Visual Studio and reinstalling it directly to the SD WebUI folder. For people more fluent with CMake, I'm sure this seems stupid but there are a lot of people, I imagine, that just want to start using SD but are code-illiterate. If you get these types of issues, I think it's important to ensure that your CMake knows where your C++ compiler is, typically installed along with Visual Studio in the installer. It seems my main issue was having Studio and CMake installed in separate drives and having no clue how to point CMake to the proper compiler. I'm also unsure as to whether or not you'd have these same issues if you installed CMake globally, but I was too worn out to try.

After I installed VS to the webUI folder, I deleted the venv folder and restarted it, and it worked flawlessly. This is a great extension @ilian6806 and thank you for your work on it.

After installing VS directly to WebUI folder ``` Creating venv in directory E:\stable-diffusion-webui\venv using python venv "E:\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: v1.4.0 Installing torch and torchvision Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu118 Collecting torch==2.0.1 Using cached https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp310-cp310-win_amd64.whl (2619.1 MB) Collecting torchvision==0.15.2 Using cached https://download.pytorch.org/whl/cu118/torchvision-0.15.2%2Bcu118-cp310-cp310-win_amd64.whl (4.9 MB) Collecting sympy Using cached sympy-1.12-py3-none-any.whl (5.7 MB) Collecting jinja2 Using cached https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl (133 kB) Collecting typing-extensions Using cached typing_extensions-4.7.0-py3-none-any.whl (33 kB) Collecting networkx Using cached networkx-3.1-py3-none-any.whl (2.1 MB) Collecting filelock Using cached filelock-3.12.2-py3-none-any.whl (10 kB) Collecting pillow!=8.3.*,>=5.3.0 Using cached Pillow-9.5.0-cp310-cp310-win_amd64.whl (2.5 MB) Collecting numpy Using cached numpy-1.25.0-cp310-cp310-win_amd64.whl (15.0 MB) Collecting requests Using cached requests-2.31.0-py3-none-any.whl (62 kB) Collecting MarkupSafe>=2.0 Using cached MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl (17 kB) Collecting idna<4,>=2.5 Using cached https://download.pytorch.org/whl/idna-3.4-py3-none-any.whl (61 kB) Collecting certifi>=2017.4.17 Using cached certifi-2023.5.7-py3-none-any.whl (156 kB) Collecting urllib3<3,>=1.21.1 Using cached urllib3-2.0.3-py3-none-any.whl (123 kB) Collecting charset-normalizer<4,>=2 Using cached charset_normalizer-3.1.0-cp310-cp310-win_amd64.whl (97 kB) Collecting mpmath>=0.19 Using cached mpmath-1.3.0-py3-none-any.whl (536 kB) Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision Successfully installed MarkupSafe-2.1.3 certifi-2023.5.7 charset-normalizer-3.1.0 filelock-3.12.2 idna-3.4 jinja2-3.1.2 mpmath-1.3.0 networkx-3.1 numpy-1.25.0 pillow-9.5.0 requests-2.31.0 sympy-1.12 torch-2.0.1+cu118 torchvision-0.15.2+cu118 typing-extensions-4.7.0 urllib3-2.0.3 [notice] A new release of pip available: 22.2.1 -> 23.1.2 [notice] To update, run: E:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip Installing gfpgan Installing clip Installing open_clip Installing xformers Collecting xformers==0.0.20 Using cached xformers-0.0.20-cp310-cp310-win_amd64.whl (97.6 MB) Installing collected packages: xformers Successfully installed xformers-0.0.20 [notice] A new release of pip available: 22.2.1 -> 23.1.2 [notice] To update, run: E:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip Installing requirements for CodeFormer Installing requirements Installing requirements for diffusers Installing requirements for segment_anything Installing requirements for lama_cleaner Installing requirements for ultralytics Installing sd-webui-segment-anything requirement: supervision Installing cmake Installing dlib Launching Web UI with arguments: --xformers ```
Tatsumaki after eye mask ![tatsu_original](https://github.com/ilian6806/stable-diffusion-webui-eyemask/assets/136451112/8b2797c3-9024-46f5-b74e-ae2a728fde78) ![tatsu_blue](https://github.com/ilian6806/stable-diffusion-webui-eyemask/assets/136451112/c287daf8-0ee7-436f-9187-72b38e7c6367)