gallery-dl icon indicating copy to clipboard operation
gallery-dl copied to clipboard

rmtree_unsafe error

Open v0sc opened this issue 1 year ago • 4 comments

I have been trying to reinstall gallery-dl again, after it stopped working and I was having a hard time getting pip to properly function/ update. When I try to install using the dev version script, I get this message:

  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: gallery_dl
  Building wheel for gallery_dl (pyproject.toml) ... done
  Created wheel for gallery_dl: filename=gallery_dl-1.27.0.dev0-py3-none-any.whl size=528085 sha256=ed8a3b64be6c578785680d8d81c1f0a1cc0da49cbf8ffcff7eee4d126362f9db
  Stored in directory: C:\Users\V\AppData\Local\Temp\pip-ephem-wheel-cache-espd2mnu\wheels\2a\d6\3c\0feca23fdac400e011e04ee81cac7ad83f629ec3e2cc8dc1ed
Successfully built gallery_dl
Installing collected packages: gallery_dl
  WARNING: Failed to write executable - trying to use .deleteme logic
  WARNING: The script gallery-dl.exe is installed in 'C:\Users\Vincent Oroscoe\AppData\Local\Programs\Python\Python311\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 gallery_dl-1.27.0.dev0
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\main.py", line 79, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\base_command.py", line 100, in main
    with self.main_context():
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 144, in __exit__
    next(self.gen)
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\command_context.py", line 19, in main_context
    with self._main_context:
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 589, in __exit__
    raise exc_details[1]
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 574, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 144, in __exit__
    next(self.gen)
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\utils\temp_dir.py", line 31, in global_tempdir_manager
    with ExitStack() as stack:
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 589, in __exit__
    raise exc_details[1]
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 574, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\utils\temp_dir.py", line 156, in __exit__
    self.cleanup()
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\utils\temp_dir.py", line 173, in cleanup
    rmtree(self._path)
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 291, in wrapped_f
    return self(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 381, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 327, in iter
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 160, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 384, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\utils\misc.py", line 130, in rmtree
    shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler)
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\V\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\Oroscoe\V\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\V\\AppData\\Local\\Temp\\pip-build-env-bbzocdra\\normal\\Scripts\\wheel.exe'

I've tried updating pip in Python (it, for some reason, doesn't even allow me to install pip, let alone update it), but otherwise I'm unsure if this means gallery-dl is installed correctly, or how to do so if it isn't.

v0sc avatar Apr 21 '24 20:04 v0sc

Use a fenced code block instead of a simple code tag, cuz the output is unreadably long without.

rautamiekka avatar Apr 21 '24 20:04 rautamiekka

Not sure it actually installed anything, but even if it did, you'd still have to use py -m gallery_dl to run it since the install location is not in PATH:

 WARNING: Failed to write executable - trying to use .deleteme logic
 WARNING: The script gallery-dl.exe is installed in 'C:\Users\Vincent Oroscoe\AppData\Local\Programs\Python\Python311\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.

The _rmtree_unsafe error comes from pip during its cleanup process and was caused by some sort of file system permission issue:

PermissionError: [WinError 5] Access is denied: 'C:\\Users\\V\\AppData\\Local\\Temp\\pip-build-env-bbzocdra\\normal\\Scripts\\wheel.exe'

mikf avatar Apr 21 '24 22:04 mikf

I'm not sure how to get gallery-dl into PATH, as I don't have any coding knowledge. As for the permission issue, I'm not seeing anything concrete on that either.

Do you have any suggestions on how to fix, or find what's causing either?

v0sc avatar Apr 22 '24 04:04 v0sc

Not sure if it'll allow this new account to link to howtogeek, but they have a good guide, here: https://www.howtogeek.com/787217/how-to-edit-environment-variables-on-windows-10-or-11/ It explains how to add it among other things. Yeah, Microsoft's own site tries to make me log in just to see it so not sure if it explains it any better. Sigh...

Joebugg avatar Apr 22 '24 09:04 Joebugg