Last active
October 8, 2021 17:04
-
-
Save snickell/ee8f3d96f11f457c30ef5416a12d625e to your computer and use it in GitHub Desktop.
Script for installing python-mapnik on MacOS Catalina with Homebrew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# note: boost needs to be >= 1.73, make sure [email protected] is linked too | |
brew install boost boost-python3 sqlite gdal cairo [email protected] | |
brew upgrade boost boost-python3 sqlite gdal cairo [email protected] | |
brew link boost | |
# We're build a custom mapnik 4, uninstall the stale 3.x version in homebrew: | |
brew uninstall mapnik | |
mkdir build-python-mapnik | |
cd build-python-mapnik | |
# Build Mapnik from master | |
git clone https://github.com/mapnik/mapnik | |
cd mapnik | |
git submodule update --init | |
set -e | |
# be explicit: python3 will result in sconstruct build failure | |
PYTHON=python2 ./configure SQLITE_INCLUDES=/usr/local/opt/sqlite3/include | |
JOBS=8 make | |
make install | |
set +e | |
cd .. | |
git clone https://github.com/mapnik/python-mapnik | |
cd python-mapnik | |
set -e | |
BOOST_PYTHON_LIB=boost_python38 python3 setup.py install | |
#!/bin/bash | |
# note: boost needs to be >= 1.73, make sure [email protected] is linked too | |
brew install boost boost-python3 sqlite gdal cairo [email protected] | |
brew upgrade boost boost-python3 sqlite gdal cairo [email protected] | |
brew link boost | |
# We're build a custom mapnik 4, uninstall the stale 3.x version in homebrew: | |
brew uninstall mapnik | |
mkdir build-python-mapnik | |
cd build-python-mapnik | |
# Build Mapnik from master | |
git clone https://github.com/mapnik/mapnik | |
cd mapnik | |
git submodule update --init | |
set -e | |
# be explicit: python3 will result in sconstruct build failure | |
PYTHON=python2 ./configure SQLITE_INCLUDES=/usr/local/opt/sqlite3/include | |
JOBS=8 make | |
make install | |
set +e | |
cd .. | |
git clone https://github.com/mapnik/python-mapnik | |
cd python-mapnik | |
set -e | |
BOOST_PYTHON_LIB=boost_python38 python3 setup.py install | |
cd ../.. | |
python3 -c "import mapnik ; print(dir(mapnik))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found that as is the build didn't pick up some the options - GDAL and PROJ. I fixed this by adding to the configure line as follows:
PYTHON=python2 ./configure SQLITE_INCLUDES=/usr/local/opt/sqlite3/include GDAL_CONFIG=/usr/local/opt/gdal/bin/gdal-config PROJ_LIBS=/usr/local/lib PROJ_INCLUDES=/usr/local/include CUSTOM_DEFINES='-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1'
The last one allows use of newer versions of PROJ than PROJ 4.