hydrogeoscience / pygtide

A Python module and wrapper for ETERNA PREDICT to compute gravitational tides on Earth
Mozilla Public License 2.0
53 stars 19 forks source link

ModuleNotFoundError: No module named 'pygtide.etpred' #25

Closed GPeng00 closed 2 years ago

GPeng00 commented 2 years ago

Hi Gabriel. After installation by 'pip install pygtide' in Ubuntu 20.04. I tested pygtide then prompted error message.

Traceback (most recent call last): File "", line 1, in File "/mnt/j/Vols/pygtide/pygtide/init.py", line 5, in from pygtide.update_etpred_data import update File "/mnt/j/Vols/pygtide/pygtide/update_etpred_data.py", line 7, in import pygtide.etpred as etpred ModuleNotFoundError: No module named 'pygtide.etpred'

trichter commented 2 years ago

Hi @GPeng00, any errors when installing? Maybe a Fortran compiler is missing? In conda you can install it with conda install fortran-compiler.

GPeng00 commented 2 years ago

Hi @trichter. It should not be an installation problem, because there is no any problem installing and using last version of pygtide.

trichter commented 2 years ago

For me the installation is working on ubuntu. etpred hosts the compiled Fortran code. I'd guess that something went wrong with the compilation.

GPeng00 commented 2 years ago

i reinstalled the pygtide. The steps are as follows, conda create -n pygtide python=3.7 conda install numpy pandas requests git conda install fortran-compiler pip install pygtide

This process did not prompt any error messages. When testing 'import pygtide', the error messages are as follows, Traceback (most recent call last): File "", line 1, in File "/mnt/f/pygtide0.7/pygtide/init.py", line 1, in from pygtide.core import pygtide File "/mnt/f/pygtide0.7/pygtide/core.py", line 93, in import pygtide.etpred as etpred ModuleNotFoundError: No module named 'pygtide.etpred'

I think that it maybe absence of etpred module. In current version,the content of pygtide contains folder commdat and files init.py, core.py, tests.py and update_etpred_data.py. In core.py, require 'import pygtide.etpred as etpred', but etpred is disappearance.

trichter commented 2 years ago

Interesting. This is working for me:

conda create -n test2pygtide python=3.7 numpy pandas fortran-compiler
conda activate test2pygtide
pip install pygtide
python -c 'import pygtide; pygtide.test()'

etpred is the compiled Fortran module created during the installation process. Did you activate the environment? Are you in the folder with the downloaded source code when trying to import? If yes, please change to another folder.

GPeng00 commented 2 years ago

Indeed,it is working in the pygtide folder. Thank you for your help.

GPeng00 commented 2 years ago

It is inconvenient, working content is required in pygtide folder. A better approach is that we can call pygtide in any content.

trichter commented 2 years ago

In this case you can use an editable installation: Download the source. After that call pip install -e .