ControlNet icon indicating copy to clipboard operation
ControlNet copied to clipboard

Failed to import controlnet! The exact error is [WinError 3]

Open eizoxx opened this issue 2 years ago • 13 comments

Hey, I recently have the problem that ControlNet seems to access the wrong path and always looks in the Deforum folder. Here is the full error code: Failed to import controlnet! The exact error is [WinError 3] The system cannot find the specified path: 'E:\AI\SUPER SD 2.0\stable-diffusion-webui\extensions\deforum-for-automatic1111-webui\models'. Deforum support for ControlNet will not be activated. I don't know if this is the reason, or it has another reason, why ControlNet doesn't work for me in the SD-UI. https://cdn.discordapp.com/attachments/359372644484775936/1078811311233835120/grafik.png https://cdn.discordapp.com/attachments/359372644484775936/1078811823773593651/grafik.png

eizoxx avatar Feb 24 '23 22:02 eizoxx

Same issue here Failed to import controlnet! The exact error is [WinError 3] The system cannot find the path specified: 'F:\stable-diffusion\stable-diffusion-webui\extensions\deforum-for-automatic1111-webui\models'. Deforum support for ControlNet will not be activated

websubst avatar Feb 25 '23 23:02 websubst

same Failed to import controlnet! The exact error is [WinError 3] The system cannot find the path specified: 'W:\stable-diffusion-webui-master\extensions\deforum-for-automatic1111-webui\models'. Deforum support for ControlNet will not be activated

LexVolkov avatar Feb 26 '23 02:02 LexVolkov

but all the work fine

LexVolkov avatar Feb 26 '23 02:02 LexVolkov

I read a workaround is to copy the models folder from "\extensions\sd-webui-controlnet\models" to "\extensions\deforum\models", which seemed to get rid of that warning (but double your file size). I am hoping there is a way to change that line in code where it is searching in the near future though.

blksrfc avatar Feb 26 '23 05:02 blksrfc

Just make a symlink. Here's a powershell one-liner and its output. Note that I have my models in a non-standard folder (I run multiple instances of sd-webui at times). Your target folder will be different, which I'll explain after:

PS D:\hal\stable-diffusion\auto> New-Item -ItemType SymbolicLink -Target D:\hal\stable-diffusion\models\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models

    Directory: D:\hal\stable-diffusion\auto\extensions\deforum-for-automatic1111-webui

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
l----           2/26/2023  9:53 PM                models ->
                                                  D:\hal\stable-diffusion\models\sd-webui-controlnet\models

Here, I'm in the "auto" directory, which is where I have installed sd-webui. The same command with the ControlNet models in the normal place would be:

New-Item -ItemType SymbolicLink -Target .\extensions\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models

Hope that makes sense. I always get Target and Path reversed, myself, and that's why half the time I use Link Shell Extension instead of a bare script.

image

Voila!

halr9000 avatar Feb 27 '23 03:02 halr9000

Just make a symlink. Here's a powershell one-liner and its output. Note that I have my models in a non-standard folder (I run multiple instances of sd-webui at times). Your target folder will be different, which I'll explain after:

PS D:\hal\stable-diffusion\auto> New-Item -ItemType SymbolicLink -Target D:\hal\stable-diffusion\models\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models

    Directory: D:\hal\stable-diffusion\auto\extensions\deforum-for-automatic1111-webui

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
l----           2/26/2023  9:53 PM                models ->
                                                  D:\hal\stable-diffusion\models\sd-webui-controlnet\models

Here, I'm in the "auto" directory, which is where I have installed sd-webui. The same command with the ControlNet models in the normal place would be:

New-Item -ItemType SymbolicLink -Target .\extensions\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models

Hope that makes sense. I always get Target and Path reversed, myself, and that's why half the time I use Link Shell Extension instead of a bare script.

image

Voila!

it works,

Deforum ControlNet support: enabled

ClarkWain avatar Mar 01 '23 16:03 ClarkWain

Any chance this explanation can be edited to explain to people who don't what a 'symlink' is, or what is meant by 'auto' directory, as I for one don't have a directory called 'auto' Sorry for being such a luddite.

sledgehkg avatar Mar 02 '23 01:03 sledgehkg

New-Item -ItemType SymbolicLink -Target .\extensions\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models PLZ HELPPPPPPPPPPPPP

karma231s avatar Mar 03 '23 13:03 karma231s

@sledgehkg @karma231s

  1. Open a powershell prompt (click the windows key, type powershell, hit enter)
  2. change directory to where you installed sd-webui: cd <name of the folder goes here, remove the angle brackets though>
  3. Run this command to create a symbolic link from your controlnet models folder, to your deforum models folder, without creating a whole new copy, wasting disk space: New-Item -ItemType SymbolicLink -Target .\extensions\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models
  4. Profit!

halr9000 avatar Mar 04 '23 19:03 halr9000

on a google drive just create link to models folder in to a \extensions\deforum-for-automatic1111-webui folder

Gryphan1 avatar Mar 09 '23 09:03 Gryphan1

  1. Open a powershell prompt (click the windows key, type powershell, hit enter)
  2. change directory to where you installed sd-webui: cd <name of the folder goes here, remove the angle brackets though>
  3. Run this command to create a symbolic link from your controlnet models folder, to your deforum models folder, without creating a whole new copy, wasting disk space: New-Item -ItemType SymbolicLink -Target .\extensions\sd-webui-controlnet\models -Path .\extensions\deforum-for-automatic1111-webui\models
  4. Profit!

@halr9000 Hi, I tried this command and Deforum ControlNet support: enabled green message is shown, but afterwards few errors on deforum tab ui appear preventing on showing the deforum tab on browser. Is there a command to undo this folder target?

magalisds avatar Mar 16 '23 02:03 magalisds

Open in explorer, you'll see them. They look like regular folders with a little arrow on them. You can safely delete them without affecting the source folder.

halr9000 avatar Mar 16 '23 03:03 halr9000

Powershell script for the future:

  1. Save the below code as "symbolic-link-controlnet-models-automatic1111.ps1" file: Note: Change the target and destination paths according to yourself.
$target = "F:\stable-diffusion-things\models\ControlNet"
$destination = "C:\dev\stable-diffusion-webui-master\extensions\sd-webui-controlnet\models"

if (Test-Path -Path "$destination\ControlNet") {
    Write-Output "Symbolic link already exists"
}
else {
    try {
        New-Item -ItemType SymbolicLink -Target $target -Path "$destination\ControlNet" -ErrorAction Stop
        Write-Output "Symbolic link created successfully"
    }
    catch {
        Write-Output "Error creating symbolic link: $_.Exception.Message"
    }
}

Pause
  1. Now copy the below command and run it in Powershell with administrative rights: Note: 1. Update the Powershell file path according to yourself.** 2. The below command bypasses the excecution policy but it also restores that at the end.
$prevPolicy = Get-ExecutionPolicy

powershell.exe -ExecutionPolicy Bypass -File "F:\stable-diffusion-things\symbolic-link-controlnet-models-automatic1111.ps1" -NoExit

Set-ExecutionPolicy -ExecutionPolicy $prevPolicy -Scope Process -Force

chaudharydeepanshu avatar Apr 27 '23 17:04 chaudharydeepanshu