paudetseis / RfPy

Teleseismic receiver function calculation and post-processing
https://paudetseis.github.io/RfPy/
MIT License
39 stars 28 forks source link

FileNotFoundError: [Errno 2] No such file or directory #30

Closed dip16gphy closed 2 years ago

dip16gphy commented 2 years ago

I am getting following error. How to resolve? Please help. I tried changing directory path too but didn,t work.

FileNotFoundError Traceback (most recent call last) Input In [2], in <cell line: 2>() 1 from rfpy import RFData ----> 2 rfdata = RFData('demo')

File ~\anaconda3\envs\rfpy\lib\site-packages\rfpy-0.1.1-py3.9.egg\rfpy\rfdata.py:182, in RFData.init(self, sta) 179 import os 180 import pickle 181 sta = pickle.load( --> 182 open(os.path.join( 183 os.path.dirname(file), 184 "examples/data", "MMPY.pkl"), 'rb'))['NY.MMPY'] 186 # Attributes from parameters 187 self.sta = sta

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\UPLC\anaconda3\envs\rfpy\lib\site-packages\rfpy-0.1.1-py3.9.egg\rfpy\examples/data\MMPY.pkl'

dip16gphy commented 2 years ago

Image 1

wasjabloch commented 2 years ago

The subfolder rfpy\examples is currently not moved to the destination (in your case C:\Users\UPLC\anaconda3\envs\rfpy\lib\site-packages\rfpy-0.1.1-py3.9.egg\rfpy) during installation.

@paudetseis This is a bug.

You can solve it by manually copying examples from the github repository (or your local cloned copy) to C:\Users\UPLC\anaconda3\envs\rfpy\lib\site-packages\rfpy-0.1.1-py3.9.egg

paudetseis commented 2 years ago

I just made a commit to the future branch to add the examples folder to the package data (updated setup.py file). I have not tested that it works.

In the future, we should move away from reading pickle files as example data, which are system and version specific. We should keep this issue open until the problem is fully resolved.

In the mean time, one can install the future branch and see whether that solves the problem.

paudetseis commented 2 years ago

So, one of the automated tests that used to fail are now passing, which means that this commit should in theory fix the problem, at least temporarily.

The demo data sets will be updated shortly and I encourage anyone to look at the tutorials instead of the API doc.

dip16gphy commented 2 years ago

The subfolder rfpy\examples is currently not moved to the destination (in your case C:\Users\UPLC\anaconda3\envs\rfpy\lib\site-packages\rfpy-0.1.1-py3.9.egg\rfpy) during installation.

@paudetseis This is a bug.

You can solve it by manually copying examples from the github repository (or your local cloned copy) to C:\Users\UPLC\anaconda3\envs\rfpy\lib\site-packages\rfpy-0.1.1-py3.9.egg

Thanks a lot! It worked.