sd-webui-roop
sd-webui-roop copied to clipboard
ModuleNotFoundError: No module named 'launch' 求求了
PS D:\Code\Python\sd-webui-roop-main> & C:/Users/Administrator/AppData/Local/Programs/Python/Python38/python.exe d:/Code/Python/sd-webui-roop-main/install.py
Traceback (most recent call last):
File "d:/Code/Python/sd-webui-roop-main/install.py", line 1, in
Replace the contents of install.py
with the following and run python install.py
again. The script below replaces the dependency on the launch
module with the native subprocess
to install the project dependencies.
import os
import subprocess
import sys
from tqdm import tqdm
import urllib.request
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
models_dir = os.path.abspath("models/roop")
model_url = "https://github.com/dream80/roop_colab/releases/download/v0.0.1/inswapper_128.onnx"
model_name = os.path.basename(model_url)
model_path = os.path.join(models_dir, model_name)
def download(url, path):
request = urllib.request.urlopen(url)
total = int(request.headers.get('Content-Length', 0))
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
urllib.request.urlretrieve(url, path, reporthook=lambda count, block_size, total_size: progress.update(block_size))
if not os.path.exists(models_dir):
os.makedirs(models_dir)
if not os.path.exists(model_path):
download(model_url, model_path)
try:
subprocess.run(["pip", "install", "-r", req_file], check=True)
except subprocess.CalledProcessError as e:
print(f"Failed to install requirements: {e.stderr.decode('utf-8')}")
sys.exit(1)
I encountered an issue while running the install.py
The script failed with a FileNotFoundError
Traceback (most recent call last):
File "C:\PYTHON\auto1111\stable-diffusion-webui\extensions\sd-webui-roop\install.py", line 27, in
subprocess.run(["pip", "install", "-r", req_file], check=True)
File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1440, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
I managed to resolve this by modifying the subprocess.
subprocess.run([sys.executable, "-m", "pip", "install", "-r", req_file], check=True)
pip install --upgrade setuptools
solved my problem