[pyngl-talk] Installation of PyNIO

Root, Benjamin broot at aer.com
Thu Feb 26 07:41:54 MST 2015


Ooops, that was incomplete, there was another email noting how to get 
user-space installs:

In PyNIO 1.4.1, the setup.py has the following line:

pkgs_pth    = get_python_lib()

And that information is used later to define data_files for install:

data_files   = [(pkgs_pth, pynio_pth_file)],


When doing a user-install (the --user option), the above code will try
and place the Nio.pth file in the system site-packages location instead
of the user's site-packages location. This would be incorrect and will
likely fail due to permission issues.

My work-around is to replace get_python_lib() with '', as distutils will
install data files in the site-packages location if the path name is
relative:

https://docs.python.org/2/distutils/setupscript.html#installing-additional-files

I think the better solution would be to utilize namespace packages (but
that would require the non-standard setuptools package to be installed,
but that isn't all that painful anymore as it is pretty much a de facto
standard).

Cheers!
Ben Root


On Thu 26 Feb 2015 09:32:37 AM EST, Root, Benjamin wrote:
> Jonas,
>
> Here are my notes I have made on how to do a userspace install of
> PyNIO. By the way... the use of PYTHONPATH is *highly* discouraged! It
> causes more pain than it is worth. Ditch it!
>
> The following are my notes I sent to this list a little while back:
>
> I have finally just worked my way through a difficult build due to some
> custom system environments. I thought I might impart some of my
> knowledge that I gained to help others. I should note that this was a
> CentOS6 system, but that what ended up being difficult was not really
> dependent upon system versions.
>
> First and foremost, if you are on a Linux system, I would *highly*
> recommend yum-installing the "g2clib-devel" package (stands for "Grib 2
> C Library"). You can get it from the EPEL repository. It will provide
> grib2.h, and it has dependencies such as jasper and such, so you can
> really simplify much of the usual headaches when building PyNIO from
> source. It will not provide szip, and you won't find that package on
> EPEL, though.
>
> Second, while my "python setup.py install" would complete without
> errors, importing would fail with undefined symbol "do_lio". This is a
> g77 thing (specifically, libg2c.so.0). However, on our system, we have
> both gfortran and g77. It turns out that while numpy was built using
> gfortran (I think), the pynio setup.py was building using g77, and
> linking in libgfortran, oddly enough. It is using g77 just because it
> found it before gfortran.  To force it to build using gfortran, do the
> following (making sure you clean out your existing build first, of
> course):
>
> python setup.py build --fcompiler gfortran
> python setup.py install
>
> I hope this is helpful to others.
>
> Cheers!
> Ben Root
>
> On Wed 25 Feb 2015 07:35:48 PM EST, Jonas N Tamaoki wrote:
>>
>> Hi,
>> I'm trying to install PyNIO from source code, building only the
>> required (non-optional) external software.
>> - JPEG
>> - ZLIB
>> - HDF4
>> - NETCDF4 (no OpenDAP support)
>>
>> Besides, I installed ncl_ncarg-6.2.1 (precompiled binaries), and the
>> python module numpy.
>> under my private directory: /scratch/jonas/local/
>> problem 1:
>>    When try to install using the command line:
>>     python setup.py install --prefix=/scratch/jonas/local/
>>     the script aborts at installation phase, when it tryies to copy a
>> file Nio.pth to a system directory:
>>     /usr/lib64/python2.6/site-packages/ .
>>    So, to have the installation in my user area, I used the command line :
>>     python setup.py install --root=/scratch/jonas/local/
>>     The installation script ran to completion, apparently with no problem.
>>      Nio.pth is copied to
>> /scratch/jonas/local/usr/lib64/python2.6/site-packages
>>      and all other files to
>> /scratch/jonas/local/usr/local/lib64/python2.6/site-packages
>>     Does someone know why it tries to write a file in /usr/lib64...,
>> once I'm installing in a user area (with --prefix) ? Is it a bug ?
>>     Or is it a consequence of some mistake of mine ?
>> problem 2:
>>      once updating PYTHONPATH to the new installation path.
>>      when I run the command:
>>      python -c 'import nio'
>>      returns the message:
>>        ImportError:
>> /scratch/jonas/local/usr/local/lib64/python2.6/site-packages/PyNIO/nio.so:
>> undefined symbol: SWreadfield
>>       However, SWreadfield is a symbol defined in HDF-EOS library. As
>> HAS_HDFEOS was not defined, I expected it would not be referenced.
>>       Checking the file nio.so with command nm, I found many symbols
>> defined in other optional (not built) libraries ( HDFEOS, HDFEOS5,
>> GRIB2, etc ).
>>       Shall I redefine all undefined symbols with dummy value ?
>>       Or, is this problem related to some mistake in installation ?
>>      Thanks,
>>      Jonas
>
> ________________________________
>
> This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.
>
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>



More information about the pyngl-talk mailing list