AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: (Windows) Unable to create venv in directory #7661

Open Swiftl3lade opened 1 year ago

Swiftl3lade commented 1 year ago

Is there an existing issue for this?

What happened?

stablediffusionerror

I cant finish downloading stable diffusion dependencies on windows using the webui-user.bat file.

What I have tried:

Steps to reproduce the problem

Run the webui-user.bat

What should have happened?

The .bat should have started the downloading process.

Commit where the problem happens

cmd

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

no

List of extensions

no

Console logs

git pull
Already up to date.
Creating venv in directory E:\Stable Diffusion\test\stable-diffusion-webui\venv using python "C:\Users\baias\AppData\Local\Programs\Python\Python310\python.exe"
Unable to create venv in directory "E:\Stable Diffusion\test\stable-diffusion-webui\venv"

exit code: 1

stderr:
Error: Command '['E:\\Stable Diffusion\\test\\stable-diffusion-webui\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Launch unsuccessful. Exiting.
Press any key to continue . . .

Additional information

No response

ClashSAN commented 1 year ago

maybe it is some permission error for that hard drive? You are not using the main C drive. try creating a venv (you can delete it by deleting the folder after) in your chosen hard drive, to test if everything works.

  1. right click an empty spot, in your E drive, and "open in terminal"
  2. run python -m venv venv
Swiftl3lade commented 1 year ago

If i run the python -m venv venv command it throws the same error Error: Command '['E:\\Stable Diffusion\\test\\stable-diffusion-webui\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

And now apparently it doesn't work to do it in C: either

AlUlkesh commented 1 year ago

This almost looks like you're missing venv itself. You can try this, to see if it helps:

python -m pip install --user virtualenv

Swiftl3lade commented 1 year ago

$ python -m pip install --user virtualenv Collecting virtualenv Downloading virtualenv-20.19.0-py3-none-any.whl (8.7 MB) Requirement already satisfied: platformdirs<4,>=2.4 in c:\users\baias\appdata\local\programs\python\python310\lib\site-packages (from virtualenv) (2.5.0) Collecting distlib<1,>=0.3.6 Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB) Collecting filelock<4,>=3.4.1 Downloading filelock-3.9.0-py3-none-any.whl (9.7 kB) Installing collected packages: filelock, distlib, virtualenv WARNING: The script virtualenv.exe is installed in 'C:\Users\baias\AppData\Roaming\Python\Python310\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed distlib-0.3.6 filelock-3.9.0 virtualenv-20.19.0 WARNING: You are using pip version 20.3.3; however, version 23.0 is available. You should consider upgrading via the 'C:\Users\baias\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.

baias@DESKTOP-AKINH1E MINGW64 /e/Stable Diffusion/test/stable-diffusion-webui (master) $ python -m venv venv Error: Command '['E:\Stable Diffusion\test\stable-diffusion-webui\venv\Scripts\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

baias@DESKTOP-AKINH1E MINGW64 /c $ python -m venv venv Error: Command '['C:\venv\Scripts\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

So apparently the installation of virtualenv was successful but the venv command is throwing the same error in both C: and E:

AlUlkesh commented 1 year ago
WARNING: The script virtualenv.exe is installed in 'C:\Users\baias\AppData\Roaming\Python\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Can you put this in your path and see if it makes a difference?

Swiftl3lade commented 1 year ago

Well it is in PATH both C:\Users\baias\AppData\Roaming\Python\Python310 and C:\Users\baias\AppData\Roaming\Python\Python310\Scripts

izolyomi commented 1 year ago

I've just encountered exactly the same issue, none of the suggestions helped.

May it be related to having Python installed only for the local user without admin rights?

AlUlkesh commented 1 year ago

May it be related to having Python installed only for the local user without admin rights?

Unlikely, that's how my setup is too. Can you post your full console log? There could be a subtle difference in your case.

izolyomi commented 1 year ago

Both python and python/scripts are in my path. Interestingly, venv initialization succeeded after trying again some hours and logouts later.

PS D:\...\stable-diffusion-webui> python -m pip install --user virtualenv
Requirement already satisfied: virtualenv in c:\users\felhasználó\appdata\roaming\python\python311\site-packages (20.19.0)
Requirement already satisfied: distlib<1,>=0.3.6 in c:\users\felhasználó\appdata\roaming\python\python311\site-packages (from virtualenv) (0.3.6)
Requirement already satisfied: filelock<4,>=3.4.1 in c:\users\felhasználó\appdata\roaming\python\python311\site-packages (from virtualenv) (3.9.0)
Requirement already satisfied: platformdirs<4,>=2.4 in c:\users\felhasználó\appdata\roaming\python\python311\site-packages (from virtualenv) (3.0.0)

Note that I've trying running webui-users.bat, webui.bat and launch.py in multiple combinations, they now all seem to fail trying to get a proper pytorch.

