AntSimi / py-eddy-tracker

Eddy identification and tracking
https://py-eddy-tracker.readthedocs.io/en/latest/
GNU General Public License v3.0
120 stars 48 forks source link

py_eddy_tracker.dataset.grid issue #218

Open emma97956461 opened 9 months ago

emma97956461 commented 9 months ago
1 import py_eddy_tracker.dataset.grid > > File ~/anaconda3/envs/env_test/lib/python3.9/site-packages/py_eddy_tracker/dataset/grid.py:10 > 8 from cv2 import filter2D > 9 from matplotlib.path import Path as BasePath > ---> 10 from netCDF4 import Dataset > 11 from numba import njit, prange, types as numba_types > 12 from numpy import ( > 13 arange, > 14 array, > (...) > 42 zeros, > 43 ) > > File ~/anaconda3/envs/env_test/lib/python3.9/site-packages/netCDF4/__init__.py:3 > 1 # init for netCDF4. package > 2 # Docstring comes from extension module _netCDF4. > ----> 3 from ._netCDF4 import * > 4 # Need explicit imports for names beginning with underscores > 5 from ._netCDF4 import __doc__ > > ImportError: dlopen(/Users/emma/anaconda3/envs/env_test/lib/python3.9/site-packages/netCDF4/_netCDF4.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_H5get_libversion'** Hi, I'm trying to use the pyeddytracker package but I have been encountering multiple issues when downloading: I'm working on a virtual environment with Python 3.9.6 (I tried with 3.8.18 as well), and when I attempt to import py_eddy_tracker.dataset.grid I encounter the error above. I see that the issue is with netCDF4, so I have tried both versions 1.5.8 and 1.6.0 but nothing changes; I have also encountered a number of errors related to numpy, but for now this seems to be the sole problem. Thank you for any help you can give, Emma -->
AntSimi commented 8 months ago

Did you get same error when you do an import netCDF4? How did you install py eddy tracker?

emma97956461 commented 8 months ago

No I didn't get any error when importing netcdf4, I tried installing pyeddytracker in multiple ways: on my local machine, both from terminal with pip and homebrew, and directly from jupyterlab. I also work on remote machines and tried there, in the same ways. I always encountered some kind of issue when importing the dataset.grid, which is either related to numpy or netcdf4. Today I thought the problem was solved, but after restarting my kernel I find that I can't even import py_eddy_tracker anymore, because of numpy; I get the error: AttributeError: module 'numpy' has no attribute 'ndarray' Thank you for the help

marimpacheco commented 7 months ago

I am having an issue with py_eddy_tracker.dataset.grid as well.

I had to recreate the py-eddy-tracker environment after a system upgrade in the remote machine. I created the environment from the environment.yml file:

conda env create --file environment.yml
conda activate binder-pyeddytracker
python setup.py install

The error that comes for me:

ImportError                               Traceback (most recent call last)
Cell In[2], line 23
     21 from py_eddy_tracker.gui import GUI
     22 from py_eddy_tracker.tracking import Correspondances
---> 23 from py_eddy_tracker.dataset.grid import UnRegularGridDataset
     24 from py_eddy_tracker.eddy_feature import Contours

File ~/miniconda3/envs/binder-pyeddytracker/lib/python3.10/site-packages/py_eddy_tracker/dataset/grid.py:8
      5 from datetime import datetime
      6 import logging
----> 8 from cv2 import filter2D
      9 from matplotlib.path import Path as BasePath
     10 from netCDF4 import Dataset

File ~/miniconda3/envs/binder-pyeddytracker/lib/python3.10/site-packages/cv2/__init__.py:181
    176             if DEBUG: print("Extra Python code for", submodule, "is loaded")
    178     if DEBUG: print('OpenCV loader: DONE')
--> 181 bootstrap()

File ~/miniconda3/envs/binder-pyeddytracker/lib/python3.10/site-packages/cv2/__init__.py:153, in bootstrap()
    149 if DEBUG: print("Relink everything from native cv2 module to cv2 package")
    151 py_module = sys.modules.pop("cv2")
--> 153 native_module = importlib.import_module("cv2")
    155 sys.modules["cv2"] = py_module
    156 setattr(py_module, "_native", native_module)

File ~/miniconda3/envs/binder-pyeddytracker/lib/python3.10/importlib/__init__.py:126, in import_module(name, package)
    124             break
    125         level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)

ImportError: libGL.so.1: cannot open shared object file: No such file or directory 
AntSimi commented 7 months ago

Did you have same error if you only do (env creation must install also py eddy tracker package):

conda env create --file environment.yml
conda activate binder-pyeddytracker
marimpacheco commented 7 months ago

Yes

AntSimi commented 4 months ago

I don't know how to solve cv2 install problem, i am not able to reproduce this pb on several platform