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

Torch installation - troubleshooting #40

Closed
jjopport opened this issue Aug 22, 2023 · 29 comments
Closed

Torch installation - troubleshooting #40

jjopport opened this issue Aug 22, 2023 · 29 comments

Comments

@jjopport
Copy link

Python: Traceback (most recent call last):
File "C:\Users\jo\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\Generative_AI-main_init_.py", line 775, in execute
install_modules(self)
File "C:\Users\jo\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\Generative_AI-main_init_.py", line 450, in install_modules
exec("import torch")
File "", line 1, in
File "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\torch_init_.py", line 133, in
raise err
OSError: [WinError 126] 지정된 모듈을 찾을 수 없습니다. Error loading "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\torch\lib\cudnn_cnn_infer64_8.dll" or one of its dependencies.


I've reinstalled several times, but it doesn't work.
I did a pip upgrade using the python module manager,
but I'm still having this problem. What should I do?

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

What OS is you on? How far did you get in the installation instructions?
https://github.com/tin2tin/Generative_AI#how-to-install

@jjopport
Copy link
Author

jjopport commented Aug 22, 2023

어떤 OS를 사용하고 있나요? 설치 지침을 어디까지 읽어보셨나요? https://github.com/tin2tin/Generative_AI#how-to-install

I am using windows 11 pro.
Graphics card is 3080.
I think I followed the installation instructions.

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

Installing Torch often fails. It is very hit and miss with pip and that module.

Try to use the Python Module manager to uninstall tourch. Close Blender.

Go to this folder: C:\Users\jo\AppData\Roaming\Python\Python310\site-packages
This is where all the python modules are located.

Delete folders Torch and -orch
(the -orch folder is the lame way pip backs up uninstalled moduls. All folders starting with - can be deleted).

Start Blender again. Try Install Dependencies again.
If this fails, then Uninstall all dependencies.
In that folder, delete all folders called something with torch and all folders starting with -

Restart Blender. Install All Dependencies. Restart. And hopefully it'll work.

Let me know if that works.

@jjopport
Copy link
Author

Thank U for help,
I don't know well 'use the Python Module manager to uninstall tourch'
You mean press the remove button in the python module manager?

@jjopport
Copy link
Author

토치-제거

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

You need to type in Torch to the left of that button first.

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

(Don't use it for installing Torch, bc you'll need a special version including CUDA - which the Generative AI add-on will install for you(Install Dependencies - button))

@jjopport
Copy link
Author

jjopport commented Aug 22, 2023

image

In the list, Found 'torch'.
Should I remove these?

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

You can properly just delete the folders as well, might be faster.

@jjopport
Copy link
Author

It seems to be installed now. thank you

But another error occurred.
When I hit generate image, I got the following error:

File "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\bitsandbytes\autograd_functions.py", line 5, in
import bitsandbytes.functional as F
File "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\bitsandbytes\functional.py", line 13, in
from .cextension import COMPILED_WITH_CUDA, lib
File "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\bitsandbytes\cextension.py", line 41, in
lib = CUDALibrary_Singleton.get_instance().lib
File "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\bitsandbytes\cextension.py", line 37, in get_instance
cls.instance.initialize()
File "C:\Users\jo\AppData\Roaming\Python\Python310\site-packages\bitsandbytes\cextension.py", line 31, in initialize
self.lib = ct.cdll.LoadLibrary(binary_path)
File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\ctypes_init
.py", line 452, in LoadLibrary
return self.dlltype(name)
File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\ctypes_init
.py", line 364, in init
if '/' in name or '\' in name:
TypeError: argument of type 'WindowsPath' is not iterable

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

Apparently, that is a python module. Newer heard about it before: https://github.com/TimDettmers/bitsandbytes

You could try the Python Module Manager, type in bitsandbytes and first remove it, and then install it. Restart Blender.

If that doesn't work, then remove the bitsandbytes folder, and then install it with PMM.

The thing with those folders is that the content of those will be used instead of downloading the latest version, so by deleting the folder you ensure you'll get the latest release of that module.

