2.0.1 Can't find input plugins from Python on OS X / MacPorts #1171

Closed
bpanulla opened this Issue Apr 10, 2012 · 8 comments

Projects

None yet

2 participants

@bpanulla

The 2.0.1 build misconfigures the location of the input plugins when installing in a non-standard location. I installed MacPorts-style into /opt/local, and when I run my mapnik Python script:

mapnik RuntimeError: Could not create datasource. No plugin found for type 'postgis' (searched in: /lib/mapnik/input)

The postgis plugin is alive and well in /opt/local/lib/mapnik/input

Checkin in the paths.py file (for me, /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mapnik/paths.py) shows something interesting:

mapniklibpath = '../../../../../../../../../../../../../../../../../../lib/mapnik'

When I look back at my 2.0.0 installation, built with the same compile arguments I see:

mapniklibpath = '/opt/local/lib/mapnik2'

Editing path.py to reflect the proper location of the input plugins restores operation.

Owner

great, thanks. I've created a 2.0.2 milestone and assigned this issue to it. I'll consider cutting a new tag when I have time to investigate and fix this. The relative paths hook was just sugar for building custom binary packages, so it can easily be disabled under conditions like this when it will break things.

If a Portfile is of any use, I've pushed the one I'm using to build Mapnik to my repo:
https://github.com/bpanulla/myPorts/tree/master/python/py27-mapnik

Owner

I still need to find time to replicate, but my likely fix will be simply to do:

diff --git a/bindings/python/build.py b/bindings/python/build.py
index d466612..cee6973 100644
--- a/bindings/python/build.py
+++ b/bindings/python/build.py
@@ -143,10 +143,7 @@ paths += "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n"
 if not os.path.exists('mapnik'):
     os.mkdir('mapnik')

-if hasattr(os.path,'relpath'): # python 2.6 and above
-    file('mapnik/paths.py','w').write(paths % (os.path.relpath(env['MAPNIK_LIB_DIR'],target_path)))
-else:
-    file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR']))
+file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR']))

 # force open perms temporarily so that `sudo scons install`
 # does not later break simple non-install non-sudo rebuild
bpanulla commented May 3, 2012

That worked like a charm. Want me to queue it up in a pull request?

@springmeyer springmeyer pushed a commit that closed this issue May 4, 2012
Dane Springmeyer avoid trying to determine relative path from python module to plugins…
… as this can make flexible packaging harder - closes #1171
7fe677d
Owner

fixed up in the 2.0.x branch (will be released as 2.0.2) and the master branch, thanks.

@lightmare lightmare pushed a commit to mapycz/mapnik that referenced this issue May 16, 2012
Dane Springmeyer avoid trying to determine relative path from python module to plugins…
… as this can make flexible packaging harder - closes #1171
5016a1d
@springmeyer springmeyer pushed a commit that referenced this issue May 18, 2012
Dane Springmeyer update changelog after #1171 and #1221 2b5ad5b
Owner

hey @bpanulla - just a heads up that 2.0.2 has now been released officially.

bpanulla commented Aug 8, 2012

Trying an updated port now... any suggestions on getting it included in ports when I get it working?

Owner

bpanulla - thanks for doing a new port. If it stalls out just ping me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment