[Bug]: Cannot install extension from URL
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
I always get : PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
After checking in resource monitor, a git process has the lock on the tmp folder and it will not release the lock until killed manually, even after shutting down webui.
Steps to reproduce the problem
- Go to Extensions
- Install any extension by URL
What should have happened?
Extension should install
Commit where the problem happens
0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
What platforms do you use to access the UI ?
Windows
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
no
List of extensions
no
Console logs
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:07<00:00, 2.51it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:07<00:00, 2.81it/s]
Error completing request
Arguments: ('', 'https://github.com/tsngo/stable-diffusion-webui-aesthetic-image-scorer') {}
Traceback (most recent call last):
File "C:\Users\[CENSORED]\code\ai\stable-diffusion-webui\modules\call_queue.py", line 56, in f
res = list(func(*args, **kwargs))
File "C:\Users\[CENSORED]\code\ai\stable-diffusion-webui\modules\ui_extensions.py", line 159, in install_extension_from_url
raise(err)
File "C:\Users\[CENSORED]\code\ai\stable-diffusion-webui\modules\ui_extensions.py", line 149, in install_extension_from_url
os.rename(tmpdir, target_dir)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\[CENSORED]\\code\\ai\\stable-diffusion-webui\\tmp\\stable-diffusion-webui-aesthetic-image-scorer' -> 'C:\\Users\\[CENSORED]\\code\\ai\\stable-diffusion-webui\\extensions\\stable-diffusion-webui-aesthetic-image-scorer'
Additional information
No response
--enable-insecure-extension-access try adding this in webui-user.bat
COMMANDLINE_ARGS=--enable-insecure-extension-access`
I have this too. It could be a regression as I just installed webui on another PC and am getting this.
--enable-insecure-extension-access does not resolve this error
this same error message (on windows) in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/8035 - that is "the file is already in use" error, even though that one is for a temp file and this is for an extension file/folder.
Seems like an issue introduced in the past couple of commits.
I also can't install extensions but I get a different error message.
My error message looks like this if I try to install from URL as well as install from list of available extension:
To create a public link, set share=Trueinlaunch(). Error completing request Arguments: ('', 'https://github.com/Mikubill/sd-webui-controlnet') {} Traceback (most recent call last): File "J:\AI\stable-diffusion-webui\modules\call_queue.py", line 56, in f res = list(func(*args, **kwargs)) File "J:\AI\stable-diffusion-webui\modules\ui_extensions.py", line 124, in install_extension_from_url check_access() File "J:\AI\stable-diffusion-webui\modules\ui_extensions.py", line 22, in check_access assert not shared.cmd_opts.disable_extension_access, "extension access disabled because of command line flags" AssertionError: extension access disabled because of command line flags
@Skybeat your error is due to the command line flags that you set. Normally --listen produces this error.
Check your startup-webui.bat and clear any command line flags that you may have set and try again.
If this does not help, open a new issue as it is not related to the file access issue.
@Skybeat your error is due to the command line flags that you set. Normally --listen produces this error.
Check your startup-webui.bat and clear any command line flags that you may have set and try again.
If this does not help, open a new issue as it is not related to the file access issue.
Thank you @vmajor, you are right I have --listen as one of my parameters. Now I have add --enable-insecure-extension-access and the installation was possible.
Is there any activity on this? I also see that the main repo hasn't been updated in over a week.
For the people stuck with this problem there is a workaround for the extensions that require pip install, manual workaround.
change directory to venv/Scripts
type activate and press enter
change directory to tmp
git clone the plugin repository (you can find out the path by trying to install it, the failed attempt will still tell you the repository URL
cd to the repository's directory
type in pip install -r requirements.txt
This works for controlnet for example, likely everything else that needs pip, but I only care about controlnet so far.
I was getting this error even after the merge. I didn't look super a lot into it, but somehow it seems like with the "with" statement or something my Git for Windows gets completely stuck. I get a permission error and the git process keeps running even after I close the webui process.
I worked around it by modifying ui_extensions.py, changing
with git.Repo.clone_from(url, tmpdir) as repo:
repo.remote().fetch()
for submodule in repo.submodules:
submodule.update()
to just
git.Repo.clone_from(url, tmpdir)
I'd make a pull request, but I've no idea what that would do if submodules are needed.
I have updated the latest master branch, but this issue still persists.
I was getting this error even after the merge. I didn't look super a lot into it, but somehow it seems like with the "with" statement or something my Git for Windows gets completely stuck. I get a permission error and the git process keeps running even after I close the webui process.
I worked around it by modifying ui_extensions.py, changing
with git.Repo.clone_from(url, tmpdir) as repo: repo.remote().fetch() for submodule in repo.submodules: submodule.update()to just
git.Repo.clone_from(url, tmpdir)I'd make a pull request, but I've no idea what that would do if submodules are needed.
This also worked for me. Thanks!
Still getting the error on master. None of the above steps worked for me. This is how I solved it:
(a new else block starting at ui_extensions.py:370)
except OSError as err:
if err.errno == errno.EXDEV:
# Cross device link, typical in docker or when tmp/ and extensions/ are on different file systems
# Since we can't use a rename, do the slower but more versitile shutil.move()
shutil.move(tmpdir, target_dir)
else:
# Something else, not enough free space, permissions, etc. rethrow it so that it gets handled.
raise err
import launch
with
except OSError as err:
if err.errno == errno.EXDEV:
# Cross device link, typical in docker or when tmp/ and extensions/ are on different file systems
# Since we can't use a rename, do the slower but more versitile shutil.move()
shutil.move(tmpdir, target_dir)
else:
# Try to copy and delete, because processes like to hold on to the .git subdirectory
shutil.copytree(tmpdir, target_dir)
for i in range(1, 10):
shutil.rmtree(tmpdir, ignore_errors=True)
import launch
Still getting the error on master. None of the above steps worked for me. This is how I solved it:
(a new else block starting at
ui_extensions.py:370)except OSError as err: if err.errno == errno.EXDEV: # Cross device link, typical in docker or when tmp/ and extensions/ are on different file systems # Since we can't use a rename, do the slower but more versitile shutil.move() shutil.move(tmpdir, target_dir) else: # Something else, not enough free space, permissions, etc. rethrow it so that it gets handled. raise err import launchwith
except OSError as err: if err.errno == errno.EXDEV: # Cross device link, typical in docker or when tmp/ and extensions/ are on different file systems # Since we can't use a rename, do the slower but more versitile shutil.move() shutil.move(tmpdir, target_dir) else: # Try to copy and delete, because processes like to hold on to the .git subdirectory shutil.copytree(tmpdir, target_dir) for i in range(1, 10): shutil.rmtree(tmpdir, ignore_errors=True) import launch
Did the trick for installing DeForum. Seems like the process hangs itself by trying to access an open file stream, maybe in a loopback somewhere while the download is initializing, forcing the OSError to throw.
On this page: "https://github.com/ThereforeGames/unprompted#installation" there's an installation tutorial but I don't know where to find the "Install from URL" subtab.
Tutorial: How to install directly... (click to expand) Visit the Extensions tab of Automatic's WebUI. Visit the Install from URL subtab. Paste this repo's URL into the first field: https://github.com/ThereforeGames/unprompted Click Install.
I added "Everyone" write permissions to the webUI folder.. win10