New submission from Carlton Gibson <carlton.gib...@noumenal.es>: Hi.
On MacOS 11.3 "Big Sur", with the latest 3.9.4 installed with the official installer downloaded from python.org, the DYLD_LIBRARY_PATH environment variable is not being respected. This looks very similar to Issue40198 https://bugs.python.org/issue40198 To begin everything looks correct as per 40198: ~ $ python3 --version Python 3.9.4 ~ $ which python3 /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 ~ $ codesign --display --entitlements=:- /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Executable=/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.cs.allow-dyld-environment-variables</key> <true/> <key>com.apple.security.cs.disable-library-validation</key> <true/> <key>com.apple.security.cs.disable-executable-page-protection</key> <true/> <key>com.apple.security.automation.apple-events</key> <true/> </dict> </plist> The active python is that from the official installer, and it looks to have the correct entitlements, as per the resolution to 40198. However, it's not working in practice. I create a script test: ~ $ cat ~/bin/sqlite_config.py import os import sqlite3 print("DYLD_LIBRARY_PATH:" ) print(os.getenv('DYLD_LIBRARY_PATH')) print("SQLite Version:") print(sqlite3.sqlite_version) Together with a compiled SQLite version: ~ $ ls /Users/carlton/lib/sqlite/3.35.4 libsqlite3.dylib Trying to use this, the dylib is not picked up: ~ $ DYLD_LIBRARY_PATH="/Users/carlton/lib/sqlite/3.35.4" python3 ~/bin/sqlite_config.py DYLD_LIBRARY_PATH: /Users/carlton/lib/sqlite/3.35.4 SQLite Version: 3.34.0 Contrast the same when run with a pyenv installed python: ~ $ pyenv which python3.8 /Users/carlton/.pyenv/versions/3.8.3/bin/python3.8 ~ $ DYLD_LIBRARY_PATH="/Users/carlton/lib/sqlite/3.35.4" /Users/carlton/.pyenv/versions/3.8.3/bin/python3.8 ~/bin/sqlite_config.py DYLD_LIBRARY_PATH: /Users/carlton/lib/sqlite/3.35.4 SQLite Version: 3.35.4 The expected result, in both cases, is that the last lines should read: SQLite Version: 3.35.4 I don't know if this is the result of a tightening in macOS' SIP in Big Sur (or something else entirely...) — I thought to test it by installing the official build in a different location (so not in the SIP protected `/Library/` space but somewhere in `~` but the installer doesn't look like it allows that (no doubt for good reasons). Next step for me with be building from source to see if I can dig deeper, but I thought I'd report it, as it does look like a change in behaviour from the *success* reported in 40198. Thanks very much! ---------- components: macOS messages: 390529 nosy: carltongibson, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: macOS official installer builds not respecting DYLD_LIBRARY_PATH environment variable. type: behavior versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43773> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com