Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document fix for Windows long file path error #15

Merged

Conversation

gregnr
Copy link
Contributor

@gregnr gregnr commented Sep 18, 2022

Fixes #13.

Turns out [email protected] fails to install for many Windows users because during its setup, pytorch (a sub dependency) fails to install. And pytorch fails because it can't find a certain file on disk (in this specific case, learning_rate_adaption_op_test.test_learning_rate_adaption_op_normalization.zip).

Turns out this is a known issue with pytorch and is actually caused by file paths being too long. Windows apparently maxes out around 260 characters, unless you specifically tell Windows to allow long paths.

You can do this by:

  1. Open up the Window registry (Start > Run > regedit)
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
  3. Set LongPathsEnabled to 1

This PR adds a note describing this issue under the dependency installation section in the README & Troubleshooting section within the addon so that future Windows users don't get tripped up by this.

As a side note, I was wondering why Windows doesn't enable LongPathsEnabled by default - apparently some apps still do not support long paths, so allowing Windows to create long paths (eg. through file explorer) might create more problems for people who don't know what they're doing. Of course in this situation its worth the compromise!

@carson-katri
Copy link
Owner

Amazing, thanks!

@carson-katri carson-katri merged commit adb24d1 into carson-katri:main Sep 18, 2022
@carson-katri carson-katri mentioned this pull request Sep 18, 2022
@djslickd
Copy link

I am getting the same error trying to install the dependencies. I am unable to change the long pathsenabled to 1 in the reg. IT does not allow it.

Anyway to fix it so this is not a necessity to install?

@gregnr
Copy link
Contributor Author

gregnr commented Sep 23, 2022

Hi @djslickd. Too bad you aren't able to set that. The only other solution I've heard that has worked it to relocate your Blender installation to somewhere like C:\Blender (not sure if you'll have permission for this). The reason this works is because the underlying problem is caused by file paths being too long. So trimming down the number of folders helps with this.

Hope this helps.

@djslickd
Copy link

Thank you for the suggestion. I did as you suggested and cut the paths down into C:\Blender and still getting the same error. I am not sure if I can take the python / bin folder back to the Main blender folder to save some paths. Otherwise I am at a loss.

@JC-Sutter
Copy link

JC-Sutter commented Sep 27, 2022

The installation was successfull now, but I get no picture. When I click "OK" in the DreamTextures. Blender just freeze for some seconds and I get this error in the console. But I have an CUDA GPU. I have Nividia GeForce GTX 1060

.....................

C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\cuda_init_.py:82: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at ..\c10\cuda\CUDAFunctions.cpp:112.)
return torch._C._cuda_getDeviceCount() > 0

Loading model from C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\stable_diffusion/models/ldm/stable-diffusion-v1/model.ckpt
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Using half precision math. Call with --full_precision to use more accurate but VRAM-intensive full precision.
Model loaded in 10.67s
Setting Sampler to k_lms
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop

C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Traceback (most recent call last):
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\generate.py", line 326, in prompt2image
uc, c = get_uc_and_c(
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\dream\conditioning.py", line 16, in get_uc_and_c
uc = model.get_learned_conditioning([''])
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\models\diffusion\ddpm.py", line 828, in get_learned_conditioning
c = self.cond_stage_model.encode(
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\modules\encoders\modules.py", line 455, in encode
return self(text, **kwargs)
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\modules\encoders\modules.py", line 450, in forward
z = self.transformer(input_ids=tokens, **kwargs)
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\modules\encoders\modules.py", line 420, in transformer_forward
return self.text_model(
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\modules\encoders\modules.py", line 393, in text_encoder_forward
last_hidden_state = self.encoder(
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "c:\users\user\appdata\roaming\blender foundation\blender\3.3\scripts\addons\dream_textures\stable_diffusion\ldm\modules\encoders\modules.py", line 320, in encoder_forward
layer_outputs = encoder_layer(
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\transformers\models\clip\modeling_clip.py", line 316, in forward
hidden_states = self.layer_norm1(hidden_states)
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\modules\normalization.py", line 189, in forward
return F.layer_norm(
File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\nn\functional.py", line 2486, in layer_norm
return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'

Could not generate image.C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

Usage stats:C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

0 image(s) generated inC:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
0.52sC:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures\async_loop.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

@gregnr
Copy link
Contributor Author

gregnr commented Sep 27, 2022

@JC-Sutter sorry you're having issues. For the future by the way, you're best to create a separate issue for your problem vs. commenting on an old PR.

My understanding is that you need an Nvidia GPU (which uses CUDA), or Apple silicone. At least that's what is documented in InvokeAI. @carson-katri might be able to confirm.

@carson-katri
Copy link
Owner

That's odd it doesn't detect your GPU. Maybe try the new version and see if the issue persists. Only NVIDIA and Apple Silicon have been verified to work correctly.

@JC-Sutter
Copy link

That's odd it doesn't detect your GPU. Maybe try the new version and see if the issue persists. Only NVIDIA and Apple Silicon have been verified to work correctly.

I have downloaded an installed the 006 Version. But I get this error below while installing the dependencies.
About the WARNING I should maybe delete the \dream_textures\ folder before. But why it's not detecting my GeForce GTX 1060 6GB Grafikkard as CUDA device? It's listed under "cycles Render Devices/CUDA in Blender.

......
WARNING: Target directory C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\dream_textures.python_dependencies\stable-diffusion.egg-link already exists. Specify --upgrade to force replacement.
C:\Program Files\Blender Foundation\Blender 3.3\3.3\python\lib\site-packages\torch\cuda_init_.py:82: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at ..\c10\cuda\CUDAFunctions.cpp:112.)
return torch._C._cuda_getDeviceCount() > 0
preloading bert tokenizer...
...success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error installing dependencies on windows
4 participants