I’ve struck some problems and had to reinstall Python, and now I can’t find a working version combination of python, obspy and cartopy. It seems Python, Numpy and Cartopy have been updated and deprecated functions that Obspy needs.
So if you have a working setup could you please advise:
What version of Python are you using?
What version of Obspy are you using?
What version of Cartopy are you using?
I’ll give that a whirl. I know I was using python 3.9.12, but couldn’t recall the versions for Obspy and Cartopy. I had installed with Anaconda which looks after the compatibilities, but it developed problems, where it wouldn’t let me create new environments, or perform updates, etc. I installed another package for another citizen science project and it all crashed. So I’m going back to pip.
Yeah, after a bit, you either need to completely uninstall/delete everything Anaconda-related and perform a clean reinstall…
I usually have two environments, one for production (the main one) and one for development.
The two are basically copies of each other, but if I have to test some new module, I’ll just do it in dev first because I’ve been where you are now, and reinstalling 50+ Python modules in the correct versions was not fun…
But, every now and then, I have to clean up all my .yml env backup files… they tend to grow, exponentially!
I have created a new virtual environment with Python 3.9.12 and successfully installed Obspy 1.4.1, but Cartopy installation is crashing because there is no “convert_path” in
I had no problems related to Cartopy. The only issue was related to Obspy making depreciated calls to Numpy (2.1.2), Once I changed all instances of “np.float_” to “np.float64” (in files in “lib/python3.11/site-packages/obspy/taup”) everything worked as expected.
In fact, I could not find a convert_path element in setuptools/__init__.py (you can add underscores if you enclose the text in “``” -without the external quotation marks).
Maybe you can try dlfowler’s solution in a temporary new environment and see if it works with all your other Python modules.
For some reason I could not install a specified version of Cartopy with pip, so I did the install without specifying the version and then made the changes you suggested. I ended up with:
Python v3.9.12
Obspy v1.4.1
Cartopy v0.23.0
All working perfectly ATM.
The only other change I had to make to my code was change all references to
def divTrace(tr, n): # divide trace into n equal parts for background noise determination
return tr.__div__(n)
to
def divTrace(tr, n): # divide trace into n equal parts for background noise determination
return tr.__truediv__(n)
Thanks to both you and @Stormchaser for all your help!