@jjopport
Copy link
Author

화면 캡처 2023-08-22 173350

I finally came across this screen.

@jjopport
Copy link
Author

jjopport commented Aug 22, 2023

But when I hit the create image button, another error occurred, LOL

Python: Traceback (most recent call last):
File "C:\Users\jo\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\Generative_AI-main_init_.py", line 1863, in execute
image = refiner(
UnboundLocalError: local variable 'refiner' referenced before assignment

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

Could you send me a screenshot of your sidebar panel, so I can see your settings, in order to try to reproduce?

(I renamed your thread, so others with the same problems, can find it. I hope that's okay?)

@tin2tin tin2tin changed the title I can't install. [WinError 126] plz help me!!! Torch installation - troubleshooting Aug 22, 2023
@jjopport
Copy link
Author

image

Are you talking about the sidebar settings?

@jjopport
Copy link
Author

image

@jjopport
Copy link
Author

Requirement already satisfied: mpmath>=0.19 in c:\users\jo\appdata\roaming\python\python310\site-packages (from sympy->torch) (1.3.0)
WARNING: Ignoring invalid distribution -ffi (c:\users\jo\appdata\roaming\python\python310\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\users\jo\appdata\roaming\python\python310\site-packages)
WARNING: Ignoring invalid distribution -orch (c:\users\jo\appdata\roaming\python\python310\site-packages)
WARNING: Ignoring invalid distribution -ysoundfile (c:\users\jo\appdata\roaming\python\python310\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\program files\blender foundation\blender 3.6\3.6\python\lib\site-packages)
DEPRECATION: torchsde 0.2.5 has a non-standard dependency specifier numpy>=1.19.*; python_version >= "3.7". pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of torchsde or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at pypa/pip#12063
Info: Installation of dependencies is finished.

safety_checker\model.fp16.safetensors not found
Loading pipeline components...: 43%|██████████████████████▎ | 3/7 [00:00<00:01, 3.01it/s]text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["id2label"] will be overriden.
text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["bos_token_id"] will be overriden.
text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["eos_token_id"] will be overriden.
Loading pipeline components...: 100%|████████████████████████████████████████████████████| 7/7 [00:01<00:00, 4.75it/s]
Generating
100%|██████████████████████████████████████████████████████████████████████████████████| 25/25 [00:01<00:00, 13.20it/s]
Refining
Traceback (most recent call last):
File "C:\Users\jo\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\Generative_AI-main_init_.py", line 1863, in execute
image = refiner(
UnboundLocalError: local variable 'refiner' referenced before assignment
Error: Python: Traceback (most recent call last):
File "C:\Users\jo\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\Generative_AI-main_init_.py", line 1863, in execute
image = refiner(
UnboundLocalError: local variable 'refiner' referenced before assignment

@jjopport
Copy link
Author

13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
RAM 32.0GB
Windows 11 Pro
Graphic Card RTX 3080

I'll leave the details in case it helps.

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

I haven't tested SD 1.5 for a while, and I do not have time to that download now.
Try SD XL instead and Zeroscope XL(I should properly just disable all of the other models, as these two are superior)

@jjopport
Copy link
Author

wow, SD XL 1.0 works.
really really really
Thank you very much.

image

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

Cool! You made it! If you have an interest in text to video too, then this discord is a good place to hang out and follow how that area develops: https://discord.gg/hevku2Un

@jjopport
Copy link
Author

I'm going now

@tin2tin
Copy link
Owner

tin2tin commented Aug 22, 2023

In 2 sek. I'll upload a fix for SD 1.5.

@DVBS8
Copy link

DVBS8 commented Oct 15, 2023

Installing Torch often fails. It is very hit and miss with pip and that module.

Try to use the Python Module manager to uninstall tourch. Close Blender.

Go to this folder: C:\Users\jo\AppData\Roaming\Python\Python310\site-packages This is where all the python modules are located.

Delete folders Torch and -orch (the -orch folder is the lame way pip backs up uninstalled moduls. All folders starting with - can be deleted).

Start Blender again. Try Install Dependencies again. If this fails, then Uninstall all dependencies. In that folder, delete all folders called something with torch and all folders starting with -

Restart Blender. Install All Dependencies. Restart. And hopefully it'll work.

Let me know if that works.

No matter what I do I keep getting this error when I get to Xformers during the dependencies installation:

Installing: xformers module
WARNING: Ignoring invalid distribution -umpy (c:\program files\blender foundation\blender 3.4\3.4\python\lib\site-packages)
Collecting xformers
 Using cached xformers-0.0.22.post3.tar.gz (3.9 MB)
 Installing build dependencies ... done
 Getting requirements to build wheel ... error
 error: subprocess-exited-with-error

 × Getting requirements to build wheel did not run successfully.
 │ exit code: 1
 ╰─> [17 lines of output]
     Traceback (most recent call last):
       File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\python\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
         main()
       File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\python\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
         json_out['return_val'] = hook(**hook_input['kwargs'])
       File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\python\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
         return hook(config_settings)
       File "C:\Users\r\AppData\Local\Temp\pip-build-env-0ptncc9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
         return self._get_build_requires(config_settings, requirements=['wheel'])
       File "C:\Users\r\AppData\Local\Temp\pip-build-env-0ptncc9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
         self.run_setup()
       File "C:\Users\r\AppData\Local\Temp\pip-build-env-0ptncc9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
         super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
       File "C:\Users\r\AppData\Local\Temp\pip-build-env-0ptncc9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
         exec(code, locals())
       File "<string>", line 23, in <module>
     **ModuleNotFoundError: No module named 'torch'
     [end of output]**

 note: This error originates from a subprocess, and is likely not a problem with pip.
error: `subprocess-exited-with-error`

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

It claims it can't find torch. I even uninstalled all the dependencies in blender and deleted torch in \Python310\site-packages manually as you suggested and after trying to reinstall the dependencies (including torch) I still get the same error when getting to xformers claiming that torch is not there.

@tin2tin
Copy link
Owner

tin2tin commented Oct 15, 2023

@DVBS8
What's your OS?

Have you tried to click on the Uninstall Dependencies button in the add-on preferences, close Blender, check site-packages for folders to delete, start Blender, click "Install Dependencies"?

If the problem persists, apparently more people are having this problem: facebookresearch/xformers#740

Let me know if you find a solution which is working for you.

@DVBS8
Copy link

DVBS8 commented Oct 15, 2023

@DVBS8 What's your OS?

Have you tried to click on the Uninstall Dependencies button in the add-on preferences, close Blender, check site-packages for folders to delete, start Blender, click "Install Dependencies"?

If the problem persists, apparently more people are having this problem: facebookresearch/xformers#740

Let me know if you find a solution which is working for you.

My OS is Windows 10

Anyways I was finally able to install xformers after uninstalling and reinstalling the dependencies mutiple times.

But I have a new problem. It seems that the addon only works if you install the dependencies every time you open a blender instance. If I close blender and reopen it and then try to use the add on, I will get a torch module not found error until I reinstall the dependencies (without uninstalling them). Only then will the addon work. Is this normal behavior?

@tin2tin
Copy link
Owner

tin2tin commented Oct 15, 2023

Did you remember to run Blender as administrator?

@DVBS8
Copy link

DVBS8 commented Oct 15, 2023

Did you remember to run Blender as administrator?

Yes every single time I run it as administrator.

@tin2tin
Copy link
Owner

tin2tin commented Oct 15, 2023

Well, it is not normal behavior at all. You could try the uninstall process above, and Blender is closed the delete all folders in \Python310\site-packages called anything touch or xformers related, reboot, and then start Blender, and install the dependencies. But it's just a wild guess. Alternatively, if you run some other genAI app, it may change the installed modules.

@tin2tin tin2tin closed this as completed Nov 14, 2023
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

No branches or pull requests

3 participants