mapnik / mapnik-support

Use the issues queue here to ask questions and offer help on using Mapnik (maybe if this works well we can retire the mailing list at http://mapnik.org/contact/?)
6 stars 6 forks source link

OSX Installation #86

Open fiatracer28 opened 7 years ago

fiatracer28 commented 7 years ago

Hi

I am sure this is not a new issue, but I can't seem to find a solution.

I have installed Mapnik 2.2 via the OSX 64 bit package and I get the error "ImportError: No module named mapnik"

I also tried the Homebrew installation with the same message. Can anyone help with the solution please, I did read on a forum Python bindings need to be installed, but cannot find anything about how to do this.

I am new to all of this so any idiot proof advice would be greatly appreciated!

Thanks

djakk commented 7 years ago

Hello !

I think the python bindings are not needed for Mapnik 2, you need them for Mapnik 3.

"ImportError: No module named mapnik" means that python can't find mapnik in the folder /Library/Python/2.7/site-packages ; did you have any mapnik-related folder or file in it ?

djakk commented 7 years ago

PS : why are you on mapnik 2 and not on mapnik 3 ? If you are afraid to install mapnik 3, I can help you, I've managed to install mapnik 3 from source under El Capitan and Sierra.

ngunhaSO commented 6 years ago

@djakk : do you install mapnik 3 on Sierra with python3? I am trying to install mapnik with python3 from source and I pump into this issue: BOOST_SPIRIT_DEFINE( ^ /usr/local/include/boost/spirit/home/x3/nonterminal/rule.hpp:184:5: note: expanded from macro 'BOOST_SPIRIT_DEFINE' BOOST_SPIRITDEFINE, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \ ^ include/mapnik/svg/svg_path_grammar_x3_def.hpp:119:21: note: candidate function template not viable: requires single argument 'ctx', but no arguments were provided auto const arc_to = [] (auto & ctx) ^ 2 errors generated. scons: [src/svg/svg_path_grammar_x3.os] Error 1 scons: building terminated because of errors. make: [mapnik] Error 2

Do you have any suggestion how to solve this?

The steps that I did:

git clone https://github.com/mapnik/mapnik.git cd mapnik/ git submodule update --init PYTHON=python3 ./configure make PYTHON=python3

Thank you

djakk commented 6 years ago

Hello @ngunhaSO ! Unfortunately, I did install with python 2.7 only. What is your config file ?

ngunhaSO commented 6 years ago

@djakk I decided to use brew to install the mapnik. mapnik-config --version 3.0.20

Now I am stuck with the mapnik-python installation. I keep getting this error: "ld: library not found for -lboost-python3 clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'clang++' failed with exit status 1"

Even though when i do: brew list | grep 'boost', I got the following boost like the below boost boost-python boost-python3

Before I ran: python3 setup.py build, I also exported the environment by doing this: export BOOST_PYTHON_LIB=boost-python3

But the error still persists

Full steps that I did to try to install this mapnik-python mapping:

  1. git clone https://github.com/mapnik/python-mapnik.git
  2. cd python-mapnik/
  3. git checkout v3.0.x
  4. export BOOST_PYTHON_LIB=boost-python3
    • note: boost-python3 is installed via brew, then I set: ln -s /usr/local/lib/libboost_python36.a /usr/local/lib/libboost_python3.a ln -s /usr/local/lib/libboost_python36.dylib /usr/local/lib/libboost_python3.dylib Try export BOOST_PYTHON=/usr/local/Cellar/boost-python3/1.67.0_1/lib also does not work
  5. python3 setup.py build

My python3 version: python3 --version Python 3.6.5 mapnik-config --version 3.0.20

Do you have any idea how to fix this?

If i do: export MASON_BUILD=true, I got a different error: /Users/jackynguyen/Downloads/python-mapnik/mason_packages/.link/include/boost/config/posix_features.hpp:18:15: fatal error: 'unistd.h' file not found