[ilamb-users] Problem installing ILAMBv2.0

Weedon, Graham graham.weedon at metoffice.gov.uk
Wed Jul 20 08:58:42 EDT 2016


Dear Nate,
          Thanks for your speedy and supportive reply. All commands referred to below have been run within my ilambv2.0 directory:

a)      yes I used /usr/local/sci/bin/python2.7 for running setup.py with the hope that the matplotlib toolkit would be found (since as you know Python2.6, also held on our system, lacks MPL). So regarding the python version if I just use your command I get:


wld006:/ilambv2.00/ $ python --version
Python 2.6.6


b)      matplotlib is sitting within the /usr/local/sci directory under Python2.7:


wld006:/ilambv2.00/ $ /usr/local/sci/bin/python2.7 -c "import matplotlib; print matplotlib.__path__"
['/usr/local/sci/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib']


c)      I ran your command: export PYTHONPATH=/usr/local/sci/lib/python2.7:$PATH and then tried setup.py again and the specified Python2.7 to check the installation (I’ve put a space between successive commands):

wld006:/ilambv2.00/ $ export PYTHONPATH=/usr/local/sci/python2.7:$PATH

wld006:/ilambv2.00/ $ /usr/local/sci/bin/python2.7 setup.py install --user
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_py
running install_lib
writing byte-compilation script '/var/tmp/tmpYzm5qF.py'
/usr/local/sci/bin/python2.7 -O /var/tmp/tmpYzm5qF.py
removing /var/tmp/tmpYzm5qF.py
running install_egg_info
Removing /home/ih0300/hadgw/.local/lib/python2.7/site-packages/ILAMB-0.1-py2.7.egg-info
Writing /home/ih0300/hadgw/.local/lib/python2.7/site-packages/ILAMB-0.1-py2.7.egg-info
running install_clib
customize UnixCCompiler

wld006:/ilambv2.00/ $ /usr/local/sci/bin/python2.7 -c "import ILAMB; print ILAMB.__version__"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ih0300/hadgw/.local/lib/python2.7/site-packages/ILAMB/__init__.py", line 36, in <module>
    (key,__version__,key,requires[key],pkg.__version__))
ImportError: Bad mpl_toolkits.basemap version: ILAMB 0.1 requires mpl_toolkits.basemap >= 1.0.7 got 1.0.5


    So I now get a different error “Bad mpl_toolkits.basemap version...” instead of  “No module named basemap”. For information here is my original installation check error where I just invoked python (instead of python2.7):

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

 Given the new installation error can I conclude that my original problem was that I was not invoking Python2.7? It doesn’t look like I can use Conda or Pip on our system (not recognised commands when I tried them), so do I have to resolve the “Bad mpl_toolkits.basemap version...” by getting the system controllers to update basemap to 1.0.7 – or is there a way round this?

        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

From: Nathan Collier [mailto:nathaniel.collier at gmail.com]
Sent: 19 July 2016 16:31
To: Weedon, Graham; ilamb-users at ilamb.org
Subject: Re: Problem installing ILAMBv2.0

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<mailto: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<mailto:graham.weedon at metoffice.gov.uk>  Website:www.metoffice.gov.uk<http://www.metoffice.gov.uk>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.ilamb.org/pipermail/ilamb-users/attachments/20160720/04f23691/attachment-0001.html 


More information about the ilamb-users mailing list