DOI-USGS / ghsc-esi-shakemap

ShakeMap
Other
17 stars 7 forks source link

sm_create , py.test . error #5

Open blong198 opened 1 year ago

blong198 commented 1 year ago

Hi, I tried to install shakemap today. By the way I'm using Ubuntu 22.04.2

When I try to run "sm_create 73821036", I get this error:

/home/cismid/miniconda/envs/shakemap/lib/python3.9/site-packages/pydantic/_internal/_config.py:261: 
UserWarning: Valid config keys have changed in V2:
* 'json_encoders' has been removed
  warnings.warn(message, UserWarning)
Traceback (most recent call last):
  File "/home/cismid/miniconda/envs/shakemap/bin/sm_create", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/cismid/shakemap_src/bin/sm_create", line 25, in <module>
    from shakelib.station import StationList
  File "/home/cismid/shakemap_src/shakelib/station.py", line 12, in <module>
    from gmpacket.packet import GroundMotionPacket
  File "/home/cismid/miniconda/envs/shakemap/lib/python3.9/site-packages/gmpacket/packet.py", line 15, in <module>
    from gmpacket.feature import Feature
  File "/home/cismid/miniconda/envs/shakemap/lib/python3.9/site-packages/gmpacket/feature.py", line 193, in <module>
    class FeatureGeometry(BaseModel):
  File "/home/cismid/miniconda/envs/shakemap/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", 
line 95, in __new__
    private_attributes = inspect_namespace(
  File "/home/cismid/miniconda/envs/shakemap/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", 
line 328, in inspect_namespace
    raise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `type = 'Point'`. All model fields 
require a type annotation; if `type` is not meant to be a field, you may be able to resolve this error by 
annotating it as a `ClassVar` or updating `model_config['ignored_types']`.

Also, when I run "py.test ." I get this:

platform linux -- Python 3.9.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/cismid/shakemap_src, configfile: pytest.ini
plugins: cov-4.0.0, nunit-1.0.3, azurepipelines-1.0.4
collected 84 items / 8 errors                                                  
##vso[results.publish type=NUnit;runTitle='Pytest results';publishRunAttachments=true;]/home/cismid/
shakemap_src/test-output.xml
##vso[task.logissue type=error;]8 test(s) failed, 84 test(s) collected.
##vso[task.logissue type=warning;]Coverage XML was not created, skipping upload.

and at the end of the error messages say the same as the "sm_create" error:

E   pydantic.errors.PydanticUserError: A non-annotated attribute was detected: 
`type = 'Point'`. All model fields require a type annotation; if `type` is not meant to be a field, 
you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']

Thanks in advance

bkl842007 commented 1 year ago

I have the exact same problem whenever i tried to create shakemap event. Does anybody know how to fix this issues?