wywywywy / sd-webui-depth-lib

Depth map library for use with the Control Net extension for Automatic1111/stable-diffusion-webui
MIT License
53 stars 3 forks source link

PermissionError: [Errno 13] Permission denied: 'tmp' #9

Closed mikheys closed 11 months ago

mikheys commented 1 year ago

I get the following error when I run it in the console. Can you please tell me how to fix it?

*** Error executing callback ui_tabs_callback for D:\stable-diffusion\extensions\sd-webui-depth-lib\scripts\main.py Traceback (most recent call last): File "D:\stable-diffusion\modules\script_callbacks.py", line 166, in ui_tabs_callback res += c.callback() or [] File "D:\stable-diffusion\extensions\sd-webui-depth-lib\scripts\main.py", line 41, in on_ui_tabs dataset = gr.Examples(examples=os.path.join(maps_path, t), inputs=[png_input_area], examples_per_page=24, label=None, elem_id="depth_lib_examples") File "D:\stable-diffusion\venv\lib\site-packages\gradio\helpers.py", line 58, in create_examples examples_obj = Examples( File "D:\stable-diffusion\venv\lib\site-packages\gradio\helpers.py", line 209, in __init__ self.processed_examples = [ File "D:\stable-diffusion\venv\lib\site-packages\gradio\helpers.py", line 210, in <listcomp> [ File "D:\stable-diffusion\venv\lib\site-packages\gradio\helpers.py", line 211, in <listcomp> component.postprocess(sample) File "D:\stable-diffusion\venv\lib\site-packages\gradio\components\image.py", line 318, in postprocess return client_utils.encode_url_or_file_to_base64(y) File "D:\stable-diffusion\venv\lib\site-packages\gradio_client\utils.py", line 387, in encode_url_or_file_to_base64 return encode_file_to_base64(path) File "D:\stable-diffusion\venv\lib\site-packages\gradio_client\utils.py", line 360, in encode_file_to_base64 with open(f, "rb") as file: PermissionError: [Errno 13] Permission denied: 'tmp'

Environment Put x in the brackets to select

mikheys commented 1 year ago

Already reinstalled the extension, it runs fine the first time, but after reloading the console, this error appears. I noticed that the tmp folder appears in the maps\hands folder

wywywywy commented 1 year ago

What version is your Gradio? Do you have additional images in the directories?

mikheys commented 1 year ago

What version is your Gradio? Do you have additional images in the directories?

my gradio: 3.41.2 What additional images are you talking about? image

ex479 commented 1 year ago

I "solved" this problem in a rather weird way - by creating empty extensionless files named tmp inside the \extensions\sd-webui-depth-lib\maps\hands and \extensions\sd-webui-depth-lib\maps\shapes They have to be files, not folders

wywywywy commented 1 year ago

That's creative... @mikheys let us know if it works for you please.

alexbofa commented 1 year ago

The same error, I have in webui-user.bat

set APPDATA=tmp
set USERPROFILE=tmp
set TEMP=tmp
set PYTHON=python\python.exe
set GIT=git\cmd\git.exe
set PATH=git\cmd;ffmpeg
set VENV_DIR=venv
set YOLO_CONFIG_DIR=tmp\YOLO_CONFIG_DIR\

At startup , it is created, but depth-lib works

Creating model from config: D:\Portable-Stable-Diffusion\configs\v1-inference.yaml
(…)it-large-patch14/resolve/main/vocab.json: 100%|██████████████████████████████████| 961k/961k [00:00<00:00, 2.74MB/s]

After the reboot, it will no longer work. I need to delete tmp folders that are created by pp_hands_XX and click Reload UI

If I only have these folders and create a tmp in them, then the problem is solved \extensions\sd-webui-Depth-lib\maps\hands \extensions\sd-webui-Depth-lib\maps\shapes

If I have downloaded 900 Hands Library Then it is thrown into random folders models--openai--clip-vit-large-patch14 image image

If you put the tmp file in all these folders, then the problem will be solved. Since they do not give the creation tmp\.cache\huggingface\hub\models--openai--clip-vit-large-patch14

But then there is an error in the console

Failed to create model quickly; will retry using slow method.
loading stable diffusion model: FileNotFoundError
Traceback (most recent call last):
  File "D:\Portable-Stable-Diffusion\python\lib\threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "D:\Portable-Stable-Diffusion\python\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "D:\Portable-Stable-Diffusion\python\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Portable-Stable-Diffusion\modules\initialize.py", line 147, in load_model
    shared.sd_model  # noqa: B018
  File "D:\Portable-Stable-Diffusion\modules\shared_items.py", line 110, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "D:\Portable-Stable-Diffusion\modules\sd_models.py", line 499, in get_sd_model
    load_model()
  File "D:\Portable-Stable-Diffusion\modules\sd_models.py", line 611, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "D:\Portable-Stable-Diffusion\repositories\stable-diffusion-stability-ai\ldm\util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "D:\Portable-Stable-Diffusion\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 563, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "D:\Portable-Stable-Diffusion\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 630, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "D:\Portable-Stable-Diffusion\repositories\stable-diffusion-stability-ai\ldm\util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "D:\Portable-Stable-Diffusion\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 103, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(version)
  File "D:\Portable-Stable-Diffusion\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1784, in from_pretrained
    resolved_vocab_files[file_id] = cached_file(
  File "D:\Portable-Stable-Diffusion\venv\lib\site-packages\transformers\utils\hub.py", line 417, in cached_file
    resolved_file = hf_hub_download(
  File "D:\Portable-Stable-Diffusion\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "D:\Portable-Stable-Diffusion\venv\lib\site-packages\huggingface_hub\file_download.py", line 1196, in hf_hub_download
    os.makedirs(storage_folder, exist_ok=True)
  File "D:\Portable-Stable-Diffusion\python\lib\os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "D:\Portable-Stable-Diffusion\python\lib\os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "D:\Portable-Stable-Diffusion\python\lib\os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "D:\Portable-Stable-Diffusion\python\lib\os.py", line 225, in makedirs
    mkdir(name, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'tmp/.cache'

And in the interface there is such a display of the tmp file imageimage

I solved the problem for myself by creating fix-depth-lib.bat. And pointed to the webui-user.bat as call fix-depth-lib.bat. So-so solution, but what I have :)

@echo off

RMDIR /s/q extensions\sd-webui-depth-lib\maps\hands\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_01\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_02\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_03\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_04\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_05\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_07\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_09\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_11\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_12\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_17\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_20\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_23\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_27\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_34\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_38\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_43\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_49\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_50\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_53\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_54\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_58\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_62\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_63\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_72\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_73\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_74\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_75\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\shapes\tmp
ex479 commented 1 year ago

I solved the problem for myself by creating fix-depth-lib.bat. And pointed to the webui-user.bat as call fix-depth-lib.bat. So-so solution, but what I have :)

@echo off

RMDIR /s/q extensions\sd-webui-depth-lib\maps\hands\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_01\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_02\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_03\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_04\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_05\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_07\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_09\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_11\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_12\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_17\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_20\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_23\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_27\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_34\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_38\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_43\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_49\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_50\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_53\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_54\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_58\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_62\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_63\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_72\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_73\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_74\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\pp_hands_75\tmp
RMDIR /s/q extensions\sd-webui-depth-lib\maps\shapes\tmp

Here's my solution for the batch file:

:removeTmp
setlocal enabledelayedexpansion
for /r "extensions\sd-webui-depth-lib\maps" %%f in (tmp) do (
    if exist "%%f" (
       set "fullPath=%%~f"
       set "relativePath=!fullPath:%cd%\=!"
       echo RMDIR /s/q !relativePath! >> removeTmpDirs.bat
    )
)
endlocal
if exist "removeTmpDirs.bat" (
   call removeTmpDirs.bat
   del removeTmpDirs.bat
   goto removeTmp
)
drphero commented 11 months ago

I'm having a similar issue, but instead of a tmp folder being created, it's a huggingface folder in the maps folder. When starting a1111, it complains about the hub folder inside it. What kind of insane bug is this???

wywywywy commented 11 months ago

Are you guys using OneDrive/GoogleDrive as syncing your Web UI folder?

I've recently discovered that OneDrive can create random files/folders when trying to sync, and the Gradio "Examples" component really don't like these extra files/folders.

wywywywy commented 11 months ago

I've created a new version #13 and hopefully this should sort the problem out

alexbofa commented 11 months ago

I've created a new version #13 and hopefully this should sort the problem out

Yes, it's work! Thanks!

wywywywy commented 11 months ago

Thanks for the feedback