Bug report #22029

Wrong Python default path in QGIS server on macOS

Added by vince - almost 5 years ago. Updated almost 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:QGIS Server
Affected QGIS version:3.6.2 Regression?:No
Operating System:macOS Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29843

Description

It appears that QGis server layout is broken when compiled on MacOS. Frameworks are expected in @loader_path/../../Frameworks/ whereas the right access path is @loader_path/../../../../Frameworks and for libraries instead of @loader_path/../lib this is @loader_path/../../lib. This is inconvenient, though fixable using install_name_tool.

However, when QGIS server starts, the path given to the Python interpreter is wrong, and that causes the server to fail

Initializing server modules from "/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server" 

"Checking /Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server for native services modules" 
"Loading native module /Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server/libdummy.so" 
"Loading native module /Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server/libwcs.so" 
"Loading native module /Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server/libwfs.so" 
"Loading native module /Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server/libwms.so" 
"Loading native module /Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/lib/qgis/server/libwmts.so" 

"Couldn't load SIP module.
Python support will be disabled.

Traceback (most recent call last):
  File \"\", line 1, in 
ModuleNotFoundError: No module named 'qgis'

Python version:
3.6.8 (default, Dec 30 2018, 13:01:27) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]

QGIS version:
3.6.2-Noosa 'Noosa', exported

Python path:
['/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/../Resources/python', '/Users/lore/Library/Application Support/QGIS/QGIS3/profiles/default/python', '/Users/lore/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins', '/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/../Resources/python/plugins', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']" 
"An error occurred during execution of following code:
qgis.utils.uninstallErrorHook()

Traceback (most recent call last):
  File \"\", line 1, in 
NameError: name 'qgis' is not defined

Python version:
3.6.8 (default, Dec 30 2018, 13:01:27) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]

QGIS version:
3.6.2-Noosa 'Noosa', exported

Python path:
['/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/../Resources/python', '/Users/lore/Library/Application Support/QGIS/QGIS3/profiles/default/python', '/Users/lore/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins', '/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/../Resources/python/plugins', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']" QFSFileEngine::open: No file name specified Content-Length: 54 Content-Type: text/xml; charset=utf-8 Server: Qgis FCGI server - QGis version 3.6.2-Noosa Status: 500 Project file error

This path: '/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/../Resources/python' is wrong. It should be '/Applications/MacPorts/Qgis3.app/Contents/MacOS/fcgi-bin/../../Resources/python'. So far I have failed to find out where this path was set (in order to correct it). Can anyone help?

History

#1 Updated by Giovanni Manghi almost 5 years ago

  • Crashes QGIS or corrupts data changed from Yes to No
  • Operating System changed from MacOS X to macOS
  • Subject changed from Wrong Python default path in QGis server to Wrong Python default path in QGIS server on macOS

Also available in: Atom PDF