<div dir="ltr">Hello Everyone,<br><br>I am sorry to join the list with such a lengthy question.<br><br>I am having problems using QGIS in a Python script. This script previously worked. My goal is to dynamically build maps. I am using Mac OS X (M2 processor) and have access to both QGIS 3.44 (installed via MacPorts) and 4.2 (installed from the QGIS website.)<br><br>I read the QGIS documentation on developing apps using QGIS and a few other articles and then gradually began writing code. In the end I had a script that could create a project, import layes in various formats, and run some plugin operations against them. My code worked for several months and then a few months ago it stopped working. I suspect an update to my Mac or to the MacPorts QGIS was the cause, but I cannot get back to a good state.<br><br>So, my question is: Given the current state of QGIS on the Mac, what is the best way to set my environment up to write standalone scripts incorporating QGIS?<br><br>My issue, as far as I can tell, is that the main QGIS library either does not import or crashes when I import it depending upon the QGIS installation.<br><br>Before trying to load qgis I import either PyQt5 (for 3.44) or PyQt6 (for 4.2)<br><br>Using python 3.12, 3.13, or 3.14 if I try to import from /Applications/MacPorts/QGIS3.app/Contents/Resources/python/ (for version 3.44) then the program stops running after the "import qgis" statement but it does not indicate that it has stopped -- it just never reaches the next statement in the programming (i.e. print("I have imported qgis")).<br><br>If I switch to version 4.2 and import from /Applications/QGIS-final-4_2_0.app/Contents/Resources/python3.12/site-packages/ with the same code, then I get a crash with the stack trace ending as follows:<br><br>  File "/Applications/QGIS-final-4_2_0.app/Contents/Resources/python3.12/site-packages/qgis/core/__init__.py", line 29, in <module><br>    from qgis._core import *<br>ImportError: dlopen(/Applications/QGIS-final-4_2_0.app/Contents/Resources/python3.12/site-packages/qgis/_core.so, 0x0002): Library not loaded: @rpath/libpython3.12.dylib<br>  Referenced from: <75DA0087-BE20-3D08-B088-B5B4500EE33B> /Applications/QGIS-final-4_2_0.app/Contents/Resources/python3.12/site-packages/qgis/_core.so<br>  Reason: no LC_RPATH's found<br><br>I understand that in the past you should only expect programming against a QGIS application to work if you either used MacPorts or built it from source. However, I thought that the Mac changes to version 4.x might have changed the recommendation (and also MacPorts does not yet support 4.x). It does not matter to me which version I program against, I just want to get to a stable point.<br><br>Thank you for any pointers you can give.<br><br>Kind Regards,<br>Johnnie Odom<br></div>