Re: ImportError: No module named nio

From: Saulo Soares <saulo_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 28 2012 - 18:36:43 MDT

Hi Dave,

Thanks, I can fix it now.

Yes the path to Nio.pth is there:
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

$ ll /usr/lib/python2.7/dist-packages/Nio.pth
-rw-rw-r-- 1 root root 6 Jul 22 2011
/usr/lib/python2.7/dist-packages/Nio.pth

The file correctly contains:
PyNIO

But note that the Nio.pth went to the wrong place:
By default, PyNIO installed at:
/usr/local/lib/python2.7/dist-packages/PyNIO (which is also on the path
above)

However, Nio.pth was sent to /usr/lib/python2.7/dist-packages/ (not the
local)
Moving it to the /usr/local/... should take care.

Aloha

Saulo

On Fri, Sep 28, 2012 at 2:03 PM, David Brown <dbrown@ucar.edu> wrote:

> Hi Saulo,
> Mary has the following suggestion:
> It could be a path issue. Run python interactively and then type:
>
> import sys
> sys.path
>
> to make sure that the directory containing Nio.pth is on your path. Also,
> Nio.pth needs to have just one line in it:
>
> PyNIO
>
> Hopefully you can find Nio.pth.
> -dave
>
>
> On Sep 27, 2012, at 6:08 PM, Saulo Soares wrote:
>
> > Hi,
> >
> > I did a source install of PyNIO on my:
> > Linux itamambuca 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC
> 2012 x86_64 x86_64 x86_64 GNU/Linux
> >
> > I used the following C flags:
> > declare -x GRIB2_PREFIX="/usr/local"
> > declare -x HAS_GDAL="0"
> > declare -x HAS_GRIB2="1"
> > declare -x HAS_HDF4="1"
> > declare -x HAS_HDF5="1"
> > declare -x HAS_HDFEOS="0"
> > declare -x HAS_HDFEOS5="0"
> > declare -x HAS_NETCDF4="1"
> > declare -x HAS_SZIP="0"
> > declare -x HDF4_PREFIX="/usr/local/hdf4-to-ncl"
> > declare -x HDF5_PREFIX="/usr/local/hdf5"
> > declare -x NETCDF4_PREFIX="/usr/local/netcdf-4.2.1.1"
> > declare -x NETCDF_PREFIX="/usr/local/netcdf-4.2.1.1"
> >
> > I also have the NCL and NCARG set up.
> >
> > Note I did disable szip because I compiled by hdf5 and netcdf without
> it. I manage to compile ncl from source nonetheless.
> >
> > So, quick first question: I've never dealt with a netcdf file using szip
> before but should I expect problems, are they going to become standard?
> > Netcdf 4 had them (and hdf5 as well) as an optional add on.
> >
> > Now back to PyNIO:
> > After setting those flags, I did:
> > python setup.py build (I cannot build as sudo, no environment variables)
> > then
> > sudo python setup.py install
> >
> > It seemed to have installed fine:
> > $ ll /usr/local/lib/python2.7/dist-packages/PyNIO
> > total 5460
> > drwxr-sr-x 3 root staff 4096 Sep 27 12:50 ./
> > drwxrwsr-x 4 root staff 4096 Sep 27 12:50 ../
> > -rw-rw-r-- 1 root staff 10963 Jul 22 2011 alt-setup.py
> > -rw-r--r-- 1 root staff 6692 Sep 27 12:50 alt-setup.pyc
> > -rw-rw-r-- 1 root staff 47068 Jul 22 2011 coordsel.py
> > -rw-r--r-- 1 root staff 35128 Sep 27 12:50 coordsel.pyc
> > -rw-rw-r-- 1 root staff 2 Jul 22 2011 __init__.py
> > -rw-r--r-- 1 root staff 143 Sep 27 12:50 __init__.pyc
> > drwxr-sr-x 3 root staff 4096 Sep 27 12:50 ncarg/
> > -rw-rw-r-- 1 root staff 26028 Jul 22 2011 Nio.py
> > -rw-r--r-- 1 root staff 21227 Sep 27 12:50 Nio.pyc
> > -rwxrwxr-x 1 root staff 5374488 Sep 27 12:47 nio.so*
> > -rw-r--r-- 1 root staff 264 Sep 27 12:50 pynio_version.py
> > -rw-r--r-- 1 root staff 477 Sep 27 12:50 pynio_version.pyc
> > -rw-rw-r-- 1 root staff 11843 Jul 22 2011 _xarray.py
> > -rw-r--r-- 1 root staff 10246 Sep 27 12:50 _xarray.pyc
> >
> > But when I go import the Nio inside python I get:
> > >>> import Nio
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > File "Nio.py", line 63, in <module>
> > from nio import *
> > ImportError: No module named nio
> >
> > I'd say its a matter of setting a pythonpath environment variable, but I
> did similar installs on the dist-packgages (the default actually) and I can
> always import them. I know I can do:
> > >>> import PyNIO
> > >>> PyNIO
> > <module 'PyNIO' from
> '/usr/local/lib/python2.7/dist-packages/PyNIO/__init__.pyc'>
> >
> > But I don't think that is right.
> > Help?
> >
> > Aloha,
> >
> > Saulo
> >
> >
> > _______________________________________________
> > pyngl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
>

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Sat Sep 29 02:36:53 2012

This archive was generated by hypermail 2.1.8 : Tue Oct 02 2012 - 14:59:57 MDT