LocalAI
LocalAI copied to clipboard
Manual make/build with stablediffusion fails
LocalAI version: CommitID from 25.05.2023: babbd2374430581bbe10bd24cbf0f9c4693a3d05
Environment, CPU architecture, OS, and Version: Linux ASU 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Describe the bug Fails in: In file included from stablediffusion.cpp:11: ./stable-diffusion/x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo/decoder_slover.h:11:10: fatal error: opencv2/opencv.hpp: No such file or directory 11 | #include <opencv2/opencv.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
To Reproduce make GO_TAGS=stablediffusion rebuild
Expected behavior Should compile.
Logs ... cp -rf overrides/* stable-diffusion/x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo/ g++ -I./ncnn -I./ncnn/src -I./ncnn/build/src/ -I. -I./stable-diffusion/x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo -O3 -DNDEBUG -std=c++17 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function stablediffusion.cpp -o stablediffusion.o -c In file included from stablediffusion.cpp:11: ./stable-diffusion/x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo/decoder_slover.h:11:10: fatal error: opencv2/opencv.hpp: No such file or directory 11 | #include <opencv2/opencv.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:28: stablediffusion.o] Error 1 make[2]: Leaving directory '/var/www/local-ai/go-stable-diffusion' make[1]: *** [Makefile:93: go-stable-diffusion/libstablediffusion.a] Error 2 make[1]: Leaving directory '/var/www/local-ai' make: *** [Makefile:183: rebuild] Error 2
You need to install some dev librairies on your environment. Take inspiration from this PR #277 which fixes the problem on the Debian11 distro used by the Docker image
:warning::warning::warning::warning::warning:
Hi! I'm a bot running with LocalAI ( a crazy experiment of @mudler ) - please beware that I might hallucinate sometimes!
but.... I can also be funny or helpful :smile_cat: and I can provide generally speaking good tips or places where to look after in the documentation or in the code based on what you wrote in the issue.
Don't engage in conversation with me, I don't support (yet) replying!
:warning::warning::warning::warning::warning:
The issue seems to be related to the missing opencv.hpp file in the path when compiling the code. It is possible that the installation of OpenCV is not complete or outdated. To fix this, you can try the following steps:
- Check if the OpenCV package is installed correctly by running the command
pip install opencv-python. If it is already installed, try upgrading it to the latest version usingpip install --upgrade opencv-python. - Make sure that the path to the OpenCV header files is correct in the code by checking the value of the
OPENCV_ROOTvariable in theMakefile. You can modify this variable to point to the correct directory if needed. - If the issue persists, try reinstalling the
stable-diffusionpackage usingpip install --no-cache-dir stable-diffusion==0.1.0. This will download the package from PyPI and ensure that all dependencies are installed correctly.
Sources:
- https://github.com/go-skynet/LocalAI/tree/master/.github/workflows/image.yml
- https://github.com/go-skynet/LocalAI/tree/master/Dockerfile
- https://github.com/go-skynet/LocalAI/tree/master/.github/workflows/test.yml
⚠️⚠️⚠️⚠️⚠️
Hi! I'm a bot running with LocalAI ( a crazy experiment of @mudler ) - please beware that I might hallucinate sometimes!
but.... I can also be funny or helpful 😸 and I can provide generally speaking good tips or places where to look after in the documentation or in the code based on what you wrote in the issue.
Don't engage in conversation with me, I don't support (yet) replying!
⚠️⚠️⚠️⚠️⚠️
The issue seems to be related to the missing opencv.hpp file in the path when compiling the code. It is possible that the installation of OpenCV is not complete or outdated. To fix this, you can try the following steps:
- Check if the OpenCV package is installed correctly by running the command
pip install opencv-python. If it is already installed, try upgrading it to the latest version usingpip install --upgrade opencv-python.- Make sure that the path to the OpenCV header files is correct in the code by checking the value of the
OPENCV_ROOTvariable in theMakefile. You can modify this variable to point to the correct directory if needed.- If the issue persists, try reinstalling the
stable-diffusionpackage usingpip install --no-cache-dir stable-diffusion==0.1.0. This will download the package from PyPI and ensure that all dependencies are installed correctly.Sources:
- https://github.com/go-skynet/LocalAI/tree/master/.github/workflows/image.yml
- https://github.com/go-skynet/LocalAI/tree/master/Dockerfile
- https://github.com/go-skynet/LocalAI/tree/master/.github/workflows/test.yml
stable-diffusion==0.1.0 package not exist in PyPI not even in the indicated sources it seems like you just hallucinate:
https://github.com/go-skynet/LocalAI/tree/master/.github/workflows/image.yml https://github.com/go-skynet/LocalAI/tree/master/Dockerfile https://github.com/go-skynet/LocalAI/tree/master/.github/workflows/test.yml