mspass-team / mspass

Massive Parallel Analysis System for Seismologists
https://mspass.org
BSD 3-Clause "New" or "Revised" License
28 stars 11 forks source link

possible issue with new conda package #529

Open pavlis opened 2 months ago

pavlis commented 2 months ago

I think we may have a minor issue with the new conda package. I don't think it include pymongo and it probably should. The reason is that our Database class and others references bson and pymongo frequently. I got import errors trying to use it with a script using Database anyway. I had an old version of pymongo installed that I thought was causing a problem, but I did

pip uninstall pymongo

and then used conda to install pymongo in the same environment I had installed the mpsass package. It ran fine, BUT still get this error when try to use an instance of Database running it locally:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[2], line 1
----> 1 from bson.codec_options import CodecOptions, TypeRegistry, DatetimeConversion

ImportError: cannot import name 'DatetimeConversion' from 'bson.codec_options' (/home/pavlis/anaconda3/envs/mspass_py310/lib/python3.10/site-packages/bson/codec_options.py)

We need to fix this asap if we are going to use the package for upcoming workshops.

pavlis commented 2 months ago

I thought about making this a separate issues page, but the problem is closely related to the topic here. The conda package also lacks a package obspy uses to make some graphics called Cartopy. That package is used by the "plot" methods of Catalog and Inventory and maybe other things in obspy. Easy to see how it would be missed as is a secondary package for obspy for specialized map plots.

wangyinz commented 2 months ago

Since this is a dependency of ObsPy, it is probably their decision to not include the package as a normal dependency. I wonder we need to add it if we are not directly depending on it. I am actually fine either way, but @Aristoeu you may want to make the decision as you are working on this item.

Aristoeu commented 1 month ago

I added Cartopy package in #515 I tried installing mspasspy in a new environment, it seems have included Pymongo, codec, and DatetimeConversion as I can import them successfully