GCC의 부재 시 발생 되는 에러
GIT을 설치할 때, 아래와 같은 에러가 발생할 수 있다.
root@p-ai-img-svr:/product# apt-get install git
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
git is already the newest version (1:2.34.1-1ubuntu1.10).
git set to manually installed.
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
root@p-ai-img-svr:/product# add-apt-repository ppa:git-core/ppa
PPA publishes dbgsym, you may need to include 'main/debug' component
위와 같이 에러가 난다면 gcc를 설치해야 한다.
root@p-ai-img-svr:/product# sudo apt-get install gcc
AUTO 설치 할 때 발생하는 오류
그리고 webui.sh 스크립트가 다운로드 받아진 것을 확인할 수 있다. 이 파일을 실행해본다.
root@p-ai-img-svr:/product# sh ./webui.sh
./webui.sh: 9: [[: not found
./webui.sh: 13: Bad substitution
./webui.sh: 17: [[: not found
./webui.sh: 26: [[: not found
./webui.sh: 33: [[: not found
./webui.sh: 39: [[: not found
./webui.sh: 45: [[: not found
./webui.sh: 51: [[: not found
./webui.sh: 57: [[: not found
./webui.sh: 62: [[: not found
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
./webui.sh: 94: [[: not found
#
Running on root user
#
./webui.sh: 106: [[: not found
./webui.sh: 114: [[: not found
./webui.sh: 131: Syntax error: redirection unexpected
root@p-ai-img-svr:/product#
뭔가 에러가 발생했다. root 계정으로 설치한 것이 문제가 된 거 같았다. 찾아보니 실제로 문제가 되었다.
실제로는 두가지의 문제가 있었다.
첫번째: 실행권한의 부재
복잡하게 싫은 난 모든 계정에게 모든 권한을 줘버렸다. (읽기, 쓰기, 실행 권한)
root@p-ai-img-svr:/product# ls -al
total 25452
drwxr-xr-x 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
-rw-r--r-- 1 root root 8098 Sep 6 01:12 webui.sh
root@p-ai-img-svr:/product# chmod 777 webui.sh
두번쨰: root 권한으로 실행하면 에러를 발생한다.
root@p-ai-img-svr:/product# ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
ERROR: This script must not be launched as root, aborting…
#
root@p-ai-img-svr:/product# ls
webui.sh
root@p-ai-img-svr:/product# ls -al
total 25452
drwxr-xr-x 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
-rwxrwxrwx 1 root root 8098 Sep 6 01:12 webui.sh
root@p-ai-img-svr:/product# chown gyeominater. webui.sh
root@p-ai-img-svr:/product# ls -al
total 25452
drwxr-xr-x 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
-rwxrwxrwx 1 gyeominater gyeominater 8098 Sep 6 01:12 webui.sh
root@p-ai-img-svr:/product#
root@p-ai-img-svr:/# exit
logout
즉, 개인 계정으로 설치해야 하기 때문에 위처럼 exit 로 로그 아웃한다. 그리고 webui.sh 스크립트 파일에 실행 권한을 준다. 이왕 주는 거 소유자, 그룹, 그외 모든 계정들에게 읽기, 쓰기, 실
세번째: 해당 디렉토리에서 실행 권한의 부재
gyeominater@p-ai-img-svr:/product$ ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
Running on gyeominater user
#
#
Clone stable-diffusion-webui
#
fatal: could not create work tree dir 'stable-diffusion-webui': Permission denie d
./webui.sh: line 192: cd: stable-diffusion-webui/: No such file or directory
ERROR: Can't cd to /product/stable-diffusion-webui/, aborting…gyeominater@p-ai gyeominater@p-ai-img-svr:/product$ mkdir aa
mkdir: cannot create directory ‘aa’: Permission denied
gyeominater@p-ai-img-svr:/product$ sudo su -
[sudo] password for gyeominater:
root@p-ai-img-svr:~# cd /product/
root@p-ai-img-svr:/product# ls
Python-3.10.9 Python-3.10.9.tgz webui.sh
root@p-ai-img-svr:/product# ls -al
total 25452
drwxr-xr-x 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
drwxr-xr-x 17 gyeominater gyeominater 4096 Sep 6 01:04 Python-3.10.9
-rw-rw-r-- 1 gyeominater gyeominater 26044345 Dec 6 2022 Python-3.10.9.tgz
-rwxrwxrwx 1 gyeominater gyeominater 8098 Sep 6 01:12 webui.sh
root@p-ai-img-svr:/product# cd ..
root@p-ai-img-svr:/# ls
bin boot data dev etc home lib lib32 lib64 libx32 log lost+found media mnt opt proc product root run sbin snap srv swap.img sys tmp usr var
root@p-ai-img-svr:/# ls -al
total 4194384
drwxr-xr-x 22 root root 4096 Sep 5 11:44 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
lrwxrwxrwx 1 root root 7 Aug 9 2022 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Sep 5 15:56 boot
drwxr-xr-x 2 root root 6 Sep 5 11:28 data
drwxr-xr-x 21 root root 4380 Sep 5 15:58 dev
drwxr-xr-x 104 root root 4096 Sep 6 01:00 etc
drwxr-xr-x 3 root root 4096 Sep 5 13:16 home
lrwxrwxrwx 1 root root 7 Aug 9 2022 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Aug 9 2022 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 Aug 9 2022 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 Aug 9 2022 libx32 -> usr/libx32
drwxr-xr-x 3 root root 4096 Sep 5 11:28 log
drwx------ 2 root root 16384 Sep 5 11:28 lost+found
drwxr-xr-x 2 root root 4096 Aug 9 2022 media
drwxr-xr-x 2 root root 4096 Aug 9 2022 mnt
drwxr-xr-x 2 root root 4096 Aug 9 2022 opt
dr-xr-xr-x 237 root root 0 Sep 5 15:58 proc
drwxr-xr-x 3 root root 68 Sep 6 01:20 product
drwx------ 5 root root 4096 Sep 6 01:23 root
drwxr-xr-x 33 root root 1000 Sep 6 01:00 run
lrwxrwxrwx 1 root root 8 Aug 9 2022 sbin -> usr/sbin
drwxr-xr-x 6 root root 4096 Aug 9 2022 snap
drwxr-xr-x 2 root root 4096 Aug 9 2022 srv
-rw------- 1 root root 4294967296 Sep 5 11:30 swap.img
dr-xr-xr-x 13 root root 0 Sep 5 15:58 sys
drwxrwxrwt 13 root root 4096 Sep 6 01:15 tmp
drwxr-xr-x 14 root root 4096 Aug 9 2022 usr
drwxr-xr-x 13 root root 4096 Aug 9 2022 var
root@p-ai-img-svr:/# chmod 777 product/
root@p-ai-img-svr:/# exit
logout
gyeominater@p-ai-img-svr:/product$ ls
Python-3.10.9 Python-3.10.9.tgz webui.sh
gyeominater@p-ai-img-svr:/product$ ls -al
total 25452
drwxrwxrwx 3 root root 68 Sep 6 01:20 .
drwxr-xr-x 22 root root 4096 Sep 5 11:44 ..
drwxr-xr-x 17 gyeominater gyeominater 4096 Sep 6 01:04 Python-3.10.9
-rw-rw-r-- 1 gyeominater gyeominater 26044345 Dec 6 2022 Python-3.10.9.tgz
-rwxrwxrwx 1 gyeominater gyeominater 8098 Sep 6 01:12 webui.sh
gyeominater@p-ai-img-svr:/product$
이렇게 보았을 때, 모든 문제는 3가지였다.
- webui.sh 가 위치하는 디렉토리에 777권한을 준다.
- webui.sh 파일 자체에 777권한을 준다.
- 개인 계정으로 webui.sh 를 실행한다.
PIP 설치가 되지 않았을 때
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
Running on gyeominater user
#
#
Repo already cloned, using it as install directory
#
#
Create and activate python venv
#
#
Launching launch.py…
#
Cannot locate TCMalloc (improves CPU memory usage)
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Installing torch and torchvision
/usr/bin/python3: No module named pip
Traceback (most recent call last):
File "/PRODUCT/sd-151/launch.py", line 48, in
main()
File "/PRODUCT/sd-151/launch.py", line 39, in main
prepare_environment()
File "/PRODUCT/sd-151/modules/launch_utils.py", line 352, in prepare_environment
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
File "/PRODUCT/sd-151/modules/launch_utils.py", line 115, in run
raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "/usr/bin/python3" -m pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118
Error code: 1
PIP 미 설치로 인한 에러가 위와 같이 발생했다. 그렇다면 간단하게 PIP를 설치 하면 된다. 아래와 같이 apt install 명령어를 통해서 설치를 진행하도록 하자. 그럼 간단히 PIP 설치를 하면 된다. 아래와 같이 설치 진행!!
PIP packaging 설치 필요 시 발생하는
다시 실행하면 아래와 같이 실행이 완료된다.
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
Running on gyeominater user
#
#
Repo already cloned, using it as install directory
#
#
Create and activate python venv
#
#
Launching launch.py…
#
.
(생략)
.
.
Installing clip
Installing open_clip
Installing requirements for CodeFormer
Traceback (most recent call last):
File "/PRODUCT/sd-151/launch.py", line 48, in
main()
File "/PRODUCT/sd-151/launch.py", line 39, in main
prepare_environment()
File "/PRODUCT/sd-151/modules/launch_utils.py", line 395, in prepare_environment
if not requirements_met(requirements_file):
File "/PRODUCT/sd-151/modules/launch_utils.py", line 282, in requirements_met
import packaging.version
ModuleNotFoundError: No module named 'packaging'
추가로 PIP packaging 모듈이 없다는 에러가 발생하는 데 이또한 설치해주면 끝이다. 아래와 같이 PIP 명령어를 통해 packaging을 설치해주자.
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ pip install packaging
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: packaging in /home/gyeominater/.local/lib/python3.10/site-packages (23.1)
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ sudo pip install packaging
Collecting packaging
Downloading packaging-23.1-py3-none-any.whl (48 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 KB 1.2 MB/s eta 0:00:00
Installing collected packages: packaging
Successfully installed packaging-23.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
## 위와 같이 정상적으로 설치가 완료되면 다시 webui.sh를 실행하여 확인한다.
gyeominater@p-sdsvr-01:/PRODUCT/sd-151$ ./webui.sh
#
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
#
#
Running on gyeominater user
#
#
Repo already cloned, using it as install directory
#
#
Create and activate python venv
#
#
Launching launch.py…
#
Cannot locate TCMalloc (improves CPU memory usage)
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Installing requirements
Launching Web UI with arguments: --listen --enable-insecure-extension-access
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
no module 'xformers'. Processing without…
no module 'xformers'. Processing without…
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /PRODUCT/sd-151/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL: http://0.0.0.0:7860
To create a public link, set share=True
in launch()
.
Startup time: 45.4s (prepare environment: 38.5s, import torch: 3.0s, import gradio: 0.8s, setup paths: 0.6s, initialize shared: 0.4s, other imports: 0.6s, load scripts: 0.5s, create ui: 0.7s, gradio launch: 0.2s).
Creating model from config: /PRODUCT/sd-151/configs/v1-inference.yaml
Applying attention optimization: Doggettx… done.
Model loaded in 4.5s (load weights from disk: 1.1s, create model: 0.8s, apply weights to model: 2.3s, calculate empty prompt: 0.1s).
최신 버전이 1.6.0 이다. 우리는 1.5.1 버전을 사용할 예정이다. 변경 방법은 아래의 링크를 통해 확인