Skip to content

How to: test pgRoutingLayer 3 on M1 Mac

Ko Nagase edited this page Oct 1, 2022 · 2 revisions

How to: test pgRoutingLayer 3 on M1 Mac

September 25, 2022

Based on How to: test pgRoutingLayer v3.0.0, but modified for M1 Mac

Clone & Download

git clone https://github.com/pgRouting/pgRoutingLayer
cd pgRoutingLayer

Install Homebrew Python and dependencies

PyQt5 installation seems to be difficult, so use Homebrew version python3 and pip3 instead of virtual environment.

brew install python qt@5 pyqt@5

Install the needed packages

Install the needed packages (only need to do once)

pip3 install mkdocs
pip3 install pb_tool

Each packages are installed into same directory as pip which location can be seen from version check.

% pip3 --version
pip 22.2.2 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)

Use the pb_tool

pb_tool --help

Install QGIS (if not installed)

If not install, go to and follow the instructions and install macOS version. QGIS download

Get ready

From the menu: Settings -> User Profiles -> New Profile ...

Fill the form: New profile name: pgrouting

Opens a new QGIS window with the profile pgRouting, close the old window.

Check the profile folder: Settings -> User Profiles -> Open Active Profile Folder

Edit pb_tool.cfg

Change the line:

plugin_path: /Users/sanak/Library/Application Support/QGIS/QGIS3/profiles/pgrouting/python/plugins
  • !!!Double quotations and escape (\) before whitespace are not necessary.!!!
    • These cause troubles to create invalid plugins folders.

Deploy the plugin

pb_tool deploy

Open QGIS Plugins -> Manage and Install plugins -> Settings tab Add tick mark on the form to:

  • Check for updates on startup
  • Show also experimental plugins

Plugins -> Manage and Install plugins -> Installed pgRoutingLayer should show Add tick mark on pgRoutingLayer

Test

export PYTHONPATH=/Applications/QGIS.app/Contents/Resources/python:functions
python3 -m unittest tests/test_init.py
python3 -m unittest tests/Test_utils.py
python3 -m unittest tests/Test_FunctionBase.py
python3 -m unittest tests/qgis_models.py

But most of tests fails due to M1 Mac's arm64 compatibility.

ImportError: dlopen(/Applications/QGIS.app/Contents/Resources/python/qgis/_core.so, 0x0002): 
tried: '/Applications/QGIS.app/Contents/Resources/python/qgis/_core.so' 
(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))