Pyinstaller, Matplotlib and BaseMap

Having big problems persuading a python,matplotlib and Basemap project to freeze using Pyinstaller.

On doze and Linux,

Basemap kept looking in the site distribution for the data files.

Workround I found was the addition of this environment variable PROJ_DIR via a tweak to proj.py
as per this post http://code.google.com/p/pyproj/issues/detail?id=40&q=PROJ_DIR

Which boils down to around line 239, replace this line


pyproj_datadir = '/usr/share/basemap/data'

with

if 'PROJ_DIR' in os.environ:
   pyproj_datadir = os.environ['PROJ_DIR']
else:
    pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data'])

I still needed to copy the mpl_tools folder across top where the pyinstaller produced single file executable was stored.

Then set these env variables as always ymmv

(looking round in basemaps proj.py and pyproj.py for where folders get set can be fruitful )as well)

I will document this more fully sometime,along with all the useful links I found on the way meantime this may help you get working

set BASEMAPDATA=p:\dist\mpl_toolkits\basemap\data

set PROJ_DIR=P:\dist\mpl_toolkits\basemap\data

This entry was posted in coding, linux, matplotlib, pandas and tagged , , . Bookmark the permalink.

Comments are closed.