usgs / groundmotion-processing

Parsing and processing ground motion data
Other
54 stars 42 forks source link

ModuleNotFoundError: No module named 'gmprocess.io.' #987

Closed bartikpandel closed 2 years ago

bartikpandel commented 2 years ago

Hi, I followed the steps mentioned in the manual to install gmprocess today on my ubuntu 20.04. I have tried creating a virtual environment both with conda and with pip but this issue doesn't seem to get fixed.

I am not sure why this problem persists. The gmrecords command works in the virtual environment but as soon as I try the gmrecords download command, I get this error. Could you help me figure out how I can fix this?

image

emthompson-usgs commented 2 years ago

Thanks for the report. We did recently make some major changes to how gmprocess is installed and setup so I suspect this is related to that. It is unclear to me why this didn't show up in our testing. It might take me a little time to figures this out.

bartikpandel commented 2 years ago

Thanks Eric. Is there anything I could do at this point? I just need to download some motions. Is there any way to use the old method?

gferragu commented 2 years ago

Have you tried running the unit tests with py.test . ? It sounds like it may be an issue specific to your environment since the Asure tests are passing. The output from the unit tests on your machine might make things clearer, worth a shot anyway.

gferragu commented 2 years ago

@AfterTruth, if you need a working old version quickly you could actually just make a fresh clone of my main branch in my groundmotion-processing fork, I don't think I've pulled from the USGS one since we implemented the new installation

here it is

bartikpandel commented 2 years ago

This is perfect, Gabriel. Thank you so much. I will also keep you all posted on the tests. Let me run them and I'll post the output here.

emthompson-usgs commented 2 years ago

The error you are getting is a mystery to me because we run the install process and the unit tests nightly on a linux system and it hasn't been failing (see here).

You could try to install from the pre-built package on pypi with:

pip install gmprocess[test]

Then run the unit tests to see if you get the same import errors. We didn't put this in the documentation yet since it hasn't been extensively tested.

Also, you can always revert to prior versions of github code by checking the git log. This is probably about the commit you would want to revert to:

commit f626f4b63f5226699e420b59920f3ad38eb58874
Merge: 50e76c08 4728e23c
Author: Eric Thompson <emthompson@usgs.gov>
Date:   Wed Jul 27 11:07:14 2022 -0600

    Merge pull request #971 from emthompson-usgs/fetcher

    Fetcher bugfix

And you would do this with the following command in the root of the repository:

git checkout f626f4b63f5226699e420b59920f3ad38eb58874 .

This way @gferragu can update his fork, which he'll need to do to continue with the normal development workflow.

The only way for me to be able to fix this is to reproduce the error on our local linux systems but I just haven't had time to get to that yet.

ghost commented 2 years ago

I'm going to chime in here just to say I was able to reproduce this problem on my laptop. All the unit tests pass and I can use gmprocess in my scripts, but the gmrecords download command failed to import the module with the same error as @AfterTruth

emthompson-usgs commented 2 years ago

Thanks @smithj382. Maybe this isn't an installation problem then. Now I'm thinking that it has to do with my change to remove the use of pkg_resources, which I think that part of the code was using to detect fetchers and it is looking one directory too high. I can't debug today because I'm in an all day meeting. Can you edit this line: https://github.com/usgs/groundmotion-processing/blob/main/src/gmprocess/io/global_fetcher.py#L140 To remove the ".." at the end and see if it fixes the error?

ghost commented 2 years ago

@emthompson-usgs Thanks, removing the .. from https://github.com/usgs/groundmotion-processing/blob/main/src/gmprocess/io/global_fetcher.py#L140 fixed this issue for me.

emthompson-usgs commented 2 years ago

Okay, great. Can you send in a PR with this fix?

emthompson-usgs commented 2 years ago

Thanks @smithj382. I just merged the fix. @AfterTruth Can you update and confirm that this change resolves your issue?

bartikpandel commented 2 years ago

Thank you @emthompson-usgs @gferragu @smithj382. This fixed the issue on my system too.