Impersonating chrome136 is not supported
Describe bug
File /nix/store/syy525yj5pmcjb89yzjsk2p785kxc6k4-python3-3.13.3-env/lib/python3.13/site-packages/curl_cffi/requests/utils.py:581, in set_curl_options(curl, method, url, params_list, base_url, data, json, headers_list, cookies_list, files, auth, timeout, allow_redirects, max_redirects, proxies_list, proxy, proxy_auth, verify_list, referer, accept_encoding, content_callback, impersonate, ja3, akamai, extra_fp, default_headers, quote, http_version, interface, cert, stream, max_recv_speed, multipart, queue_class, event_class, curl_options) 579 ret = c.impersonate(impersonate, default_headers=default_headers) # type: ignore 580 if ret != 0: --> 581 raise ImpersonateError(f"Impersonating {impersonate} is not supported") 583 # ja3 string 584 if ja3:
ImpersonateError: Impersonating chrome136 is not supported
Simple code that reproduces your problem
Any function relying on curl_cffi
Debug log from yf.enable_debug_mode()
DEBUG get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/EWZ DEBUG Entering get() DEBUG Entering _make_request() DEBUG url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/EWZ DEBUG params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false', 'symbol': 'EWZ'} DEBUG Entering _get_cookie_and_crumb() DEBUG cookie_mode = 'basic' DEBUG Entering _get_cookie_and_crumb_basic() DEBUG Entering _get_cookie_basic() DEBUG Entering _load_cookie_curlCffi() DEBUG Exiting _load_cookie_curlCffi()
Bad data proof
No response
yfinance version
0.2.62
Python version
3.13
Operating system
Linux/NixOS
The link is to a local file. Not useful.
Looks like a curl_cffi bug not yfinance https://github.com/lexiforest/curl_cffi
I did a few tests. It seems to be a version compatibility problem between yfinance and curl_cffi. I tested 3 combinations : yfinance 0.2.62 + curcl_cffi 0.11.1 : NOK yfinance 0.2.61 + curcl_cffi 0.11.1 : NOK yfinance 0.2.58 + curcl_cffi 0.7.4 : OK
So for now I have a workaround, but I suspect a compatibility problem between yfinance and latest versions of curl_cffi
I use curl_cffi 0.11.1 ...
What happens if you delete cookie cache? https://ranaroussi.github.io/yfinance/advanced/caching.html
And post your code, minimal code to reproduce error.
Clearing the cache had no effect.
Unless you guys are using nix/nixos, I won't be able to share a reproducible environment. Hopefully I've tested with uv and I cannot reproduce the problem either. So probably a corner case due to how nix manages dependencies.
Thanks for quick feedback anyhow.
I just wanted to see if you were passing through session object.
Run this with different curl_cffi versions: curl_cffi.requests.Session(impersonate="chrome")
I don't know how to use session object. Even a simple example raises the issue : import yfinance as yf yf.Ticker('SPY').info
But I can confirm this is specific to nixos. The combination yf 0.2.62 + curl_cffi 0.11.1 works with uv but doesn't work on nixos.
So it's probably somewhere in the sub-dependencies, or the curl_cffi package is borken on nixos ...
Happens for me on ubuntu 22.04; python 3.10; yfinance 0.2.63; curl-cffi 0.11.3; tf-nightly 2.20.0.dev20250604 -- all the latest stuff on python 3.10 (chosen for CUDA support across pytorch, tensorflow, jax) and the issue for me was importing tensorflow BEFORE importing yfinance. Works fine on Windows 11 but tensorflow is wonky with CUDA support (why I moved to ubuntu) so I figured it could be the issue.
Bad:
import tensorflow as tf import yfinance as yf df = yf.download('AAPL', start='2010-01-01', end='2019-01-01', auto_adjust=True) print('\ndf =\n') print(df)
[100%**] 1 of 1 completed 1 Failed download: ['AAPL']: ImpersonateError('Impersonating chrome136 is not supported') df = Empty DataFrame Columns: [(Adj Close, AAPL), (Close, AAPL), (High, AAPL), (Low, AAPL), (Open, AAPL), (Volume, AAPL)] Index: []
Good:
import yfinance as yf import tensorflow as tf df = yf.download('AAPL', start='2010-01-01', end='2019-01-01', auto_adjust=True) print('\ndf =\n') print(df)
[100%**] 1 of 1 completed
df =
Price Close High Low Open Volume
Ticker AAPL AAPL AAPL AAPL AAPL
Date
2010-01-04 6.431898 6.446625 6.382910 6.414467 493729600
2010-01-05 6.443017 6.479383 6.409056 6.449630 601904800
2010-01-06 6.340534 6.468565 6.333922 6.443018 552160000
2010-01-07 6.328810 6.371488 6.282827 6.363974 477131200
2010-01-08 6.370887 6.371489 6.283130 6.320396 447610800
... ... ... ... ... ...
2018-12-24 34.976116 36.100459 34.918945 35.290549 148676800
2018-12-26 37.439194 37.453486 34.949918 35.326288 234330000
2018-12-27 37.196220 37.343912 35.747917 37.122376 212468400
2018-12-28 37.215279 37.760778 36.815090 37.517804 169165600
2018-12-31 37.574982 37.960878 37.274837 37.763165 140014000
[2264 rows x 5 columns]
@rickvalstar compare these:
import curl_cffi
curl_cffi.requests.Session(impersonate="chrome")
vs
import tensorflow
import curl_cffi
curl_cffi.requests.Session(impersonate="chrome")
Because I'm still convinced this not yfinance problem.
@ValueRaider it does appear to be a curl_cffi vs tensorflow import issue and not yfinance -- at least for me. Your "curl_cffi.requests.session.Session()" stmt works either way (probably need to do something more with it) but yfinance only works if curl_cffi is imported before tensorflow, not after.
Also, downgrading curl_cffi to 0.7.4 as suggested by @benoitdr gives me a lower version of unsupported chrome:
[100%**] 1 of 1 completed 1 Failed download: ['AAPL']: ImpersonateError('Impersonating chrome124 is not supported')
Mods to my previous post (still with the latest versions and a clean session for each run; repeated runs with same session give same results so it's definitely import caching):
Bad:
import tensorflow as tf import curl_cffi import yfinance as yf print('curl session var =', curl_cffi.requests.Session(impersonate="chrome"), flush=True) df = yf.download('AAPL', start='2010-01-01', end='2019-01-01', auto_adjust=True) print('df =', df)
curl session var = <curl_cffi.requests.session.Session object at 0x7e4f15ece530> [100%**] 1 of 1 completed 1 Failed download: ['AAPL']: ImpersonateError('Impersonating chrome136 is not supported') df = Empty DataFrame Columns: [(Adj Close, AAPL), (Close, AAPL), (High, AAPL), (Low, AAPL), (Open, AAPL), (Volume, AAPL)] Index: []
Good:
import curl_cffi import tensorflow as tf import yfinance as yf print('curl session var =', curl_cffi.requests.Session(impersonate="chrome"), flush=True) df = yf.download('AAPL', start='2010-01-01', end='2019-01-01', auto_adjust=True) print('df =', df)
curl session var = <curl_cffi.requests.session.Session object at 0x7d14280142e0>
[100%**] 1 of 1 completed
df = Price Close High Low Open Volume
Ticker AAPL AAPL AAPL AAPL AAPL
Date
2010-01-04 6.431894 6.446621 6.382906 6.414463 493729600
2010-01-05 6.443016 6.479382 6.409054 6.449628 601904800
2010-01-06 6.340533 6.468564 6.333921 6.443018 552160000
2010-01-07 6.328811 6.371488 6.282828 6.363974 477131200
2010-01-08 6.370886 6.371488 6.283129 6.320395 447610800
... ... ... ... ... ...
2018-12-24 34.976128 36.100471 34.918956 35.290561 148676800
2018-12-26 37.439194 37.453486 34.949918 35.326288 234330000
2018-12-27 37.196209 37.343901 35.747906 37.122365 212468400
2018-12-28 37.215275 37.760774 36.815087 37.517800 169165600
2018-12-31 37.574982 37.960878 37.274837 37.763165 140014000
[2264 rows x 5 columns]
This also happens to me when using Ubuntu 22.04; python 3.10.12; yfinance 0.2.63; curl-cffi 0.10; tf-stable 2.19. In general, almost all the latest updates and the apparent fix for them were the same to @rickvalstar; importing yfinance before tensorflow fixed the problem. I don't know what scocery occurs to make that work, but thank you @rickvalstar for the fix
tell curl_cffi developers
This also happens to me when using Ubuntu 22.04; python 3.10.12; yfinance 0.2.63; curl-cffi 0.10; tf-stable 2.19. In general, almost all the latest updates and the apparent fix for them were the same to @rickvalstar; importing yfinance before tensorflow fixed the problem. I don't know what scocery occurs to make that work, but thank you @rickvalstar for the fix
This solution works on me (WSL 2.3, Python 310 / yfinance 0.2.63). Thanks, this really helped!