<div dir="ltr">Graham,<div><br></div><div>Thanks so much for writing. This is quite a pickle and extremely annoying even for me--I was dealing with a similar issue on my own system yesterday. Here is the general problem: basemap is an "extension" of the matplotlib package. So even if you install basemap successfully but it does place it in the "extension" folder corresponding to the matplotlib that actually is imported, it won't work. This is a tricky problem anyway compounded by the issue that you have multiple python versions.</div><div><br></div><div>Let's diagnose a few things:</div><div><br></div><div>* Which version of python is your "python" command? I see you specifically ran "/usr/local/sci/bin/python2.7" when you setup ILAMB, but later use just "python". My guess is that it is 2.7.xx but just to be sure run a:</div><div><br></div><div>python --version</div><div><br></div><div>* Where is the matplotlib that is getting loaded? The __path__ variable of a module is very useful in determining what in the world is going on. It gives the location of the module being imported.</div><div><br></div><div>python -c "import matplotlib; print matplotlib.__path__"</div><div><br></div><div>My guess is that while basemap is installed in "/usr/local/sci/lib/python2.7/site-packages/" your matplotlib which is being loaded is in ".local/lib/python2.6/site-packages/". This would explain why basemap isn't getting loaded. </div><div><br></div><div>If this is the case, we just need to tell python to look for packages first in /usr/local/sci. Try exporting an environment variable (assuming bash):</div><div><br></div><div>export PYTHONPATH=/usr/local/sci/lib/python2.7:$PATH</div><div><br></div><div>This will give preference to the location where you have basemap installed. Ultimately, I had such problems with packages that I used pip to uninstall most everything I use frequently, and then reinstalled them all in one location. This is the spirit behind my recommendation to always install with the --user option. If everything is in one location, then you have a better shot at everything just working.</div><div><br></div><div>Let me know how it goes. I am starting to get more of these kinds of mails so I have made a users list for ILAMB in hopes that our discussion will be helpful for others, I am CC'ing this list.</div><div><br></div><div>Nate</div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 19, 2016 at 10:01 AM Weedon, Graham <<a href="mailto:graham.weedon@metoffice.gov.uk">graham.weedon@metoffice.gov.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Dear Nathan,<u></u><u></u></p>
<p class="MsoNormal"> I have been asked to evaluate the ILAMBv2.0 for use with JULES (the LSM used by the Met Office). Unfortunately, I am unable to complete the installation because setup.py is unable to find the basemap module. This seems to be caused
by our having two installations of Python (both 2.6 and 2.7).<u></u><u></u></p>
<p class="MsoNormal"> I have run the setup.py for local installation as follows:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">wld006:/ilambv2.00/ $ /usr/local/sci/bin/python2.7 setup.py install –user<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> but when I check the installation I get:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">wld006:/ilambv2.00/ $ python -c "import ILAMB; print ILAMB.__version__"
<u></u><u></u></p>
<p class="MsoNormal">Traceback (most recent call last):<u></u><u></u></p>
<p class="MsoNormal"> File "<string>", line 1, in <module><u></u><u></u></p>
<p class="MsoNormal"> File "/home/ih0300/hadgw/.local/lib/python2.6/site-packages/ILAMB/__init__.py", line 24, in <module><u></u><u></u></p>
<p class="MsoNormal"> pkg = __import__(key, globals(), locals(), [froms[key]])<u></u><u></u></p>
<p class="MsoNormal">ImportError: No module named basemap<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have established that the module basemap is available within mpl_toolkits (within: /usr/local/sci/lib/python2.7/site-packages/ ), but the path in the error message indicates that the code is looking for basemap within the local installation
(i.e.: .local/lib/python2.6/site-packages/ ). As you flagged on the Installation webpage of ILAMBv2.0 the problem is that we have two installations of Python: i.e. Python2.6 (which doesn’t have mpl_toolkits) and Python2.7 (which does have mpl_toolkits
and basemap inside).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Do you think that the error returned during the installation check indicates that setup.py has not used the Python2.7 path that was specified? Or is there a mis-match between the path accessed in specifying “froms” within __init__.py and
the Python2.7 path (NB I inserted the path to Python2.7: #!/usr/local/sci/bin/python2.7 as the first line of __init__.py)?<u></u><u></u></p>
<p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"> Any pointers would be greatly appreciated, thanks, Graham.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt">Dr Graham Weedon<br>
Hydrology Dataset Scientist<br>
Met Office (JCHMR)<br>
Maclean Building Crowmarsh Gifford<br>
Wallingford Oxfordshire OX10 8BB UK<br>
Tel: +44 (0)1491 692578 Fax: +44 (0)1491 692338<br>
E-mail: <a href="mailto:graham.weedon@metoffice.gov.uk" target="_blank">graham.weedon@metoffice.gov.uk</a> Website:<a href="http://www.metoffice.gov.uk" target="_blank">www.metoffice.gov.uk</a><u></u><u></u></span></p>
<p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</blockquote></div></div>