dream-textures icon indicating copy to clipboard operation
dream-textures copied to clipboard

"failed to load pyTorch"

Open AlienXtream opened this issue 2 years ago • 17 comments

ImportError('Failed to load PyTorch C extensions:\n It appears that PyTorch has loaded the torch/_C folder\n of the PyTorch repository rather than the C extensions which\n are expected in the torch._C namespace. This can occur when\n using the install workflow. e.g.\n $ python setup.py install && python -c "import torch"\n\n This error can generally be solved using the develop workflow\n $ python setup.py develop && python -c "import torch" # This should succeed\n or by running Python from a different directory.')

i have blender installed via steam on a separate drive so i have a suspiscion its related to that.

AlienXtream avatar Sep 29 '22 01:09 AlienXtream

I'm having the same issue with v0.6, and I have Blender on my usual drive. This error always occurs right when I click the "Generate" button in the Image Editor.

SprangySprang04 avatar Sep 30 '22 12:09 SprangySprang04

I'm having the same issue with v0.6, and I have Blender on my usual drive. This error always occurs right when I click the "Generate" button in the Image Editor.

I have exactly the same Problem and i tryed it on 3 different Computers, 2 Windows and 1 Mac.

Screenshot (130) But how can i fix it?

LukasMadlener avatar Oct 01 '22 13:10 LukasMadlener

i am having this problem as well

P1xelpunk avatar Oct 01 '22 22:10 P1xelpunk

Which addon file did you install

carson-katri avatar Oct 02 '22 13:10 carson-katri

Please also try with the MSI from blender.org, as I have not verified Steam installs to work.

carson-katri avatar Oct 02 '22 13:10 carson-katri

I had the same error. Updating from Blender Version 3.0 to 3.3 fixed it for me

ob-julian avatar Oct 02 '22 18:10 ob-julian

I tryed with Blender 3.2 and I get a simmular Error, i will try Blender version 3.3 and keep you updated.

This is my Error on Blender 3.2.0 on my MacBook Pro 2017 with a Intel Graphics Card.

OSError("dlopen(/Users/lukasmadlener/Library/Application Support/Blender/3.2/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib, 0x000A): tried: '/Users/lukasmadlener/Library/Application Support/Blender/3.2/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h')), '/usr/lib/libtorch_global_deps.dylib' (no such file)")

LukasMadlener avatar Oct 03 '22 09:10 LukasMadlener

Same error for me:

ImportError('Failed to load PyTorch C extensions:\n It appears that PyTorch has loaded the torch/_C folder\n of the PyTorch repository rather than the C extensions which\n are expected in the torch._C namespace. This can occur when\n using the install workflow. e.g.\n $ python setup.py install && python -c "import torch"\n\n This error can generally be solved using the develop workflow\n $ python setup.py develop && python -c "import torch" # This should succeed\n or by running Python from a different directory.')

I am running Blender 3.3 on Windows 11, with the latest file version, downloaded just today. upgraded to Blender 3.3.1, no change, same error.

photogent avatar Oct 07 '22 22:10 photogent

Had the exact same error, for me the issue was that i had downloaded the arm version (which i am pretty sure is not for windows). Downloaded the cuda version, everything worked smoothly.

marharols avatar Oct 09 '22 21:10 marharols

I tryed with Blender 3.2 and I get a simmular Error, i will try Blender version 3.3 and keep you updated.

This is my Error on Blender 3.2.0 on my MacBook Pro 2017 with a Intel Graphics Card.

OSError("dlopen(/Users/lukasmadlener/Library/Application Support/Blender/3.2/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib, 0x000A): tried: '/Users/lukasmadlener/Library/Application Support/Blender/3.2/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h')), '/usr/lib/libtorch_global_deps.dylib' (no such file)")

OSError("dlopen(/Users/admin/Library/Application Support/Blender/3.3/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib, 0x000A): tried: '/Users/admin/Library/Application Support/Blender/3.3/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h')), '/usr/local/lib/libtorch_global_deps.dylib' (no such file), '/usr/lib/libtorch_global_deps.dylib' (no such file)")

The same error. I try running Blender 3.3 and do not fix it.How about u.

AlexChangCC avatar Oct 10 '22 10:10 AlexChangCC

Had the exact same error, for me the issue was that i had downloaded the arm version (which i am pretty sure is not for windows). Downloaded the cuda version, everything worked smoothly.

For those who, like me, did not quite understand this comment initially, the plugin comes in an "ARM 64" version, and a "WIN32 CUDA" version. I, too, had downloaded and installed the "ARM 64" version, as I just saw the "64" and thought that meant "64 Bit," rather than a different architecture system. (Windows has run on ARM version in the past, and might still, but it was mainly for an ARM model of their surface tablets.) Reading the installation instructions again, which I completely failed to do so before, clearly says the ARM64 is for Mac, not windows.

So I downloaded the WIN32 CUDA version, Installed, set it up and gave it a run.

It does run... very slowly.

I ran the "brick" prompt you see in all the demos, at 512*512, with 25 steps. It's currently "Downloading CLIP (17%)" It's adding 1% on a fairly fast machine (AMD 32 cores, NVIDIA 2080RTX) and is adding 1% of CLIP every 15-20 seconds. Am I still doing something wrong? Is it going to do this every prompt I run?

EDIT: Once the clip downloaded, all other prompts have gone smoothly! Problem solved for me!

photogent avatar Oct 10 '22 12:10 photogent

I have the same error with WIN32 CUDA Version on Blender 3.0 but solved by update blender to 3.3.

JenkinsGage avatar Oct 12 '22 11:10 JenkinsGage

Still having this issue, anyone else found a solution

ScottRowley2 avatar Oct 13 '22 15:10 ScottRowley2

This error occurs when you try to run the macOS version on a Windows system. Please make sure to follow the Windows Installation instructions.

NullSenseStudio avatar Oct 14 '22 14:10 NullSenseStudio

This error occurs when you try to run the macOS version on a Windows system. Please make sure to follow the Windows Installation instructions.

Yeah, I noticed I skipped the files when you have the addpn installed

image

I didn't downloaded / Imported the files so that's why I have a this problem.

gregcont avatar Oct 15 '22 18:10 gregcont

OSError("dlopen(/Users/admin/Library/Application Support/Blender/3.3/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib, 0x000A): tried: '/Users/admin/Library/Application Support/Blender/3.3/scripts/addons/dream_textures/.python_dependencies/torch/lib/libtorch_global_deps.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h')), '/usr/local/lib/libtorch_global_deps.dylib' (no such file), '/usr/lib/libtorch_global_deps.dylib' (no such file)")

The same error. I try running Blender 3.3 and do not fix it.How about u.

image 2. image the new error,after installing it warned "no model named torch"

AlexChangCC avatar Oct 18 '22 06:10 AlexChangCC

You can try to open the python console directly in blender (shift+f4). Then try the following commands.

import subprocess
import sys
import os 

blender_python_path = os.path.join(sys.prefix, 'bin', 'python.exe')
subprocess.call([python_exe, '-m', 'ensurepip'])
subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'pip'])

This procedure only needs to be done once to update pip. Then, use: subprocess.call([python_exe, '-m', 'pip', 'install', 'torch']) After that, try to run the generation again. It is likely that you will need to install about 10 more packages. For the following errors, you will find their names either in the error message in blender, or open the blender console window (window->toggle system console)

If you want to repeat this after closing blender, just import subprocess, sys, os and then use the install of the desired module.

blender_python_path = os.path.join(sys.prefix, 'bin', 'python.exe')
subprocess.call([blender_python_path, '-m', 'pip', 'install', 'MODULE_NAME'])

Also, if you need to change the version of any module, use module_name==x.x.x instead of module_name. subprocess.call([blender_python_path, '-m', 'pip', 'install', 'MODULE_NAME==1.12.0'])

Upd. I just installed this on my second pc. Getting the same error, I repeated all the steps and the error disappeared. Below is a list of all installed packages that you need (most likely).

  • opencv_python
  • psutil
  • torch
  • torchvision
  • tokenizers==0.12.1
  • scikit-learn
  • scikit-image
  • regex
  • numpy --upgrade // The version that comes with the latest lts version of blender is too old.
  • transformers

JhnBer avatar Oct 18 '22 14:10 JhnBer

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Apr 13 '23 01:04 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Apr 20 '23 01:04 github-actions[bot]

you can fix this by re-installing torch

pip uninstall torch pip install torch

Cheers

Kivo0 avatar Sep 15 '23 02:09 Kivo0