OpenGeoscience / geonotebook

A Jupyter notebook extension for geospatial visualization and analysis
Apache License 2.0
1.08k stars 141 forks source link

Issue Installing Mapnik #138

Closed ghost closed 6 years ago

ghost commented 6 years ago

when running: pip install . I get the output:

Python bindings for Mapnik (https://github.com/mapnik/python-mapnik) are
required to run GeoNotebook. Unfortunately there are no pip install-able
versions of the bindings for Python 3. The Mapnik bindings will compile
under Python 3 but they must be compiled and installed from source.
Please follow the instructions on the mapnik/python-mapnik repository,
ensuring you can import mapnik before continuing to install GeoNotebook
using Python 3.

When Installing Mapnik, I get:

python setup.py install

Traceback (most recent call last): File "setup.py", line 114, in lib_path = os.path.join(check_output([mapnik_config, '--prefix']),'lib') File "setup.py", line 20, in check_output output = subprocess.check_output(args) File "/Users/davidleifer/anaconda/lib/python3.5/subprocess.py", line 626, in check_output *kwargs).stdout File "/Users/davidleifer/anaconda/lib/python3.5/subprocess.py", line 693, in run with Popen(popenargs, **kwargs) as process: File "/Users/davidleifer/anaconda/lib/python3.5/subprocess.py", line 947, in init restore_signals, start_new_session) File "/Users/davidleifer/anaconda/lib/python3.5/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'mapnik-config'

What am I doing wrong?

kotfic commented 6 years ago

@DavidLeifer if you're unable to find mapnik-config then either you don't have mapnik installed (it is a system library that includes some binaries - such as mapnik-config). Or you have mapnik installed but not in a location that it is being found. What OS are you using?

ghost commented 6 years ago

Thank you for the response, I am using Mac OS.

dorukozturk commented 6 years ago

You can check this out for Mac OS instructions https://github.com/mapnik/mapnik/wiki/MacInstallation.

ghost commented 6 years ago

When I tried git cloning the repository to install from the top, I get:

Permission denied (publickey). fatal: Could not read from remote repository.

Maybe that has something to do with why I can't handle the installation.

aashish24 commented 6 years ago

@DavidLeifer are you behind some firewall? Also, make sure you are using git:// or https protocol.

ghost commented 6 years ago

That's what I get when I run the line from the install instructions:

git clone git@github.com:OpenGeoscience/geonotebook.git I ended up running

git clone https://github.com/OpenGeoscience/geonotebook.git

and that worked.

I still have the same problem that it's not reading that I have mapnik installed. I succesfully installed mapnik using

brew install mapnik

But when I run:

pip install .

I still get the same error as my first message. Could this be because I have conda installed on my computer? That it's not reading I have mapnik installed via homebrew?

Trying to install mapnik from source tells me that it is not supported on Python3.

aashish24 commented 6 years ago

@DavidLeifer as @dorukozturk pointed out, you would have to build Mapnik yourself as you are using Python3 as it seems like.

Also, do not use git@github.com unless you have write access to repository. You want to use git:// or https:// (later if you are in a secure environment).

ghost commented 6 years ago

I tried to install from source as it is documented:

git clone https://github.com/mapnik/mapnik.git cd mapnik git checkout v3.0.12 git submodule update --init ./configure && make && make test But I get the output:

scons: *** SCons version 2.5.0 does not run under Python version 3.5.2. Python 3 is not yet supported.

kotfic commented 6 years ago

@DavidLeifer I believe you can specify the version SCons will use in the following way:

    $ PYTHON=python2 ./configure
    $ make PYTHON=python2

You may want to take a look at the INSTALL.md and InstallationTroubleshooting in the mapnik wiki

ghost commented 6 years ago

After running that I get:

Checking for Boost version >= 1.47... no Found boost lib version... Boost version 1.47 or greater is required

So after installing Boost with:

sudo port install boost

I still get the same error. This is like an endless rabbit hole..

aashish24 commented 6 years ago

@DavidLeifer sorry to hear this. Allow us to look into it bit more in detail. My understanding is that you are using:

Python 3 MacOS

and you would like to build everything off source. If I am mistaken, please report back. thanks.

ghost commented 6 years ago

That is correct. I also have Anaconda already installed.

aashish24 commented 6 years ago

@DavidLeifer can you try the instructions here:

https://docs.google.com/a/kitware.com/document/d/1jTJ4dakYAeIjo9YnjBFysyDKSziRLuaQgKZdaRwY14o/edit?usp=sharing

it should get your boost, mapnik build going with python 3. I still have to add 1-2 steps for the full geonotebook build but I am curious if you can get these two packages built. Once we have it complete, I can add it to the RTD.

aashish24 commented 6 years ago

public link: https://docs.google.com/document/d/1jTJ4dakYAeIjo9YnjBFysyDKSziRLuaQgKZdaRwY14o/edit?usp=sharing

aashish24 commented 6 years ago

@DavidLeifer I have not heard back. Perhaps I missed your email?

ghost commented 6 years ago

@aashish24 Did you get it to work on Anaconda?

slipring commented 6 years ago

@aashish24 Your doc helped me thoroughly troubleshoot my problematic install of geonotebook (brew/anaconda mess). I'd been able to get as far as an empty frame showing up with Python 2.7--where I had more traction with dependencies fulfilled than in py3 initally. But no map, no M object. Finally worked with your guide + accumulated experiences, on a fresh Python 3.5 anaconda environment for geonotebook, and hey it's a map! Thank you! Now to explore...

But first, a rough map that may or may not help others: Getting the python extensions working for mapnik [python-mapnik] was (one of) the sticky point(s) the linked google doc guide helped with, though after setup, I wasn't sure I had activated them? I ended up adding the directory with the the .so files to my PYTHONPATH, haven't checked if it was necessary.

Next traces forward, testing in python, trying 'import mapnik', was running into libjpeg 9 errors. My packages are a total mess, so uninstalling and reinstalling the image libraries wasn't happening. Mess benefit, had many installs of the associated libraries going back a ways. Was able brew switch to libjpeg 8d, and libtiff 4.0.6 and off we go~

Oh, and many retries with GDAL not installing as smoothly with pip as the other requirements. Conda didn't seem to have the issue though -- fixed that (I think) with something along the lines of: conda install GDAL=2.1.0

aashish24 commented 6 years ago

@aashish24 Did you get it to work on Anaconda?

@DavidLeifer I did not get chance to make it work on Anaconda. Did you?

aashish24 commented 6 years ago

@slipring thanks for the update. I did not get a chance to reply earlier. You are correct about jpeg issues. I believe I had a note about it in the document. Once we get some funding, I will work on cleaning it up some more and perhaps work on creating a conda version of GeoNotebook.