NCAR / pynio

PyNIO is a multi-format data I/O package with a NetCDF-style interface
http://www.pyngl.ucar.edu/Nio.shtml
Apache License 2.0
112 stars 37 forks source link

Nio.pth not installed with absolute pkgs_pth #20

Open wmay opened 6 years ago

wmay commented 6 years ago

I've been working on installing PyNIO from source on Ubuntu 18.04. I'm able to install the package, with the exception of the Nio.pth file. The result is that, when I try to import the package, I get

ImportError: No module named Nio

After some experimentation I found that distutils doesn't respect absolute file paths for data_files in the setup function. I was able to fix this by replacing the absolute path with a relative path:

setup (version      = pynio_version,
       description  = 'Multi-format data I/O package',
       author       = 'David I. Brown',
       author_email = 'dbrown@ucar.edu',
       url          = 'http://www.pyngl.ucar.edu/Nio.shtml',
       long_description = '''
       Enables NetCDF-like access for NetCDF (rw), HDF (rw), HDF-EOS2 (r), HDF-EOS5, GRIB (r), and CCM (r) data files
       ''',
       package_data = { pynio_pkg_name : data_files },
       data_files   = [('.', pynio_pth_file)],
       **configuration().todict())

I tested this out on Ubuntu 18.04 with both python 2 and 3, and both pip and python setup.py install. In each case, only the relative path copied Nio.pth to the correct location.