[Qgis-user] [Caution - External w/link] Re: Troubleshooting Python Script - QGIS library Import on Recent Versions on Mac OS X
Greg Troxel
gdt at lexort.com
Tue Oct 6 14:49:35 PDT 2026
"Odom, Johnnie" <JOdom at ecsdfl.us> writes:
> Could not find platform independent libraries <prefix>
> Could not find platform dependent libraries <exec_prefix>
> Python path configuration:
> PYTHONHOME = (not set)
> PYTHONPATH = (not set)
> program name = 'python3.12'
> isolated = 0
> environment = 1
> user site = 1
> safe_path = 0
> import site = 1
> is in build tree = 0
> stdlib dir =
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release/lib/python3.12'
> sys._base_executable =
> '/Applications/QGIS-final-4_2_3.app/Contents/MacOS/python3.12'
> sys.base_prefix =
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release'
> sys.base_exec_prefix =
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release'
> sys.platlibdir = 'lib'
> sys.executable = '/path/to/my/venv/bin/python3.12'
> sys.prefix =
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release'
> sys.exec_prefix =
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release'
> sys.path = [
>
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release/lib/python312.zip',
>
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release/lib/python3.12',
>
> '/Users/runner/work/QGIS/QGIS/build/vcpkg_installed/arm64-osx-dynamic-release/lib/python3.12/lib-dynload',
> ]
> Fatal Python error: init_fs_encoding: failed to get the Python codec of the
> filesystem encoding
> Python runtime state: core initialized
> ModuleNotFoundError: No module named 'encodings'
That looks like a buggy configuration to me, but I do not feel 100%
confident in that judgement.
> When I last wrote in, I would fail to build QGIS 4.x on my own machine
> during the building of py-rpds. I wrote up a bug for them and did some more
> digging in logs and found that the deeper cause of the build errors
> included the phrase "mis-aligned LINKEDIT". It turned out quite a few
> builds involving Rust are having similar issues on OS X. To quote one
> submission, "macOS 27's dyld now requires 8-byte alignment on the Mach-O
> LINKEDIT string table" which in turn means you have to build with newer
> versions of Apple's tools which can pad the table to 8-bytes.
So this is really "apple decided that code built with non-brand-new
tools is going to fail".
> It appears that various Rust projects are now patching to get around this
> issue, but their patches are fairly recent and have not made their way into
> QGIS builds yet. The two examples I put into comments on my vcpkg issue at
> https://github.com/Microsoft/vcpkg/issues/54095 cite some fixes that have
> been entered.
It's really hard to tell what's a fix and what's a workaround here.
> I wonder if this is the sort of thing I should file an issue with QGIS
> about, or whether it will resolve on its own during a refresh of the build
> projects QGIS uses when building with vcpkg on the Mac?
This really does not seem like a qgis bug at all.
> On a side note, when I read the blog post stating that the next LTR would
> be 4.4 as they were still squashing a lot of transition issues, I felt seen.
I think those issues are entirely different from your struggles with
binary mac packages.
More information about the QGIS-User
mailing list