> python.exe .\launch.py
==============================================================================================================
INCOMPATIBLE PYTHON VERSION

This program is tested with 3.10.6 Python, but you have 3.11.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.

You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3109/

Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases

Use --skip-python-version-check to suppress this warning.
==============================================================================================================
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Commit hash: d84f3cf7a7743bc91cd5ba524c76cf859e021b49
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: none)
ERROR: No matching distribution found for torch==1.13.1+cu117
Traceback (most recent call last):
  File "D:\...\stable-diffusion-webui\launch.py", line 360, in <module>
    prepare_environment()
  File "D:\...\stable-diffusion-webui\launch.py", line 269, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "D:\...\stable-diffusion-webui\launch.py", line 89, in run
    raise RuntimeError(f"""{errdesc or 'Error running command'}.
RuntimeError: Couldn't install torch.
Command: "C:\Users\...\AppData\Local\Programs\Python\Python311\python.exe" -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
Error code: 1
AlUlkesh commented 1 year ago

If you're running python.exe .\launch.py you're not activating the venv. In your case you are then using python 3.11 which is not compatible.

Please try again with webui-user.bat and post that console log.

izolyomi commented 1 year ago

I've downgraded to 3.10.10, now It seems to properly download pytorch. Thanks for the clarification. 👍

I'm quite surprised though, I'd really expect (especially for something as popular as Python) that semantic versioning, so that a minor version upgrade from 3.10 to 3.11 shouldn't break anything.

Mikehjx commented 1 year ago

May I use the cmd command to enter webui-user.bat and he has such an error? But my python is indeed in this path, my computer username is Hujxpro and in cmd it shows sniper711TEST? Please big brother help me 11231231231233

AlUlkesh commented 1 year ago

@Mikehjx From which path did you start webui-user?

BIBI0213 commented 1 year ago

I met the same error TAT,I don`t know what should I do.Please help me TT image

AlUlkesh commented 1 year ago

@BIBI0213 Judging by your directory name, do you really have Python 2.7 installed? That would be very old.

Try installing the 3.10.6 version: https://www.python.org/downloads/release/python-3106/

TinyVermin commented 1 year ago

I had the same issue. Here's what worked for me: Uninstall Python Reboot Install Python using custom installation In Advanced Options window activate the Install for all users checkbox

MilkDeLeche commented 1 year ago

i give up ....i really want to use stable diffusion but ive FIXED EVERYTHING I COULD . I fisrt got the NO ROBOTO font issue , then solved it . then i got the fatal error , not same user ip yadayada bs... THEN I GET THIS SHIT ModuleNotFoundError: No module named 'jsonmerge'

I cant bro ,....ive been up since 3 am its 3pm . I CANT ANYMORE. SOMEONE PLEASE HELP MEEEEEEEEEEE

Already up to date. venv "C:\Users\mange\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] Version: v1.3.0 Commit hash: 20ae71faa8ef035c31aa3a410b707d792c8203a3 Installing requirements Launching Web UI with arguments: No module 'xformers'. Proceeding without it. Traceback (most recent call last): File "C:\Users\mange\stable-diffusion-webui\launch.py", line 38, in main() File "C:\Users\mange\stable-diffusion-webui\launch.py", line 34, in main start() File "C:\Users\mange\stable-diffusion-webui\modules\launch_utils.py", line 330, in start import webui File "C:\Users\mange\stable-diffusion-webui\webui.py", line 49, in from modules import shared, sd_samplers, upscaler, extensions, localization, ui_tempdir, ui_extra_networks, config_states File "C:\Users\mange\stable-diffusion-webui\modules\sd_samplers.py", line 1, in from modules import sd_samplers_compvis, sd_samplers_kdiffusion, shared File "C:\Users\mange\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 4, in import k_diffusion.sampling File "C:\Users\mange\stable-diffusion-webui\repositories\k-diffusion\k_diffusion__init__.py", line 1, in from . import augmentation, config, evaluation, external, gns, layers, models, sampling, utils File "C:\Users\mange\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\config.py", line 6, in from jsonmerge import merge ModuleNotFoundError: No module named 'jsonmerge' Press any key to continue . . .

MilkDeLeche commented 1 year ago

I had the same issue. Here's what worked for me: Uninstall Python Reboot Install Python using custom installation In Advanced Options window activate the Install for all users checkbox

but that will add to PROGRAM FILES . and that doesnt work because it has a SPACE on it

klaushargreeves commented 1 year ago

Hello, This worked for me. I hope It can help you. https://www.youtube.com/watch?v=B5U7LJOvH6g

GitHubmembrane commented 1 year ago

i had an older version of python already installed. Once i uninstalled the older version it worked without needing to reinstall python 3,1 Check if you have an older version already on your system and uninstall it

DorrianGrey commented 1 year ago

Bro , i had the same problem . I solved it simply by creating new User on computer, installed python 3.10.6 and then repeated the same steps .

RocketHaom commented 1 year ago

Hello! I have a similar problem:

Creating venv in directory C:\Users\USERADMIN\stable-diffusion-webui\venv using python "C:\Users\USERADMIN\AppData\Local\Programs\Python\Python310\python.exe" Unable to create venv in directory "C:\Users\USERADMIN\stable-diffusion-webui\venv"

exit code: 3

stderr: The system cannot find the specified path.

Launch unsuccessful. Exiting. Press any key to continue . . .

As a relevant piece of information, I have Python version 3.10.6 installed. (Supposedly, I followed the installation instructions precisely, but when I reached the step of starting "webui-user.bat," I couldn't proceed due to this error...)

AlUlkesh commented 1 year ago

@RocketHaom What is the path of your auto1111? Is it C:\Users\USERADMIN\stable-diffusion-webui or something else?

barylapl commented 11 months ago

Hello! I have a similar problem:

Creating venv in directory C:\Users\USERADMIN\stable-diffusion-webui\venv using python "C:\Users\USERADMIN\AppData\Local\Programs\Python\Python310\python.exe" Unable to create venv in directory "C:\Users\USERADMIN\stable-diffusion-webui\venv"

exit code: 3

stderr: The system cannot find the specified path.

Launch unsuccessful. Exiting. Press any key to continue . . .

As a relevant piece of information, I have Python version 3.10.6 installed. (Supposedly, I followed the installation instructions precisely, but when I reached the step of starting "webui-user.bat," I couldn't proceed due to this error...)

I resolved the same problem by manually creating venv enviroment in stable diffusion folder (with help of @klaushargreeves comment) Here is what I did: Opened cmd in stable diffusion directory. ran this command: python -m venv venv

then I was able to install stable diffusion :)

MegaVaha commented 10 months ago

SOLUTION (for me): I discovered, that I have ALSO installed (some time ago) Python 2.7.17. So, in my case there is couple installed Pythons: 2.7.17 and 3.10.11. When launched webui-user.bat - got the same error. After discovering of presense of 2.7.17 - I just uninstalled it, and my issue with venv has gone.

Nightfall2077 commented 9 months ago

If i run the python -m venv venv command it throws the same error Error: Command '['E:\\Stable Diffusion\\test\\stable-diffusion-webui\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

And now apparently it doesn't work to do it in C: either

  • python -m venv venv
  • Error: Command '['C:\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Hello, please did you manage to solve this issue. The exact same thing is happening to me and I'm losing my mind slowly on trying to fix it

VitaliiBeardedDev commented 5 months ago

Is there an existing issue for this?

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

What happened?

stablediffusionerror

I cant finish downloading stable diffusion dependencies on windows using the webui-user.bat file.

What I have tried:

  • reinstalling python (3.10.6) and launcher (checked install for all users and add to PATH)
  • setting the python path in the webui-user.bat file as follows: set PYTHON="C:\Users\baias\AppData\Local\Programs\Python\Python310\python.exe" (I have tried without "" also)
  • opening the cmd as administrator and running the .bat
  • restarting the computer
  • removing the venv file each time its created but complete (after each run attempt)
  • cloning the project again

Steps to reproduce the problem

Run the webui-user.bat

What should have happened?

The .bat should have started the downloading process.

Commit where the problem happens

cmd

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

no

List of extensions

no

Console logs

git pull
Already up to date.
Creating venv in directory E:\Stable Diffusion\test\stable-diffusion-webui\venv using python "C:\Users\baias\AppData\Local\Programs\Python\Python310\python.exe"
Unable to create venv in directory "E:\Stable Diffusion\test\stable-diffusion-webui\venv"

exit code: 1

stderr:
Error: Command '['E:\\Stable Diffusion\\test\\stable-diffusion-webui\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

Launch unsuccessful. Exiting.
Press any key to continue . . .

Additional information

No response

I kept making the same mistakes.

  1. Always run the "stable-diffusion-webui-directml" folder on the command line as an administrator. How to run a specific folder as an administrator is up to you.
  2. The contents of webui-user.bat:

set PYTHON= C:\Python3106\python.exe (specify the path to python.exe )

3.Launch procedure : -run the "stable-diffusion-webui-directml" folder on the command line as an administrator -launch webui-user.bat

I 've tried everything . That's the only thing that helped. I use an RX580 8GB graphics card. Everything works with these settings. set COMMANDLINE_ARGS= --medvram --disable-nan-check --no-half --precision full --no-half-vae --opt-sub-quad-attention --opt-split-attention-v1

SecondBC commented 2 months ago

Making sure that your python version is 3.10.6 which is downloaded by https://www.python.org/downloads and the enviroment is correct, then you have to pip install with requirements_versions.txt and requirements.txt, finally, everything will be fine.