[pyngl-talk] Help with PyNIO installation

Fan, Xingang xingang.fan at wku.edu
Thu Dec 15 22:18:41 MST 2016

Dear Kevin and Bill:

I really appreciate your patience with me and help. I am kind of new to the python packages and just don't know how to interpret the error messages.
The following was what I did, considering your suggestions:

Deleted the anaconda2 directory along with .conda .condrc
Reinstalled anaconda2: bash Downloads/Anaconda2-4.2.0-MacOSX-x86_64.sh
condo update condo
conda update -- all

With these, python and spyder (newest version) starts well.

conda config --add channels conda-forge        # This makes the installation to search packages first from conda-forge #
conda create -n test -c conda-forge pynio pyngl netcdf4 basemap spyder
source activate test
python Downloads/Basemaps_US_01.py

spyder (2.3.9) starts well, but running one of my code (tested okay in earlier installations) had problems with either matplotlib or basemap. So, I also run it from command line.
The problems are shown below. Right following it, is the attempt to import Nio directly from running python at command line:

(test) FXG-MacBook:~ xng02546$ python Downloads/Basemaps_US_01.py
Traceback (most recent call last):
  File "Downloads/Basemaps_US_01.py", line 1, in <module>
    from mpl_toolkits.basemap import Basemap
  File "/Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 28, in <module>
    from matplotlib.collections import LineCollection, PolyCollection
  File "/Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/matplotlib/collections.py", line 24, in <module>
    import matplotlib.transforms as transforms
  File "/Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/matplotlib/transforms.py", line 39, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: dlopen(/Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/matplotlib/_path.so, 2): Symbol not found: ___sincos_stret
  Referenced from: /Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/matplotlib/_path.so
  Expected in: /usr/lib/libSystem.B.dylib
 in /Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/matplotlib/_path.so

(test) FXG-MacBook:~ xng02546$ which python

(test) FXG-MacBook:~ xng02546$ python
Python 2.7.12 | packaged by conda-forge | (default, Sep  8 2016, 14:41:48)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Nio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/PyNIO/Nio.py", line 83, in <module>
    from nio import *
ImportError: dlopen(/Users/xng02546/anaconda2/envs/test/lib/python2.7/site-packages/PyNIO/nio.so, 2): Symbol not found: ___sincos_stret
  Referenced from: /Users/xng02546/anaconda2/envs/test/lib/libgdal.20.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in /Users/xng02546/anaconda2/envs/test/lib/libgdal.20.dylib
>>> import Ngl


P.s.  I had a successful installation before on this computer. It was messed up when I tried to update the pyngl and pynio from condo-forge. However, I forgot how I installed them the first time. I might have installed from downloading the .zip files from Github and then use pip. The only thing I didn't have was pygrib. This was the reason why I attempted to update my previous working system (all under root env), because on a Ubuntu virtual machine system, all three of pyngl pynio and pygrib were successfully installed and can be imported without problem. While keep trying an easy install, I will see if I can repeat my old installation.

I really need an easy procedure, so that the students would be able to follow on their own Mac system. For Windows machine, the virtual machine I created can be imported into their VirtualBox.

Thanks again for your help!

From: Kevin Hallock <hallock at ucar.edu<mailto:hallock at ucar.edu>>
Date: Thursday, December 15, 2016 1:14 PM
To: Xingang Fan <xingang.fan at wku.edu<mailto:xingang.fan at wku.edu>>
Cc: "pyngl-talk at ucar.edu<mailto:pyngl-talk at ucar.edu>" <pyngl-talk at ucar.edu<mailto:pyngl-talk at ucar.edu>>
Subject: Re: [pyngl-talk] Help with PyNIO installation

Hi Xingang,

(I) At Conda root, I ran:
    conda create -n metuse -c conda-forge pynio pyngl
    source activate met use

(II) From root, I created a new environment condaX by:
     Conda create –n condaX python=2.7 anaconda
     Source activate condaX
     Conda install netcdf4
     Conda install basemap
     Conda update --all

(III) Based on the working condoX environment, I tried to clone it, then wanted to install pyNGL etc.,
     The cloned environment has same results from conda list,
     Running python, it imports matplotlib and basemap okay,
     But, somehow, spyder won't start, it shows the following message:

Instead of creating these two separate environments and then trying to combine them, could you please try creating a single environment using the following command:
conda create -n pyn_testing -c conda-forge python=2.7 pynio pyngl netcdf4 basemap spyder
source activate pyn_testing

Even though both of the environments work before combining them, I would expect them to fail due to incompatible versions of packages. For example, in your “metuse” environment you should have libnetcdf from conda-forge installed as a dependency of pynio; in your “condaX” environment, you’ll have libnetcdf 4.4.1 from the default channel installed as a dependency of netcdf4. This is just one example of the incompatibilities that can happen when installing from multiple channels. Again, it is important to use “-c conda-forge” on any “conda create …”/“conda install …”/“conda update …” commands you may run for the environment you’re trying to create.

Also, I noticed that you chose to install the anaconda package when creating the condaX environment (in step II above). Installing the “anaconda” package is almost guaranteed to make your environment incompatible with most packages from the conda-forge channel (including pynio and pyngl), as described in the previous paragraph. Is there a particular package included in “anaconda” that you need? I would try to list specific packages instead of “anaconda”, and I would try to install them from the conda-forge channel (“-c conda-forge”) if possible.

I hope this helps!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161216/e5a2f0aa/attachment-0001.html 

More information about the pyngl-talk mailing list