Page MenuHome

macOS: addons fail to import due to Python 3.9 libraries linking against libz.dylib
Closed, ResolvedPublic

Description

System Information
Operating system: MacOs 11.2
Graphics card: AMD Radeon Pro 5500M 8 GB

Blender Version
Broken: MacOs 2.93
Worked: 2.92 and Win10 2.93

Short description of error
Addon Rigify won't load with 2.93 MacOs version.
Exact steps for others to reproduce the error
Run import binascii in Blender.


Or

Python: Traceback (most recent call last):
  File "/Applications/Blender.app/Contents/Resources/2.93/scripts/startup/bl_operators/userpref.py", line 609, in execute
    import zipfile
  File "/Applications/Blender.app/Contents/Resources/2.93/python/lib/python3.9/zipfile.py", line 6, in <module>
    import binascii
ImportError: dlopen(/Applications/Blender.app/Contents/Resources/2.93/python/lib/python3.9/lib-dynload/binascii.cpython-39-darwin.so, 2): Library not   loaded: libz.1.dylib
  Referenced from: /Applications/Blender.app/Contents/Resources/2.93/python/lib/python3.9/lib-dynload/binascii.cpython-39-darwin.so
  Reason: unsafe use of relative rpath libz.1.dylib in /Applications/Blender.app/Contents/Resources/2.93/python/lib/python3.9/lib-dynload/binascii.cpython-39-darwin.so with restricted binary
`

Win10 version works fine.
Thanks!

Piotr

Event Timeline

Ok I found a workaround. It's a Mac security issue.
When I disable the Mac's SIP (System Integrity Protection), I can load the Addon without any errors and everything works as expected.
I have no clue how to solve this at a Blender (Rigify?) level. Can anyone help? I'm not sure it's a good idea to lower the system's security to be able to run an addon...

Ah great! I tried searching for similar issues but failed miserably. Thanks @Ankit Meel (ankitm) !

Ankit Meel (ankitm) changed the task status from Needs Triage to Needs Information from User.Thu, Feb 18, 9:19 AM

Does a new build from https://builder.blender.org/download/ fix this issue ?

@Ankit jain (Ankit) Meel (ankitm)
Nope sorry. The latest nightly gives me the same error (related to Python?). I have to disable the mac's SIP to access the addon...

Could you share the output of xattr -l -r /Applications/Blender.app ?

Sure! Here are two outputs from two machines (working and non-working). In case it's helpful...

Ankit Meel (ankitm) changed the task status from Needs Information from User to Confirmed.Thu, Feb 18, 12:42 PM
$ otool -l /usr/lib/libz.1.dylib
/usr/lib/libz.1.dylib:
...
Load command 3
          cmd LC_ID_DYLIB
      cmdsize 48
         name /usr/lib/libz.1.dylib (offset 24)
   time stamp 1 Thu Jan  1 05:30:01 1970
      current version 1.2.11
compatibility version 1.0.0
...

The ID of libz seems correct.. so not sure why our library has a relative rpath ?

$ otool -L "/Users/ankitkumar/blender-build/lib/darwin/python/lib/python3.9/lib-dynload/binascii.cpython-39-darwin.so"
/Users/ankitkumar/blender-build/lib/darwin/python/lib/python3.9/lib-dynload/binascii.cpython-39-darwin.so:
	libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

The hotfix is install_name_tool -change ... but would be nice to fix cmake builder somehow.
CC @Sebastián Barschkis (sebbas)

Ankit Meel (ankitm) added a comment.EditedSat, Feb 20, 8:12 AM

I think this is a side effect of rBc70eb30240f8: Build environment: Make sure Python is linkign against static Zlib
macOS Python libraries should either link statically against zlib with a patch like that of linux, or use the system installation of Zlib.
Still need to build python to see if removing that dependency and those flags helps this issue.

Still need to build python to see if removing that dependency and those flags helps this issue.

Or reuse the patch to see if Python stays happy with libz_pic.a.

@Ankit Meel (ankitm) Thanks for merging my report. I was aware of this one here, but thought a more generalized phrasing would draw more attention to, what looks like a very pressing issue.
If you think it makes sense, maybe rename this one here to reflect that?
Anyway, thanks for the fix, hope it gets committed quickly!

Ankit Meel (ankitm) renamed this task from Rigify not loading with latest MacOs 2.93 nightlies to macOS: addons fail to import due to Python 3.9 libraries linking against libz.dylib.Sat, Feb 20, 12:10 PM
Ankit Meel (ankitm) updated the task description. (Show Details)
Ankit Meel (ankitm) reopened this task as Confirmed.Tue, Feb 23, 4:15 AM

Actually it will be resolved after libraries are committed https://developer.blender.org/diffusion/BL/history/trunk/lib/

I just discovered this issue today for OS Linux/Manjaro -- cannot [install...] any addons from .zip file. This is currently affecting all blender versions I have tried:

2.83.9

2.91.0

2.91.2 (Date 2021-01-19 16:15, Hash: 5be9ef417703, Branch: master)
PYTHON INTERACTIVE CONSOLE 3.9.1 (default, Feb 6 2021, 06:49:13) [GCC 10.2.0]

2.92.0 (release) (Date: 2021-02-24 1625, Hash: 02948a2cab44, Branch: master)
PYTHON INTERACTIVE CONSOLE 3.7.7 (default, Jul 9 2020, 12:52:49) [GCC 9.3.1 20200408 (Red Hat 9.3.1-2)]

2.93.0 alpha build (Date: 2021-02-27 20:22, Hash: 92743cc895dd, Branch: master)
PYTHON INTERACTIVE CONSOLE 3.9.2 (default, Feb 25 2021, 12:19:39) [GCC 9.3.1 20200408 (Red Hat 9.3.1-2)]

system-info.txt from 2.93.0 alpha build

...
have the libraries been committed yet? (as mentioned by Ankit Meel, above)

This is currently affecting all blender versions I have tried:

Then it's not the same issue. Please file a new bug report, or search previous reports for something related.

have the libraries been committed yet?

Yes, and new Blender builds have been uploaded too. But again, yours is a different issue.

ok, will file a new bug report.

I followed T85801 (Any addon installation from zip will fail in Blender 2.93 (using Python 3.9.1)) to get to this (T85648). It appeared that similar bug reports were being lumped here. Sorry for my confusion.