You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the Google Cloud Function with the latest version of Python and yfinance, the error SQLite driver not installed! occurred. This issue arose because the yfinance library attempts to use SQLite for caching, but the required SQLite driver is not available in the Cloud Function environment. As a result, the function failed to retrieve data properly (response: 'SQLite driver not installed!'). However, when using an older version like yfinance==0.1.63, it works, but returns zero results. If you run the same code locally with the latest version of both Python and yfinance, it works normally without any issues.
Simple code that reproduces your problem
from flask import jsonify, abort, request
import yfinance as yf
def main(request):
request_json = request.get_json(silent=True)
symbol = request_json.get("symbol") if request_json else None
if not symbol:
abort(400, "Symbol is required")
try:
company = yf.Ticker(symbol)
stock_info = {
'market_cap': company.info.get('marketCap', None),
'avg_volume': company.info.get('averageVolume', None),
'dividend_yield': company.info.get('dividendYield', None),
'forward_pe': company.info.get('forwardPE', None),
'beta': company.info.get('beta', None),
'profit_margins': company.info.get('profitMargins', None),
'return_on_assets': company.info.get('returnOnAssets', None),
'return_on_equity': company.info.get('returnOnEquity', None),
}
return jsonify(stock_info)
except Exception as e:
return jsonify({"error": str(e)}), 500
thanks @ValueRaider . Understood, thank you for the explanation. Is there anything I can contribute to help address this point? For example, would additional testing in environments where SQLite is unavailable be useful, or is there another way I could support this implementation?
Describe bug
When running the Google Cloud Function with the latest version of Python and yfinance, the error SQLite driver not installed! occurred. This issue arose because the yfinance library attempts to use SQLite for caching, but the required SQLite driver is not available in the Cloud Function environment. As a result, the function failed to retrieve data properly (response: 'SQLite driver not installed!'). However, when using an older version like yfinance==0.1.63, it works, but returns zero results. If you run the same code locally with the latest version of both Python and yfinance, it works normally without any issues.
Simple code that reproduces your problem
from flask import jsonify, abort, request
import yfinance as yf
def main(request):
request
response
requirements.txt
flask
yfinance
Debug log
https://query2.finance.yahoo.com/v10/finance/quoteSummary/AAPL
textPayload: "DEBUG params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false', 'symbol': 'AAPL'}"
textPayload: "DEBUG cookie_mode = 'basic'"
textPayload: "DEBUG Entering _get_cookie_and_crumb()"
Bad data proof
No response
yfinance
versionlast
Python version
Python 3.12
Operating system
No response
The text was updated successfully, but these errors were encountered: