pKrime / brignet

Automatic rigging using neural network from RigNet
GNU General Public License v3.0
407 stars 39 forks source link

Blender 3.1 introduces Python 3.10 API which rules out PyTorch 1.8.1 dependencies #21

Open PierceLBrooks opened 1 year ago

PierceLBrooks commented 1 year ago

The version 3.1 release patch notes for Blender show the internal distribution of Python has been bumped up to 3.10: https://wiki.blender.org/wiki/Reference/Release_Notes/3.1/Python_API#Python_3.10

This causes problems for resolving dependencies upon installation through the pip package manager using the provided wheel module listing, which only offers support for the necessary CUDA versions up to Python 3.9: https://download.pytorch.org/whl/torch_stable.html

Here is some terminal output from an installation attempt through the Blender UI to illustrate this:

Read prefs: C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\config\userpref.blend
Reloading external rigs...
Reloading external metarigs...
adding C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\brignet\_additional_modules\Lib
adding C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\brignet\_additional_modules\Lib\site-packages
C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\brignet\_additional_modules\Lib\site-packages\win32 not a directory, skipping
C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\brignet\_additional_modules\Lib\site-packages\win32\lib not a directory, skipping
C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\brignet\_additional_modules\DLLs not a directory, skipping
C:\Users\Pierce\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\brignet\_additional_modules\Lib\site-packages\Pythonwin not a directory, skipping
installing torch
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.8.1+cu102 (from versions: 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116)
ERROR: No matching distribution found for torch==1.8.1+cu102
pKrime commented 1 year ago

I think the add-on should somehow break free from those dependencies, but as a quickfix I might add a torch version parameter in the preferences

PierceLBrooks commented 1 year ago

At least in the case of support for CUDA 10.2, the only version of torch that offers a Python 3.10 wheel build is 1.12.0, and even then only for linux platforms: https://pytorch-geometric.com/whl/torch-1.12.0+cu102.html

PierceLBrooks commented 1 year ago

FYI I also tried being sly about it and editing the find link flag for the virtual environment's PIP package installation invokations ( https://github.com/pKrime/brignet/blob/v0.1-alpha/setup_utils/venv_utils.py#L260 ) to an edited local copy of the wheel build directory page that pointed to an appropriate local wheel build, which somehow still did not seem to work sadly.

fire commented 1 year ago

I had some issues compiling sparse torch on Windows for python 3.10

Something in the C++ extension compiling is failing.

     C:\Users\ernes\micromamba\envs\brignet\lib\site-packages\torch\include\pybind11\cast.h(624): error: too few arguments for template template parameter "Tuple"
                detected during instantiation of class "pybind11::detail::tuple_caster<Tuple, Ts...> [with Tuple=std::pair, Ts=<T1, T2>]"
      (721): here

      C:\Users\ernes\micromamba\envs\brignet\lib\site-packages\torch\include\pybind11\cast.h(717): error: too few arguments for template template parameter "Tuple"
                detected during instantiation of class "pybind11::detail::tuple_caster<Tuple, Ts...> [with Tuple=std::pair, Ts=<T1, T2>]"
      (721): here

The rest of the dependencies seems to go through for brignet

Draise14 commented 4 months ago

This still remains an issue for Blender 4.0+ builds.

fire commented 4 months ago

I've been using https://github.com/V-Sekai/blender-rignet as my fork with Blender 4 if this helps anyone.