-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing yf fails if ~/.cache directory doesn't exist #1700
Comments
Can you submit a fix? #1084. I only ask because you might discover other bugs specific to your situation. |
I'll try to submit a fix when I get some time, but it might be a little while |
@blackary if toggling caching when appropriate is a fair solution for you guys, then I can take over for reference, what I am suggesting is to check whether we are allowed to write in the root directory of the current file system, if that's the case then we can instantiate the database, else, we don't and we prevent further calls and references to _KVSTORE |
@rickturner2001 That sounds like a great solution to me! |
if you want to use yfinance on GCP Cloud Functions, here's solution for above problem:
|
I've just tried your suggestion but now I'm getting the error locally using firebase emulator: |
Probably due to fact you're on Windows. |
...Yup lol. Did the whole thing in WSL Ubuntu, worked like a charm. Cheers! In hindsight I should've realised right away given the error had a mix of forward and backward slashes lol. |
Was having this problem too, though my application is only using Adding
At the top of my program fixed it, it now works on AWS Lambda again. |
Can people try branch #1705? I can release a beta via PIP if helps. |
Hi. I have the same issue on AWS Lambda, but your solution did not work for me. Is there anything else you are also doing to make this work? Without using appdirs I get this: [ERROR] FileNotFoundError: [Errno 2] No such file or directory: '/home/sbx_user1051/.cache/py-yfinance' Using appdirs I get this: Response My full Lambda:import pandas as pd def lambda_handler(event, context): |
The implementation in the |
I've released a beta to fix issue - should be fine but means I can rush out a release. Install with: |
I think this can be closed, re-tested (Ubuntu 22 + conda) and the issue is solved on "yfinance==0.2.31" |
Describe bug
Even though yf has a .set_tz_cache_location, simply importing yfinance fail if
~/.cache
directory doesn't existSimply importing yf should not have side-effects like creating a database, and especially should not fail before there is a chance to overwrite the cache directory.
This is particularly problematic when it's not possible to create the .cache directory as the app is being deployed to a 3rd-party system.
Simple code that reproduces your problem
Debug log
Bad data proof
No response
yfinance
version0.2.30
Python version
3.10.3
Operating system
OSX
The text was updated successfully, but these errors were encountered: