Thicket-Blender / thicket

Thicket: Laubwerk Plants Add-on for Blender
GNU General Public License v2.0
65 stars 8 forks source link

Laubwerk Python Extension doesn't support Python 3.10 (So Blender 3.1 and later are unsupported) #56

Closed gianlucaf81 closed 4 months ago

gianlucaf81 commented 1 year ago

Describe the bug thicket-0_4_1_rc0.zip

Failed to load Laubwerk Python Extension from this path error message.

Screenshots

https://ibb.co/yX1Z8g7 https://ibb.co/Csm8vhw

Describe the bug thicket-0_4_0.zip

https://ibb.co/StNFt81

Desktop (please complete the following information):

dvhart commented 1 year ago

Thanks for reporting the bug @gianlucaf81 . I haven't done an update for Blender 3.x in a while, so a change in API is possible, even likely. I'll have a look.

In the meantime, can you try two things?

1) Which version of Laubwerk are you using? 2) Did you install the Python plugin during the Laubwerk installation as described in the README?

gianlucaf81 commented 1 year ago

Hi, thak you for the answer.

  1. I tried LaubwerkPlantsKitFreebie 1.0.33 and also 1.0.43 1b. I tried a clean installation of 1.0.43
  2. yes, I put the screenshot of the Python folder for comparison if it could possibly be useful. I remain available for any test you ask me to do. Thank you.
dvhart commented 1 year ago

OK, so the 0_4_1_rc0 release seems to work up through and including blender 3.1. In my 3.4 installation, the import fails with:

import laubwerk Traceback (most recent call last): File "/Library/Application Support/Laubwerk/Python/laubwerk/init.py", line 39, in from laubwerk._laubwerk import * ImportError: dlopen(/Library/Application Support/Laubwerk/Python/laubwerk/_laubwerk.so, 0x0002): symbol not found in flat namespace (_PyCObject_Type)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/3.4/python/lib/python3.10/code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "/Library/Application Support/Laubwerk/Python/laubwerk/init.py", line 42, in raise ImportError('Unable to import Laubwerk module: {}'.format(err)) ImportError: Unable to import Laubwerk module: dlopen(/Library/Application Support/Laubwerk/Python/laubwerk/_laubwerk.so, 0x0002): symbol not found in flat namespace (_PyCObject_Type)

This appears to be another issue with the Blender python installation. I'll file a ticket and see what comes of it.

dvhart commented 1 year ago

I've opened a blender issue: https://projects.blender.org/blender/blender/issues/105360

In the meantime, can you confirm if Blender 3.1 works for you?

gianlucaf81 commented 1 year ago

Laubwerk

Hi, thank you for the support. I downloaded the 3.1.0 portable version but it gives me the same problem with both versions. I don't know at this point if it's my mistake or a misconfiguration.I'll try on another pc in the morning.

UPDATE

I've tried with Blender 3.0.0 this is the result. 0.4.0 same error 0.4.1 rebuild database button is red but seems don't work.

https://ibb.co/hyyXNDh

dvhart commented 1 year ago

It looks like I meant 3.0.1, as 3.1 also moved to Python 3.10. It looks like this may be a limitation of the Laubwerk python extension (supports only up to 3.9). I'll work to confirm tonight. If that's the case, I'll reach out to Laubwerk for support.

dvhart commented 1 year ago

I'm not sure what would cause the rebuild db to fail in that way, I haven't seen that before. I successfully rebuild the DB on 3.0.1 with Thicket 0.4.1 on Mac (but with Laubwerk 1.0.37).

I'm going to focus on the python 3.10 support from Laubwerk, but will see if I can repro the DB issue as well.

dvhart commented 1 year ago

@tdapper The Laubwerk Python Extension ships with _laubwerk.cpython shared object files for Python 3.4 through 3.9. As of Blender 3.1, Blender ships with Python 3.10, preventing the Laubwerk python module from loading with the following error:

ImportError: Unable to import Laubwerk module: dlopen(/Library/Application Support/Laubwerk/Python/laubwerk/_laubwerk.so, 0x0002): symbol not found in flat namespace (_PyCObject_Type)

Would you please consider adding Python 3.10 support to the next release?

gianlucaf81 commented 1 year ago

I'm not sure what would cause the rebuild db to fail in that way, I haven't seen that before. I successfully rebuild the DB on 3.0.1 with Thicket 0.4.1 on Mac (but with Laubwerk 1.0.37).

I'm going to focus on the python 3.10 support from Laubwerk, but will see if I can repro the DB issue as well.

Thanks, could you give me version 1.0.37 to test?

dvhart commented 1 year ago

@gianlucaf81 I can't redistribute the Laubwerk binaries (and interestingly enough, I don't actually have a copy of the 1.0.37 installer. I'll work on confirming 1.0.43 is working with Blender 3.0 and then trying to debug why your installation isn't working. One thing that would help me is to launch Blender from the terminal and share any output from the Thicket add on.

dvhart commented 1 year ago

@gianlucaf81 I found that when installing a fresh Laubwerk 1.0.43, the Python Extension still reports as 1.0.39. This makes me wonder if there might be a difference in the Mac and Windows Python Extension shipped in the Laubwerk Plant Kit Freebie - and if 1.0.43 is newer in the Windows version you're using, there might be a problem there that I can't replicate on the Mac which shows as 1.0.39. Reading through the above, it doesn't look like you have tried Blender 3.0.1 with Laubwerk 1.0.33 and Thicket 0.4.1 - would be able to give that a try? In the meantime, I'm in contact with Laubwerk and working toward a proper fix for Blender 3.2 and later.

gianlucaf81 commented 1 year ago

I tried this morning with Blender 3.0.1 also deleting the script folder but the result is this:

https://ibb.co/QQFMkm8 https://ibb.co/6JgJ303

Now I try with a virtual machine and see what happens.

dvhart commented 1 year ago

@gianlucaf81 OK, the 0.4.0 behavior is expected, Blender 3.0 API changes require the 0.4.1 Thicket add on. What I'd need to understand what's going in the 0.4.1 case is either the console output (by running Blender from the Window terminal), or manually attempting to import the Laubwerk modules from Blender Python Console, with something like:

import sys
sys.path.append("path to laubwerk python")
import laubwerk
gianlucaf81 commented 1 year ago

@gianlucaf81 OK, the 0.4.0 behavior is expected, Blender 3.0 API changes require the 0.4.1 Thicket add on. What I'd need to understand what's going in the 0.4.1 case is either the console output (by running Blender from the Window terminal), or manually attempting to import the Laubwerk modules from Blender Python Console, with something like:

import sys
sys.path.append("path to laubwerk python")
import laubwerk
PYTHON INTERACTIVE CONSOLE 3.9.7 (default, Oct 11 2021, 19:31:28) [MSC v.1916 64 bit (AMD64)]

Builtin Modules:       bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils
Convenience Imports:   from mathutils import *; from math import *
Convenience Variables: C = bpy.context, D = bpy.data

>>> import sys
>>> sys.path.append("C:\Program Files\Laubwerk\Python")
>>> import laubwerk
Traceback (most recent call last):
  File "C:\Program Files\Laubwerk\Python\laubwerk\__init__.py", line 17, in <module>
    from laubwerk._laubwerk import *
ImportError: DLL load failed while importing _laubwerk: Impossibile trovare il modulo specificato.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Laubwerk\Python\laubwerk\__init__.py", line 19, in <module>
    raise ImportError('Unable to import Laubwerk module: {}'.format(err))
ImportError: Unable to import Laubwerk module: DLL load failed while importing _laubwerk: Impossibile trovare il modulo specificato. 
dvhart commented 1 year ago

Thanks @gianlucaf81, OK, that looks like it's failing to find a dll. Can you capture a listing (or screenshot) of the Laubwerk/Python/laubwerk/ contents? There should be a listing of .dll files, one should have "39" in the name, which is required to work with Python 3.9 (the error message suggests that might be missing).

gianlucaf81 commented 1 year ago

Grazie@gianlucaf81, OK, sembra che non riesca a trovare una dll. Puoi acquisire un elenco (o uno screenshot) dei contenuti di Laubwerk/Python/laubwerk/? Dovrebbe esserci un elenco di file .dll, uno dovrebbe avere "39" nel nome, che è necessario per lavorare con Python 3.9 (il messaggio di errore suggerisce che potrebbe mancare).

https://ibb.co/1q53FDM

Houston, we have a problem

Python Folder.txt

dvhart commented 1 year ago

@gianlucaf81 Ok, that explains the error you are seeing and why it differs from what I see on Mac OS. So for a Blender 3.0+ support we need to wait for Laubwerk to update their Python Extension to include Python 3.10 support (and 3.9 for Blender 3.0.1). For the single release of Blender 3.0.1, which still uses Python 3.9, the Laubwerk Python Extension for Mac has the necessary support, while it appears to be missing from the Windows package.

With the single exception of Blender 3.0.1 on Mac OS (which works with Thicket 0.4.1), we are blocked on an update from Laubwerk. I will continue to work with Laubwerk to have Thicket support ready as soon after their release as possible.

tdapper commented 1 year ago

@dvhart, just so you know, the 1.0.44 Laubwerk Extension has been released. It may have a few additional changes that will require Thicket to be updated, but support for Python 3.10 and 3.11 are there now.

dvhart commented 4 months ago

Due to changes in the Laubwerk API and the lack of current API documentation, I am no longer able to develop or maintain Thicket. Consider trying Laubwerk’s fork of thicket:

https://github.com/Laubwerk/player-for-blender

Thank you for using Thicket, it was a lot of fun to develop.