Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No module named pip #6260

Open
1 task done
wyl2000 opened this issue Jan 3, 2023 · 21 comments
Open
1 task done

[Bug]: No module named pip #6260

wyl2000 opened this issue Jan 3, 2023 · 21 comments
Labels
asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance

Comments

@wyl2000
Copy link

wyl2000 commented Jan 3, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

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: c0ee148
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\\ADMINI1\\AppData\\Local\\Temp\\tmpzpu3l19d\\setuptools-63.2.0-py3-none-any.whl', 'C:\\Users\\ADMINI1\\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: c0ee148
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

请按任意键继续. . .

@wyl2000 wyl2000 added the bug-report Report of a bug, yet to be confirmed label Jan 3, 2023
@aliencaocao
Copy link
Contributor

try python3 -m ensurepip

@max14354
Copy link

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

@mezotaken mezotaken added asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance and removed bug-report Report of a bug, yet to be confirmed labels Jan 12, 2023
@LightningStalker
Copy link

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
Copy link

Ucda1212 commented Feb 9, 2023

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
Copy link

ks374 commented Feb 21, 2023

try python3 -m ensurepip

Thanks it works

@robertbkuhn
Copy link

worked for me as well

@wyl2000
Copy link
Author

wyl2000 commented Mar 18, 2023

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
Copy link

SetriaphTFK commented Mar 18, 2023

try python3 -m ensurepip

how does one do that? this means nothing to me

@notedboi
Copy link

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
Copy link

SetriaphTFK commented Mar 19, 2023

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
Copy link

Kostazs commented Mar 19, 2023

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
Copy link

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
Copy link

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
Copy link

try python3 -m ensurepip

Didnt work invalid syntax

@sametalkis
Copy link

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
Copy link

ikeszvpvb9ye commented Jun 20, 2023

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
Copy link

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

@leantli
Copy link

leantli commented Dec 15, 2023

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
Copy link

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

@ikeszvpvb9ye
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance
Projects
None yet
Development

No branches or pull requests