[ilamb-users] Problem installing ILAMBv2.0

Nathan Collier nathaniel.collier at gmail.com
Tue Jul 19 11:31:14 EDT 2016


Graham,

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.

Let's diagnose a few things:

* 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:

python --version

* 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.

python -c "import matplotlib; print matplotlib.__path__"

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.

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):

export PYTHONPATH=/usr/local/sci/lib/python2.7:$PATH

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.

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.

Nate



On Tue, Jul 19, 2016 at 10:01 AM Weedon, Graham <
graham.weedon at metoffice.gov.uk> wrote:

> Dear Nathan,
>
>           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).
>
>           I have run the setup.py for local installation as follows:
>
>
>
> wld006:/ilambv2.00/ $ /usr/local/sci/bin/python2.7 setup.py install –user
>
>
>
>        but when I check the installation I get:
>
>
>
> wld006:/ilambv2.00/ $ python -c "import ILAMB; print ILAMB.__version__"
>
> Traceback (most recent call last):
>
>   File "<string>", line 1, in <module>
>
>   File
> "/home/ih0300/hadgw/.local/lib/python2.6/site-packages/ILAMB/__init__.py",
> line 24, in <module>
>
>     pkg = __import__(key, globals(), locals(), [froms[key]])
>
> ImportError: No module named basemap
>
>
>
> 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).
>
>
>
> 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)?
>
>   Any pointers would be greatly appreciated, thanks, Graham.
>
>
>
>
>
> Dr Graham Weedon
> Hydrology Dataset Scientist
> Met Office (JCHMR)
> Maclean Building  Crowmarsh Gifford
> Wallingford  Oxfordshire  OX10 8BB  UK
> Tel: +44 (0)1491 692578  Fax: +44 (0)1491 692338
> E-mail: graham.weedon at metoffice.gov.uk  Website:www.metoffice.gov.uk
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.ilamb.org/pipermail/ilamb-users/attachments/20160719/0627157a/attachment.html 


More information about the ilamb-users mailing list