AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
143k stars 26.95k forks source link

[Bug]: No module named pip #6260

Open wyl2000 opened 1 year ago

wyl2000 commented 1 year ago

Is there an existing issue for this?

What happened?

Any error happening after 'commit hash : XXXX' or 'Installing Torch...' bellow is not related to the launcher please report them on Automatic1111's github instead : ☁ https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/new/choose ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Cancel venv "D:\AI\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)] Commit hash: c0ee1488702d5a6ae35fbf7e0422f9f685394920 Installing torch and torchvision Traceback (most recent call last): File "D:\AI\stable-diffusion-webui\launch.py", line 294, in prepare_environment() File "D:\AI\stable-diffusion-webui\launch.py", line 206, in prepare_environment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") File "D:\AI\stable-diffusion-webui\launch.py", line 49, in run raise RuntimeError(message) RuntimeError: Couldn't install torch. Command: "D:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 Error code: 1 stdout: stderr: D:\AI\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip

请按任意键继续. . .

Steps to reproduce the problem

C:\Users\Administrator>python -m ensurepip Looking in links: c:\Users\ADMINI~1\AppData\Local\Temp\tmpzpu3l19d ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。 Consider using the --user option or check the permissions.

Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip__main__.py", line 5, in sys.exit(ensurepip._main()) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip__init.py", line 287, in _main return _bootstrap( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip\init.py", line 203, in _bootstrap return _run_pip([args, _PACKAGE_NAMES], additional_paths) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip\init.py", line 104, in _run_pip return subprocess.run(cmd, check=True).returncode File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpzpu3l19d\\setuptools-63.2.0-py3-none-any.whl\', \'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpzpu3l19d\\pip-22.2.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpzpu3l19d\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="main__", alter_sys=True)\n']' returned non-zero exit status 1.

What should have happened?

i don't know

Commit where the problem happens

win11 X64

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

Settings file found, loading
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 →   Updating Settings File
 ✓   SUCCESS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 i   Launcher Version 1.5.5
 i   Python 3.10 path found : C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe
 i   Git found at C:\Program Files\Git
 i   Git is in PATH
 i   Automatic1111 SD WebUI found at D:\AI\stable-diffusion-webui
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Opening A1111 WebUI Launcher
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 i   Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ↓   Updating Webui
fatal: unable to access 'https://github.com/AUTOMATIC1111/stable-diffusion-webui/': Recv failure: Connection was reset
 ✓   SUCCESS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 i   No extension found in the extensions folder
 i   Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  WEBUI LAUNCHING VIA EMS LAUNCHER, EXIT THIS WINDOW TO STOP THE WEBUI
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 !   Any error happening after 'commit hash : XXXX' or 'Installing Torch...' bellow is not related to the launcher please report them on Automatic1111's github instead :
 ☁   https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/new/choose
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Cancel
venv "D:\AI\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)]
Commit hash: c0ee1488702d5a6ae35fbf7e0422f9f685394920
Installing torch and torchvision
Traceback (most recent call last):
  File "D:\AI\stable-diffusion-webui\launch.py", line 294, in <module>
    prepare_environment()
  File "D:\AI\stable-diffusion-webui\launch.py", line 206, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
  File "D:\AI\stable-diffusion-webui\launch.py", line 49, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install torch.
Command: "D:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
Error code: 1
stdout: <empty>
stderr: D:\AI\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip

请按任意键继续. . .

Additional information, context and logs

Settings file found, loading ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ → Updating Settings File ✓ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ i Launcher Version 1.5.5 i Python 3.10 path found : C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe i Git found at C:\Program Files\Git i Git is in PATH i Automatic1111 SD WebUI found at D:\AI\stable-diffusion-webui ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Opening A1111 WebUI Launcher ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ i Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ↓ Updating Webui fatal: unable to access 'https://github.com/AUTOMATIC1111/stable-diffusion-webui/': Recv failure: Connection was reset ✓ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ i No extension found in the extensions folder i Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ WEBUI LAUNCHING VIA EMS LAUNCHER, EXIT THIS WINDOW TO STOP THE WEBUI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Any error happening after 'commit hash : XXXX' or 'Installing Torch...' bellow is not related to the launcher please report them on Automatic1111's github instead : ☁ https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/new/choose ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Cancel venv "D:\AI\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)] Commit hash: c0ee1488702d5a6ae35fbf7e0422f9f685394920 Installing torch and torchvision Traceback (most recent call last): File "D:\AI\stable-diffusion-webui\launch.py", line 294, in prepare_environment() File "D:\AI\stable-diffusion-webui\launch.py", line 206, in prepare_environment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") File "D:\AI\stable-diffusion-webui\launch.py", line 49, in run raise RuntimeError(message) RuntimeError: Couldn't install torch. Command: "D:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 Error code: 1 stdout: stderr: D:\AI\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip

请按任意键继续. . .

aliencaocao commented 1 year ago

try python3 -m ensurepip

max14354 commented 1 year ago

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

LightningStalker commented 1 year ago

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

Wow that just deleted a whole 2GiB of stuff that has to be redownloaded.

Ucda1212 commented 1 year ago

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

Worked for me.

ks374 commented 1 year ago

try python3 -m ensurepip

Thanks it works

robertbkuhn commented 1 year ago

worked for me as well

wyl2000 commented 1 year ago

If it's a user from mainland China it's like this, you have to use a VPN for global proxy to finish the installation properly, reinstall with wireguard and it's normal. The very VPN global proxy will disconnect the network connection. Damn GFW

SetriaphTFK commented 1 year ago

try python3 -m ensurepip

how does one do that? this means nothing to me

notedboi commented 1 year ago

Are you using windows education edition? might be because windows defender messes up with py and under education edition user can't turn it off

SetriaphTFK commented 1 year ago

Are you using windows education edition? might be because windows defender messes up with py and under education edition user can't turn it off

No I just didn't realize python3 -m ensurepip just meant "run it through cmd," then it hit me like a baseball bat.

Kostazs commented 1 year ago

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

how can I locate and delete my venv directory?

Amirhj110 commented 1 year ago

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

It was that easy. I spent a week trying to install SD then i gave up thought it just all nonsense. Then again for photoshop i neede SD so i started trying different ways but still the same problem happened. But then out of couriosity i tried your solution although it seems like unreal and it all worked well then. Thank you so much

ikeszvpvb9ye commented 1 year ago

Same problem. I downloaded release 1.1.0, created an environment for webui in conda and activated it.

Launching (stable-diffusion-webui) D:\Users\username\anaconda3>"F:\stable-diffusion-webui-1.1.0\webui-user.bat"

All dependencies are installed without errors, the application starts.

On the second run I get an error

exit code: 1
stderr:
D:\Users\username\anaconda3\envs\stable-diffusion-webui\python.exe: No module named pip
Launch unsuccessful. Exiting.

Win11x64

Hamster333sk commented 1 year ago

try python3 -m ensurepip

Didnt work invalid syntax

sametalkis commented 1 year ago

Go to stable-diffusion-webui\venv\Scripts folder and open python.exe and use the following code

import ensurepip
ensurepip.bootstrap()

pip is loading so the problem is solved and you can now run webui.bat

ikeszvpvb9ye commented 1 year ago

When run webui-user.bat from CONDA environment

This solves the problem of initial installation and subsequent launches of the application. pip itself remains broken

change webui-user.bat

set PYTHON=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui\python.exe set GIT= set VENV_DIR=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui set COMMANDLINE_ARGS= call "F:\stable-diffusion-webui-1.3.2\webui.bat"

change webui.bat

:launch %PYTHON% "F:\stable-diffusion-webui-1.3.2\launch.py" %* pause exit /b

:accelerate_launch echo Accelerating %ACCELERATE% launch --num_cpu_threads_per_process=6 "F:\stable-diffusion-webui-1.3.2\launch.py" pause exit /b

CHANGE LINE 12 if %ERRORLEVEL% == 0 goto :start_venv

AND DROP SECTION :check_pip

XiaoWei1075 commented 1 year ago

Delete the venv directory and then restart the webui.bat. Successfully. Error reason: venv目录下缺失相关文件

leantli commented 11 months ago

Solutions that actually work, not the so-called python3 -m ensurepip and deleting your "venv" directory. thx very much, solved a problem that had been bothering me all night!

Same problem. I downloaded release 1.1.0, created an environment for webui in conda and activated it.

Launching (stable-diffusion-webui) D:\Users\username\anaconda3>"F:\stable-diffusion-webui-1.1.0\webui-user.bat"

All dependencies are installed without errors, the application starts.

On the second run I get an error

exit code: 1
stderr:
D:\Users\username\anaconda3\envs\stable-diffusion-webui\python.exe: No module named pip
Launch unsuccessful. Exiting.

Win11x64

When run webui-user.bat from CONDA environment

This solves the problem of initial installation and subsequent launches of the application. pip itself remains broken

change webui-user.bat

set PYTHON=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui\python.exe set GIT= set VENV_DIR=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui set COMMANDLINE_ARGS= call "F:\stable-diffusion-webui-1.3.2\webui.bat"

change webui.bat

:launch %PYTHON% "F:\stable-diffusion-webui-1.3.2\launch.py" %* pause exit /b

:accelerate_launch echo Accelerating %ACCELERATE% launch --num_cpu_threads_per_process=6 "F:\stable-diffusion-webui-1.3.2\launch.py" pause exit /b

CHANGE LINE 12 if %ERRORLEVEL% == 0 goto :start_venv

AND DROP SECTION :check_pip

ikeszvpvb9ye commented 11 months ago

Is there any progress towards creating an adequately launchable installer and running the application on the conda environment? No dancing with tambourines

ikeszvpvb9ye commented 11 months ago

answering the question 'Why:' ummm, this is my business requirement, it’s more convenient for me

I don’t plan to tear up a virtual machine or even a container for this buggy “product”, nor do I plan to litter my personal host with a carload of Python packages I don’t need

I have a conda build based on the current pyTorch for my hardware, which I deploy via Ctrl+C Ctrl+V, I didn’t like it - I deleted it, Ctrl+V again

NULL-Response commented 10 months ago

In my condition, I changed webui-user.sh, added: export TORCH_COMMAND="pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118" In venv python, pip isnt linked to pip3, so I changed pip3 into pip, solved it.

KatarinaMilkers commented 6 months ago

how do I delete the venv? Where is it? Where do I type what?