Skquark / AI-Friends

A collection of handy helpers for AI art generation, AI writing and other experimental tools
35 stars 8 forks source link

On Windows, wget is needed to install ESRGAN #13

Open RadixSeven opened 1 week ago

RadixSeven commented 1 week ago

The code to install ESRGAN uses wget, which is unavailable by default in Windows.

I was able to diagnose and fix the problem myself by installing using Scoop, but SDD should check and notify users if wget is missing (or, better yet, not rely on it).

Here is the error that is generated if wget is not installed:

future: <Future finished exception=FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)>
Traceback (most recent call last):
  File "C:\Users\Eric\scoop\apps\python\3.11.3\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\StableDiffusionDeluxe\venv\Lib\site-packages\flet_core\page.py", line 950, in wrapper
    handler(*args)
  File "D:\Programs\StableDiffusionDeluxe\venv\Stable-Diffusion-Deluxe.py", line 2274, in run_installers
    get_ESRGAN(page)
  File "D:\Programs\StableDiffusionDeluxe\venv\Stable-Diffusion-Deluxe.py", line 24963, in get_ESRGAN
    run_sp(f"wget {model_url} -P experiments/pretrained_models --quiet", cwd=ESRGAN_folder)
  File "D:\Programs\StableDiffusionDeluxe\venv\Stable-Diffusion-Deluxe.py", line 62, in run_sp
    returned = subprocess.run(cmd_list, stdout=subprocess.PIPE, env=env, **cwd_arg).stdout.decode('utf-8')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Eric\scoop\apps\python\3.11.3\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Eric\scoop\apps\python\3.11.3\Lib\subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Eric\scoop\apps\python\3.11.3\Lib\subprocess.py", line 1509, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Skquark commented 1 week ago

Damn, never noticed that because wget was always available on all the systems I tested on, so error never came up. Thought I was installing it if it wasn't there, but I guess I was wrong, and to automate installing it on Windows is more awkward than I expected to have to use choco or scoop, which would have to be installed too. I got used to using it, but I think I'm gonna take your advice and replace all the instances that I'm using wget to download with the requests.get method instead. Will take a bit to refactor everything, but no prob. Thanks.

Skquark commented 1 week ago

Alright, replaced wget everywhere now. There may be a few places in other people's github projects I'm cloning where wget was still being used, I remember seeing a few before, but shouldn't be a big deal since most have it. I appreciate you pointing out issue...

RadixSeven commented 1 week ago

Thanks for handling it so quickly!