AI-Friends icon indicating copy to clipboard operation
AI-Friends copied to clipboard

Error on Install win11 (Python not found)

Open bbecausereasonss opened this issue 2 years ago • 8 comments

image

bbecausereasonss avatar Aug 29 '23 14:08 bbecausereasonss

Interesting, that's in the sdd-venv.bat file where it seems it couldn't create the ./venv folder using "python3 -m venv .\venv", so it gave DirectoryNotFound unable to download into the venv folder. A few things could be causing that, first thought is it can't find the python3.exe file in the path. I'm thinking when you installed Python from the python.org site, you didn't check the box "Add Python 3.x to PATH", so you could try reinstalling or manually adding to Environment Paths.. This thread had a bunch of suggestions for fixing this error: https://stackoverflow.com/questions/65348890/python-was-not-found-run-without-arguments-to-install-from-the-microsoft-store I'm also thinking you don't have the python3 file in path.. I'm thinking about replacing that with "py -3" launcher shortcut instead, which looks like the new preferred way of doing it. I had thought the python3 command was universal on all installations but apparently not. If you edit the file you have in Deep\SDDeluxe\Stable-Diffusion-Deluxe\sdd-venv.bat and replace it with this script where I replace the launcher command with py -3

@echo off
cd /D "%~dp0"
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
echo Downloading latest Stable Diffusion Deluxe and running in a Python Virtual Environment
if not EXIST .\venv (py -3 -m venv .\venv)
powershell -Command "Invoke-WebRequest https://raw.githubusercontent.com/Skquark/AI-Friends/main/Stable-Diffusion-Deluxe/Stable-Diffusion-Deluxe.py -OutFile .\venv\Stable-Diffusion-Deluxe.py"
cd .\venv
call .\Scripts\activate.bat
py -3 -m pip install --upgrade --quiet pip
py -3 -m pip install --upgrade --quiet flet
cls
flet .\Stable-Diffusion-Deluxe.py
call .\Scripts\deactivate.bat
exit /B 1

If that works, I'll update the official launch bat to be that. If it doesn't work, open a terminal and run "py --version" and let me know what it says. You can also test run just "python3" to let me know if it finds it or not. Let me know how it goes, trying to make this an easy launch process for everyone, but python installs can be inconsistent sometimes.. Thanks.

Skquark avatar Aug 30 '23 01:08 Skquark

Thanks, that worked (sort of) got it rolling but I encountered another error.

[notice] A new release of pip is available: 23.0.1 -> 23.2.1 [notice] To update, run: python.exe -m pip install --upgrade pip Traceback (most recent call last): File "C:\Users\xxxx\Deep\SDDeluxe\Stable-Diffusion-Deluxe\venv\Stable-Diffusion-Deluxe.py", line 125, in import requests ModuleNotFoundError: No module named 'requests'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\xxxx\Deep\SDDeluxe\Stable-Diffusion-Deluxe\venv\Stable-Diffusion-Deluxe.py", line 128, in import requests ModuleNotFoundError: No module named 'requests'

bbecausereasonss avatar Aug 30 '23 01:08 bbecausereasonss

Cool.. So was the fix replacing python3 with py -3 ? If so, I've got other areas where I'm launching scripts with python3 command, which is how to do it in Colab, but since it seems that it's not always there in Windows, I should replace the python3.exe with just python everywhere. The missing requests module should be an easy fix. It's preinstalled in Colab so I just import it, but here I'm noticing the line 128 is after I do a pip install requests, so maybe there's something else going on. The only time simple imports like that haven't worked for me was when it's not ran as Administrator. Anyways, I just saved some fixes that I hope does the trick. To debug that error, I made the pip install requests show in the console, so if there was an error going on there, you should be able to see what's going on. Try running it again and let me know if that's still going on or if we got past it. Fingers' crossed... Thanks.

Skquark avatar Aug 30 '23 06:08 Skquark

Just from copy/pasting your new bat file.

P.S: Just got this strange Kaspersky Warning.

image

bbecausereasonss avatar Aug 30 '23 12:08 bbecausereasonss

image

bbecausereasonss avatar Aug 30 '23 13:08 bbecausereasonss

Interesting that the antivirus is calling my simple bat file a Trojan, that's kinda rude of it.. It's because I have those top two lines in the bat that forces it to elevate permissions to Administrator, which is needed to run the Python stuff. Kinda annoying since I don't think there's any other method/hack to do that, thought it was an acceptable command. You'll have to trust it and add to exception, otherwise things won't work If you "disinfected", you'll have to reinstall to restore the bat script. The new bat includes that fix of changing the "python3" launcher to "py -3". I should probably add a note in my Download page to warn about the potential false positive. Thanks.

Skquark avatar Aug 30 '23 23:08 Skquark

Problem should be fixed with the latest bat files. I added additional bat debug scripts in the installed program dir, so if there's still an issue you can try those. It seems like the permission error was when running the venv with a mismatched version of pip. I had pip updating, but was using the wrong python launcher. Changed form py -3 to the ./Scripts/python.exe and it looks like it's able to upgrade it now. I can't do much about the AV false positive on the bat, but at least we know about it. Please lemme know if there's any more errors, hope all's functional now.

Skquark avatar Sep 06 '23 00:09 Skquark

I reworked the bat file launchers to get rid of the line that promotes command prompt to Admin, so it should no longer show as a virus. The setup should now add the flag to the shortcut link to Run as Administrator, and if you try to open bat files directly it gives a message to run as admin if you're not. Hope everything is setup right, lemme know if not.

Skquark avatar Sep 08 '23 23:09 Skquark