Install 8/7/2020 Wesley Ebisuzaki Preliminaries: 1. Python 3.7+ has to be installed 2. numpy has to be installed 3. find a directory on your python path to store pywgrib2_s.py and libwgrib2.so call this directory PYTHON_DIR Step 2: make wgrib2 shared library using wgrib2 from https://github.com/NOAA-EMC/wgrib2 Step 2: Copy pywgrib2_s.py to PYTHON_DIR. Testing: Try running python 3.x and importing pywgrib2_s A Good Result: ebis@landing2:~$ python3.8 Python 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pywgrib2_s finished loading libraries pywgrib2_s v0.0.7 7-30-2020 w. ebisuzaki >>> A Bad Result: -sh-4.1$ python3.5 Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 2 2016, 17:53:06) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pywgrib2_s *** Problem libquadmath.so.0: cannot open shared object file: No such file or directory *** Will load wgrib2 library in RTLD_LAZY mode Traceback (most recent call last): File "/export/cpc-lw-webisuzak/wd51we/.local/lib/python3.5/site-packages/pywgrib2_s.py", line 29, in my_wgrib2=CDLL(lib) File "/cpc/prod/cpcwebapps/software/anaconda/lib/python3.5/ctypes/__init__.py", line 347, in __init__ self._handle = _dlopen(self._name, mode) OSError: libquadmath.so.0: cannot open shared object file: No such file or directory During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/export/cpc-lw-webisuzak/wd51we/.local/lib/python3.5/site-packages/pywgrib2_s.py", line 33, in my_wgrib2=CDLL(lib, mode=os.RTLD_LAZY) File "/cpc/prod/cpcwebapps/software/anaconda/lib/python3.5/ctypes/__init__.py", line 347, in __init__ self._handle = _dlopen(self._name, mode) OSError: libquadmath.so.0: cannot open shared object file: No such file or directory >>> This is a problem with Anaconda because uses its own shared libraries in preference over the system shared libraries. The system shared libraries do not use libquadmath.so, so that library is not installed. However, the Anaconda's shared libraries are different from the system libraries and they refer to libquadmath.so, and do not include a copy of libquadmath.so. This is a mistake by Anaconda for not incuding libquadmath.so. It is also a poor decision by Anaconda for using their copy of the shared library over the system library of the same name. It is also a mistake by Anaconda for changing the search path for libraries from the python documentation. To work around Anaconda's feature, you have to edit pywgrib2_s.py and add a CDLL the gfortran library using a full path name. The names and locations will depend on your system. --------------- Ubuntu --------------------- My python3 is v3.10 mkdir -p ~/.local/lib/python3.10/site-packages cd ~/.local/lib/python3.10/site-packages cp (...)/pywgrib2_s.py . cp (...)/libwgrib2.so . On my system, import pywgrib2_s will read pywgrib2_s.py from this directory. BTW numpy needs to be installed.