Re: ImportError: No module named nio

From: Saulo Soares <saulo_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 01 2012 - 20:52:06 MDT

Hi,

I want to report some kind of bug I found when installing PyNIO on XUBUNTU
12.04.

I managed to build PyNIO using:
python setup.py build

Using the flags I mentioned on the previous email. (bellow) It basically
includes support for HDF4 and 5, OPENDAP, GRIB2 etc.

The build went well and I went to check the file format supports by going
to
:~/extra_software/PyNIO-1.4.1/build/lib.linux-x86_64-2.7/PyNIO$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Nio
>>> Nio.__formats__
{'hdfeos5': 0, 'netcdf4': 1, 'hdf4': 1, 'hdf5': 1, 'shapefile': 0, 'grib2':
1, 'hdfeos': 0, 'opendap': 1}
>>>

Looks good.

Then to finish the install process I went for the typical: (copy the stuff
sudo python setup.py install

To my surprise it completely messed up the previous build:

:~/extra_software/PyNIO-1.4.1/build/lib.linux-x86_64-2.7/PyNIO$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Nio
>>> Nio.__formats__
{'hdfeos5': 0, 'netcdf4': 0, 'hdf4': 0, 'hdf5': 0, 'shapefile': 0, 'grib2':
0, 'hdfeos': 0}
>>>

Any suggestions?

I can't seem to build using sudo even after putting all the environment
variables as python variables inside setup.py.

Saulo

On Fri, Sep 28, 2012 at 2:36 PM, Saulo Soares <saulo@hawaii.edu> wrote:

> 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 Tue Oct 2 04:52:17 2012

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