<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Felix Nullbyte</title>
    <description>The latest articles on DEV Community by Felix Nullbyte (@felixnullbyte).</description>
    <link>https://dev.to/felixnullbyte</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4271221%2F4a5b8452-1f76-4cdc-a354-a4074ad715a1.png</url>
      <title>DEV Community: Felix Nullbyte</title>
      <link>https://dev.to/felixnullbyte</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felixnullbyte"/>
    <language>en</language>
    <item>
      <title>Python Install Manager vs python.org Installer on Windows</title>
      <dc:creator>Felix Nullbyte</dc:creator>
      <pubDate>Sun, 29 Nov 2026 22:42:55 +0000</pubDate>
      <link>https://dev.to/felixnullbyte/python-install-manager-vs-pythonorg-installer-on-windows-2h2h</link>
      <guid>https://dev.to/felixnullbyte/python-install-manager-vs-pythonorg-installer-on-windows-2h2h</guid>
      <description>&lt;p&gt;Windows now has more than one official way to get Python, and they do not agree on where files go. The Python install manager, the traditional python.org &lt;code&gt;.exe&lt;/code&gt; installer, and the older per-version Microsoft Store packages produce different folder layouts, different command aliases, and different update behaviour. This guide maps each one, compares how &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;py&lt;/code&gt;, and &lt;code&gt;python3&lt;/code&gt; behave under it, and gives you a migration checklist and a recommendation matrix for 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What the Three Options Are in 2026&lt;/li&gt;
&lt;li&gt;Where Each Method Puts Python&lt;/li&gt;
&lt;li&gt;Command Behaviour for python, py, and python3&lt;/li&gt;
&lt;li&gt;Updates, Repairs, and Uninstalls&lt;/li&gt;
&lt;li&gt;Migrating to the Install Manager&lt;/li&gt;
&lt;li&gt;Which Method Should You Choose?&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the Three Options Are in 2026
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Python install manager&lt;/strong&gt; (the tool behind the &lt;code&gt;py&lt;/code&gt; and &lt;code&gt;pymanager&lt;/code&gt; commands) is the current official installer. It is a small app distributed as an MSIX package from python.org or the Microsoft Store, and it downloads and manages Python runtimes separately. The &lt;a href="https://docs.python.org/3/using/windows.html" rel="noopener noreferrer"&gt;Python documentation on using Python on Windows&lt;/a&gt; describes it as the way to obtain Python from the CPython team, with &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;py&lt;/code&gt;, and &lt;code&gt;pymanager&lt;/code&gt; available after installation. It is also the replacement that &lt;a href="https://peps.python.org/pep-0773/" rel="noopener noreferrer"&gt;PEP 773&lt;/a&gt; proposed to unify the older installers, and that PEP notes the existing &lt;code&gt;.exe&lt;/code&gt; installer and the old &lt;code&gt;py.exe&lt;/code&gt; launcher were to be deprecated once the new tool shipped.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;traditional python.org installer&lt;/strong&gt; is the full &lt;code&gt;.exe&lt;/code&gt; setup program that installs a complete development kit, including headers, Tcl/Tk, IDLE, the test suite, and the legacy &lt;code&gt;py.exe&lt;/code&gt; launcher. It is still what many tutorials describe, but it has a limited future: the &lt;a href="https://www.python.org/downloads/release/pymanager-264/" rel="noopener noreferrer"&gt;release notes for Python install manager 26.4&lt;/a&gt; state that "The traditional executable installer will stop being released with Python 3.16."&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Microsoft Store&lt;/strong&gt; now has two roles. It is a recommended delivery channel for the install manager itself, and it also historically hosted separate per-version Python packages (for example, "Python 3.13") with their own sandboxed layout. Those per-version packages are documented through Python 3.13 and remain common on existing machines, but they are not the layout you get from a new install manager setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Each Method Puts Python
&lt;/h2&gt;

&lt;p&gt;The install manager keeps the manager app, the runtimes, and the command aliases in separate places. Runtimes are per-user by default: the &lt;a href="https://raw.githubusercontent.com/python/pymanager/main/src/pymanager.json" rel="noopener noreferrer"&gt;install manager's default configuration&lt;/a&gt; sets &lt;code&gt;install_dir&lt;/code&gt; to &lt;code&gt;%LocalAppData%\Python&lt;/code&gt;, with global alias executables in &lt;code&gt;%LocalAppData%\Python\bin&lt;/code&gt; and a download cache in &lt;code&gt;%LocalAppData%\Python\_cache&lt;/code&gt;. Each runtime gets its own subdirectory under that root, with its own &lt;code&gt;Scripts&lt;/code&gt; folder. The manager app itself is an MSIX package, so Windows stores its program files in the protected &lt;code&gt;C:\Program Files\WindowsApps\&lt;/code&gt; location, and its commands appear through app execution aliases under &lt;code&gt;%LocalAppData%\Microsoft\WindowsApps&lt;/code&gt;, the per-user folder where &lt;a href="https://learn.microsoft.com/en-us/sysinternals/downloads/microsoft-store" rel="noopener noreferrer"&gt;Windows keeps MSIX app execution aliases&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The traditional installer has the most familiar layout, and it differs depending on whether you choose a per-user or all-users install. The &lt;a href="https://docs.python.org/3.13/using/windows.html" rel="noopener noreferrer"&gt;Python 3.13 documentation for Windows&lt;/a&gt; lists &lt;code&gt;%LocalAppData%\Programs\Python\PythonXY&lt;/code&gt; as the default just-for-me target and &lt;code&gt;%ProgramFiles%\Python X.Y&lt;/code&gt; as the default all-users target. The interpreter sits at the root of that folder and &lt;code&gt;Scripts&lt;/code&gt; sits beneath it. An all-users install also places the legacy &lt;code&gt;py.exe&lt;/code&gt; launcher in the Windows directory.&lt;/p&gt;

&lt;p&gt;The older Store packages are the awkward ones. Their program files live in a read-only package folder under &lt;code&gt;C:\Program Files\WindowsApps\&amp;lt;package full name&amp;gt;&lt;/code&gt;, and Windows redirects writes to user locations into a private copy. The Python 3.13 documentation gives the example of &lt;code&gt;%LocalAppData%\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\Local\&lt;/code&gt; as the real destination when a Store Python writes to &lt;code&gt;AppData\Local&lt;/code&gt;. There is no ordinary &lt;code&gt;Scripts&lt;/code&gt; folder on your &lt;code&gt;PATH&lt;/code&gt;; the package exposes &lt;code&gt;pip&lt;/code&gt; and &lt;code&gt;idle&lt;/code&gt; through app execution aliases instead.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Runtime files&lt;/th&gt;
&lt;th&gt;Command aliases&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;Scripts&lt;/code&gt; folder&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Install manager&lt;/td&gt;
&lt;td&gt;&lt;code&gt;%LocalAppData%\Python\&amp;lt;tag&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;%LocalAppData%\Python\bin&lt;/code&gt; plus WindowsApps aliases&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;runtime&amp;gt;\Scripts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Per-user only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;python.org installer&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;%LocalAppData%\Programs\Python\PythonXY&lt;/code&gt; or &lt;code&gt;%ProgramFiles%\Python X.Y&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;python.exe&lt;/code&gt; in the install folder; legacy &lt;code&gt;py.exe&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;install&amp;gt;\Scripts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Per-user or all-users&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Store package&lt;/td&gt;
&lt;td&gt;&lt;code&gt;C:\Program Files\WindowsApps\&amp;lt;package full name&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;App execution aliases in &lt;code&gt;%LocalAppData%\Microsoft\WindowsApps&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Not exposed on &lt;code&gt;PATH&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Per-user app package&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you need the full path table and the &lt;code&gt;python -c "import sys; print(sys.executable)"&lt;/code&gt; style checks for an existing machine, this guide to &lt;a href="https://coderivers.org/blog/where-is-python-installed-on-windows/" rel="noopener noreferrer"&gt;Python installation paths on Windows&lt;/a&gt; walks through locating each layout and verifying which interpreter is actually running. The install manager also has a built-in shortcut: &lt;code&gt;py list --format=prefix&lt;/code&gt; prints the folder for each runtime, so you do not have to guess at tag-based folder names.&lt;/p&gt;

&lt;h2&gt;
  
  
  Command Behaviour for python, py, and python3
&lt;/h2&gt;

&lt;p&gt;Under the install manager, &lt;code&gt;python&lt;/code&gt; launches the default runtime, &lt;code&gt;py&lt;/code&gt; does the same but also manages versions, and &lt;code&gt;python3&lt;/code&gt; is included mainly to catch scripts that assume the POSIX name; the documentation explicitly says it is not meant to be widely used or recommended. To pin a version, use &lt;code&gt;py -V:3.15&lt;/code&gt; or the shorter &lt;code&gt;py -3.15&lt;/code&gt;. Version-suffixed aliases such as &lt;code&gt;python3.15.exe&lt;/code&gt; exist only in &lt;code&gt;%LocalAppData%\Python\bin&lt;/code&gt;, so they require that folder on &lt;code&gt;PATH&lt;/code&gt;; you are prompted about this on first runtime install, and it is optional.&lt;/p&gt;

&lt;p&gt;The traditional installer writes &lt;code&gt;python.exe&lt;/code&gt; into the install directory and offers to prepend that directory and &lt;code&gt;Scripts&lt;/code&gt; to &lt;code&gt;PATH&lt;/code&gt;. If you decline, &lt;code&gt;python&lt;/code&gt; is not found in a new terminal. The legacy &lt;code&gt;py.exe&lt;/code&gt; launcher is the workaround: it discovers registered interpreters through the registry rather than &lt;code&gt;PATH&lt;/code&gt;, which is the registration scheme described in &lt;a href="https://peps.python.org/pep-0514/" rel="noopener noreferrer"&gt;PEP 514&lt;/a&gt;. That PEP also specifies that tools like &lt;code&gt;py.exe&lt;/code&gt; should prefer a per-user registration over a matching per-machine one, which is why the launcher can pick a sensible version without any &lt;code&gt;PATH&lt;/code&gt; editing.&lt;/p&gt;

&lt;p&gt;The Store package works almost entirely through app execution aliases. &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;python3&lt;/code&gt;, and &lt;code&gt;python3.x&lt;/code&gt; are aliases that you can enable or disable in "Manage app execution aliases", and no &lt;code&gt;PATH&lt;/code&gt; change is involved. The catch is coexistence: the Python 3.13 documentation warns that if another Python is on &lt;code&gt;PATH&lt;/code&gt;, that install wins for &lt;code&gt;python.exe&lt;/code&gt;, and the legacy &lt;code&gt;py.exe&lt;/code&gt; launcher will detect the Store install but prefer traditional installs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Install manager&lt;/th&gt;
&lt;th&gt;python.org installer&lt;/th&gt;
&lt;th&gt;Store package&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias to default runtime&lt;/td&gt;
&lt;td&gt;Works only if &lt;code&gt;PATH&lt;/code&gt; was modified&lt;/td&gt;
&lt;td&gt;App execution alias&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Full manager CLI and launcher&lt;/td&gt;
&lt;td&gt;Legacy launcher, registry-based&lt;/td&gt;
&lt;td&gt;Legacy launcher detects it but prefers traditional installs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias included for compatibility&lt;/td&gt;
&lt;td&gt;Not installed&lt;/td&gt;
&lt;td&gt;App execution alias&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python3.15&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias in &lt;code&gt;%LocalAppData%\Python\bin&lt;/code&gt;, needs &lt;code&gt;PATH&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Not installed&lt;/td&gt;
&lt;td&gt;Versioned alias for that package&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One conflict matters before you migrate: the legacy &lt;code&gt;py.exe&lt;/code&gt; and the install manager both claim the &lt;code&gt;py&lt;/code&gt; command. The install manager release notes recommend uninstalling the Python launcher from previous installs, and the documentation notes that if the old launcher wins, &lt;code&gt;py&lt;/code&gt; may give a "can't open file" error until you remove it. The syntax also differs between generations: the new manager uses subcommands such as &lt;code&gt;py list&lt;/code&gt; and &lt;code&gt;py install&lt;/code&gt;, while the old launcher uses flags such as &lt;code&gt;py --list&lt;/code&gt; and &lt;code&gt;py -0p&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Updates, Repairs, and Uninstalls
&lt;/h2&gt;

&lt;p&gt;The install manager separates the tool from the runtimes, which changes the meaning of "update" and "uninstall".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The manager updates itself automatically, within about a day of a release, and that does not touch installed runtimes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;py install --update&lt;/code&gt; replaces managed runtimes with newer versions. It removes modifications made to the install, including globally installed packages, but leaves the runtime's &lt;code&gt;site-packages&lt;/code&gt; and &lt;code&gt;Scripts&lt;/code&gt; directories in place, and does not touch virtual environments.&lt;/li&gt;
&lt;li&gt;New packages installed with &lt;code&gt;pip&lt;/code&gt; do not get global shortcuts automatically; &lt;code&gt;py install --refresh&lt;/code&gt; recreates shortcuts and aliases.&lt;/li&gt;
&lt;li&gt;Uninstalling the manager from "Installed apps" does not uninstall any runtimes, although it removes the global &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;py&lt;/code&gt; commands. To remove everything, run &lt;code&gt;py uninstall --purge&lt;/code&gt; first, or use &lt;code&gt;py uninstall &amp;lt;tag&amp;gt;&lt;/code&gt; for individual runtimes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The traditional installer behaves like a classic Windows Installer program: you modify features, repair files, or uninstall from the same setup entry, and the documentation notes that the install directory cannot be changed in Modify mode. Installing a newer Python next to an older one can also change which &lt;code&gt;python&lt;/code&gt; wins, because &lt;code&gt;PATH&lt;/code&gt; is prepended or appended rather than version-aware, a limitation PEP 773 calls out directly.&lt;/p&gt;

&lt;p&gt;The Store package is updated by the Store, and uninstalling it removes packages installed into that interpreter but not your virtual environments. Because of the AppData redirection, the package's own data lives in a private per-package folder rather than the normal user profile paths, which is worth remembering when you script backups or look for configuration files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Migrating to the Install Manager
&lt;/h2&gt;

&lt;p&gt;The migration is mostly about protecting packages and virtual environments, because neither is moved for you. Virtual environments are explicitly "not considered as movable or copyable" in the &lt;a href="https://docs.python.org/3/library/venv.html" rel="noopener noreferrer"&gt;&lt;code&gt;venv&lt;/code&gt; documentation&lt;/a&gt;; installed scripts contain absolute paths to the interpreter, so you recreate an environment at the new location instead of copying it. Global packages in an old interpreter's &lt;code&gt;site-packages&lt;/code&gt; likewise need to be reinstalled.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Record what you have.&lt;/strong&gt; Run &lt;code&gt;py -0p&lt;/code&gt; (or &lt;code&gt;py --list-paths&lt;/code&gt;) with the legacy launcher, note each base interpreter path, and export packages from each environment with &lt;code&gt;python -m pip freeze &amp;gt; requirements.txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install the manager through one channel.&lt;/strong&gt; For example: &lt;code&gt;winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-interactivity&lt;/code&gt;, then run &lt;code&gt;py install --configure -y&lt;/code&gt; to accept the configuration checker's suggested changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remove the old launcher and stale &lt;code&gt;PATH&lt;/code&gt; entries, but keep the old runtimes for now.&lt;/strong&gt; The manager's troubleshooting guidance for "&lt;code&gt;python&lt;/code&gt; doesn't launch the same runtime as &lt;code&gt;py&lt;/code&gt;" is to remove existing Python entries or disable their &lt;code&gt;PATH&lt;/code&gt; options.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install matching runtimes.&lt;/strong&gt; &lt;code&gt;py install 3.13 3.12&lt;/code&gt; (or whichever versions you need). &lt;code&gt;py list&lt;/code&gt; shows managed and unmanaged installs, and &lt;code&gt;py list --only-managed&lt;/code&gt; narrows it to the new ones.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recreate each virtual environment.&lt;/strong&gt; Delete the old &lt;code&gt;.venv&lt;/code&gt; and run &lt;code&gt;py -V:3.13 -m venv .venv&lt;/code&gt;, activate it, then &lt;code&gt;python -m pip install -r requirements.txt&lt;/code&gt;. Test any compiled dependencies before deleting the old interpreter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reinstall global tools into the new runtime, then refresh aliases.&lt;/strong&gt; After &lt;code&gt;pip install&lt;/code&gt; of command-line tools, run &lt;code&gt;py install --refresh&lt;/code&gt; so &lt;code&gt;pip.exe&lt;/code&gt; and similar commands appear in the aliases folder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port your defaults.&lt;/strong&gt; The old &lt;code&gt;py.ini&lt;/code&gt; file is ignored by the new manager. Use &lt;code&gt;PYTHON_MANAGER_DEFAULT&lt;/code&gt; or the &lt;code&gt;default_tag&lt;/code&gt; setting in &lt;code&gt;%AppData%\Python\pymanager.json&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify, then clean up.&lt;/strong&gt; Check &lt;code&gt;py list&lt;/code&gt; and &lt;code&gt;py -V:3.13 -c "import sys; print(sys.executable)"&lt;/code&gt;, then uninstall the old traditional or Store Python. Only run &lt;code&gt;py uninstall --purge&lt;/code&gt; when you actually want to remove every managed runtime.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Which Method Should You Choose?
&lt;/h2&gt;

&lt;p&gt;There is no single default that fits every Windows setup, so use the scenario rather than the installer's age.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Recommended approach&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Individual developer laptop&lt;/td&gt;
&lt;td&gt;Install manager from the Store or WinGet&lt;/td&gt;
&lt;td&gt;Per-user install, automatic updates, easy multi-version switching with &lt;code&gt;py&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Existing project pinned to an older python.org install&lt;/td&gt;
&lt;td&gt;Keep it until you have validated the migration, then move to the manager&lt;/td&gt;
&lt;td&gt;Native wheels and tooling may assume the old base path; run both side by side first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shared workstation with several users&lt;/td&gt;
&lt;td&gt;Install manager MSI for the tool, then per-user runtimes&lt;/td&gt;
&lt;td&gt;The MSI installs the manager per-machine, but runtimes remain per-user and shared between MSI and MSIX installs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automated provisioning or CI&lt;/td&gt;
&lt;td&gt;WinGet plus &lt;code&gt;py install&lt;/code&gt;, with an offline index if needed&lt;/td&gt;
&lt;td&gt;Scriptable and version-pinned; build an offline index with &lt;code&gt;py install --download&lt;/code&gt; for disconnected machines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Truly machine-wide, fixed-path requirement&lt;/td&gt;
&lt;td&gt;Traditional all-users installer until 3.16, or &lt;code&gt;py install --target&lt;/code&gt; plus your own system changes&lt;/td&gt;
&lt;td&gt;The install manager does not support per-machine runtimes; the documentation suggests &lt;code&gt;--target&lt;/code&gt; as the emulation path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows Server 2019&lt;/td&gt;
&lt;td&gt;Install manager MSI, not the MSIX&lt;/td&gt;
&lt;td&gt;MSIX is unsupported there; the MSI is the documented fallback&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two caveats worth repeating for administrators. The install manager supports Windows 10 and Windows Server 2022 or later, so older servers need a different plan. And provisioning an MSIX for all users does not remove the per-user runtime requirement: someone still has to be logged in to run &lt;code&gt;py install&lt;/code&gt;, because there is no supported way to trigger those installs machine-wide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Python install manager is the forward-looking choice: per-user runtimes under &lt;code&gt;%LocalAppData%\Python&lt;/code&gt;, aliases in &lt;code&gt;%LocalAppData%\Python\bin&lt;/code&gt;, automatic self-updates, and a clean split between the tool and the runtimes it manages. The traditional python.org installer gives you the familiar &lt;code&gt;%LocalAppData%\Programs\Python\PythonXY&lt;/code&gt; or &lt;code&gt;%ProgramFiles%\Python X.Y&lt;/code&gt; layout and all-users installs, but it stops shipping with Python 3.16. The older Store packages are best treated as legacy, with a sandboxed &lt;code&gt;WindowsApps&lt;/code&gt; layout and redirected AppData paths. For most developers in 2026, install the manager, pin versions with &lt;code&gt;py&lt;/code&gt;, recreate virtual environments rather than copying them, and keep the old install around only until the migration is verified.&lt;/p&gt;

</description>
      <category>python</category>
      <category>softwaredevelopment</category>
      <category>tools</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>yfinance YFRateLimitError Fix: Diagnose and Recover</title>
      <dc:creator>Felix Nullbyte</dc:creator>
      <pubDate>Sun, 29 Nov 2026 11:38:17 +0000</pubDate>
      <link>https://dev.to/felixnullbyte/yfinance-yfratelimiterror-fix-diagnose-and-recover-4be4</link>
      <guid>https://dev.to/felixnullbyte/yfinance-yfratelimiterror-fix-diagnose-and-recover-4be4</guid>
      <description>&lt;p&gt;&lt;code&gt;YFRateLimitError: Too Many Requests. Rate limited. Try after a while.&lt;/code&gt; looks like a simple wait-and-retry problem. In practice, the same message can mean a rejected client fingerprint, a shared cloud IP that Yahoo has already throttled, or a symbol and date combination that never had data. Worse, &lt;code&gt;yf.download()&lt;/code&gt; can log the 429 and return an empty DataFrame, so the exception never reaches your &lt;code&gt;except&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;This walkthrough gives you a diagnostic order: prove the limit is real, reproduce the silent empty result, then apply four fixes in the order that removes causes instead of guessing. It is written for scheduled jobs and notebooks pulling many tickers, especially from cloud runners where the outbound IP is shared with other users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Confirm the failure before changing code&lt;/li&gt;
&lt;li&gt;Reproduce the silent empty DataFrame&lt;/li&gt;
&lt;li&gt;Fix 1: Upgrade yfinance and curl_cffi&lt;/li&gt;
&lt;li&gt;Fix 2: Remove custom sessions and caches&lt;/li&gt;
&lt;li&gt;Fix 3: Batch tickers and reuse cached bars&lt;/li&gt;
&lt;li&gt;Fix 4: Retry empty frames with bounded backoff&lt;/li&gt;
&lt;li&gt;Put the fixes in one resumable loader&lt;/li&gt;
&lt;li&gt;When to stop retrying&lt;/li&gt;
&lt;li&gt;Diagnostic checklist&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Confirm the failure before changing code
&lt;/h2&gt;

&lt;p&gt;A 429 is an HTTP response, but &lt;code&gt;YFRateLimitError&lt;/code&gt; is not proof that you exceeded a published quota. Yahoo does not publish a numeric limit for the endpoints yfinance uses, and the exception carries the same fixed message whether the refusal came from request volume, a client that does not look like a browser, or a shared IP.&lt;/p&gt;

&lt;p&gt;Start by separating three cases:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Likely cause&lt;/th&gt;
&lt;th&gt;How to confirm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;429 on the first call for a liquid symbol&lt;/td&gt;
&lt;td&gt;Client rejected before volume matters, or a flagged IP&lt;/td&gt;
&lt;td&gt;Try the same probe from another network and check the yfinance session setup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Empty frame plus a log line containing &lt;code&gt;Failed download&lt;/code&gt; and &lt;code&gt;YFRateLimitError&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;A real throttle that &lt;code&gt;yf.download()&lt;/code&gt; swallowed&lt;/td&gt;
&lt;td&gt;Read the error log, not just the return value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Empty frame plus "possibly delisted" or no error at all&lt;/td&gt;
&lt;td&gt;Wrong symbol, delisted ticker, or a date range with no sessions&lt;/td&gt;
&lt;td&gt;Test a known-good symbol with the same dates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A useful probe is to call &lt;code&gt;Ticker.history()&lt;/code&gt; rather than &lt;code&gt;download()&lt;/code&gt;, because &lt;code&gt;history()&lt;/code&gt; propagates the rate-limit error while &lt;code&gt;download()&lt;/code&gt; catches it. Run the probe for a liquid symbol and for the suspect symbol with the same dates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;YFRateLimitError&lt;/span&gt;

&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;basicConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;INFO&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hide_exceptions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;probe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Ticker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;history&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;auto_adjust&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;YFRateLimitError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"rate limited (raised)"&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{type(exc).__name__}: {exc}"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"empty frame"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"ok: {len(frame)} rows, {frame.index.min().date()} to {frame.index.max().date()}"&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;probe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"AAPL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"2026-01-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"2026-02-01"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;probe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"THISISNOTATICKER"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"2026-01-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"2026-02-01"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If AAPL also fails with a 429, treat it as a client, network, or IP problem. If AAPL returns rows and only the suspect symbol is empty, fix the symbol or date range before touching retry logic.&lt;/p&gt;

&lt;p&gt;Date handling matters here. The &lt;a href="https://ranaroussi.github.io/yfinance/reference/api/yfinance.download.html" rel="noopener noreferrer"&gt;&lt;code&gt;yfinance.download&lt;/code&gt; API reference&lt;/a&gt; notes that &lt;code&gt;end&lt;/code&gt; is exclusive, so &lt;code&gt;end="2026-02-01"&lt;/code&gt; stops at the last session before 1 February. A range that starts and ends on a weekend or holiday can legitimately produce no rows even though the ticker is valid. Check &lt;code&gt;frame.shape&lt;/code&gt; and the log before assuming the worst.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce the silent empty DataFrame
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;yf.download()&lt;/code&gt; is designed for bulk jobs, and its error handling is different from &lt;code&gt;Ticker.history()&lt;/code&gt;. The &lt;a href="https://github.com/ranaroussi/yfinance/blob/1.8.0/yfinance/multi.py" rel="noopener noreferrer"&gt;&lt;code&gt;yfinance&lt;/code&gt; download implementation&lt;/a&gt; catches each ticker's exception, records it in the error log, substitutes an empty frame, and continues with the rest of the batch. That means a &lt;code&gt;try/except YFRateLimitError&lt;/code&gt; wrapped around &lt;code&gt;yf.download()&lt;/code&gt; will not fire when Yahoo returns 429 for a ticker.&lt;/p&gt;

&lt;p&gt;You can prove the behavior without waiting for a real block by making the ticker's &lt;code&gt;history()&lt;/code&gt; method raise the same exception:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;unittest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mock&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;patch&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;YFRateLimitError&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yfinance.multi.Ticker"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;return_value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side_effect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;YFRateLimitError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"AAPL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"5d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On yfinance 1.8.0 this prints &lt;code&gt;(0, 6) True&lt;/code&gt; and logs a failed download. The exact column count can change between versions, but the important part is &lt;code&gt;empty&lt;/code&gt; being &lt;code&gt;True&lt;/code&gt;. A real 429 produces the same result after the library logs the error; the mock just removes the wait.&lt;/p&gt;

&lt;p&gt;This is why the retry condition must be based on the result, not only on exceptions. Check the whole frame, and for a multi-ticker download check each ticker's columns as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ticker_frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MultiIndex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_level_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_level_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"all"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If one ticker succeeds, &lt;code&gt;frame.empty&lt;/code&gt; is &lt;code&gt;False&lt;/code&gt; even when another ticker in the same batch failed. The per-ticker check is what lets you retry only the symbols that are actually missing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 1: Upgrade yfinance and curl_cffi
&lt;/h2&gt;

&lt;p&gt;The first fix is version hygiene. The current release, yfinance 1.8.0, came out on 3 November 2026, and its &lt;a href="https://github.com/ranaroussi/yfinance/releases/tag/1.8.0" rel="noopener noreferrer"&gt;release notes&lt;/a&gt; state that it forces &lt;code&gt;curl_cffi&lt;/code&gt; 0.17 or newer for security updates. Modern yfinance uses &lt;code&gt;curl_cffi&lt;/code&gt; to build its default session; a very old pin from 2025 may predate fixes for false rate-limit errors and the current session behavior.&lt;/p&gt;

&lt;p&gt;Upgrade both packages together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python -m pip install -U yfinance curl_cffi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then verify that the import path yfinance expects is actually available:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;importlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;md&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;_http&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yfinance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yfinance"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"curl_cffi"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;md&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"curl_cffi"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"curl_cffi backend:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;HAS_CURL_CFFI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;HAS_CURL_CFFI&lt;/code&gt; should be &lt;code&gt;True&lt;/code&gt;. If it is &lt;code&gt;False&lt;/code&gt;, yfinance has fallen back to plain &lt;code&gt;requests&lt;/code&gt;, which does not reproduce the browser TLS and HTTP/2 behavior that &lt;code&gt;curl_cffi&lt;/code&gt; provides. Fix the installation before adding retries; a retry loop will not repair a client that Yahoo refuses from the first request.&lt;/p&gt;

&lt;p&gt;If your project pins yfinance, check whether the pin is older than the current 1.x line. A pin that once avoided a breaking change can now keep you on a release with worse 429 behavior. Upgrade in a test environment, run a small batch, and compare the logs before changing a production pin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 2: Remove custom sessions and caches
&lt;/h2&gt;

&lt;p&gt;Older yfinance examples often pass a custom &lt;code&gt;requests.Session&lt;/code&gt;, sometimes a &lt;code&gt;requests_cache.CachedSession&lt;/code&gt;, to add caching or a custom user agent. That advice is now a trap. Current yfinance rejects a session that exposes a cache with &lt;code&gt;YFDataException&lt;/code&gt; and tells you to stop setting the session and let yfinance handle it; the check is visible in &lt;a href="https://github.com/ranaroussi/yfinance/blob/1.8.0/yfinance/data.py" rel="noopener noreferrer"&gt;yfinance's session handling&lt;/a&gt;. That source also shows the request path: yfinance switches to its other cookie strategy on an error, retries once, and raises &lt;code&gt;YFRateLimitError&lt;/code&gt; if the response is still 429. A custom session replaces the session yfinance would otherwise build for you.&lt;/p&gt;

&lt;p&gt;Remove the &lt;code&gt;session=&lt;/code&gt; argument from &lt;code&gt;Ticker&lt;/code&gt; and &lt;code&gt;download&lt;/code&gt; calls:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;

&lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"AAPL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"5d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you need a proxy, use the config object rather than constructing your own HTTP session. If you need disk caching, cache the returned DataFrames yourself; the &lt;a href="https://ranaroussi.github.io/yfinance/advanced/caching.html" rel="noopener noreferrer"&gt;yfinance caching documentation&lt;/a&gt; explains that the library's persistent cache stores timezones and cookies, not price history.&lt;/p&gt;

&lt;p&gt;A caching layer is still valuable, but it belongs after the download, not inside the HTTP session. The next section shows where to put it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 3: Batch tickers and reuse cached bars
&lt;/h2&gt;

&lt;p&gt;A loop over &lt;code&gt;Ticker.history()&lt;/code&gt; costs at least one request per symbol. &lt;code&gt;yf.download()&lt;/code&gt; with a list uses one shared session and can fetch symbols in parallel, which is the better primitive for a universe of tickers. Keep chunks moderate, cap the worker count, and pause between chunks.&lt;/p&gt;

&lt;p&gt;If you want to check the baseline call pattern before adding batching, our guide to &lt;a href="https://coderivers.org/blog/python-yfinance/" rel="noopener noreferrer"&gt;downloading historical data with yfinance&lt;/a&gt; walks through &lt;code&gt;yf.download()&lt;/code&gt; and &lt;code&gt;Ticker.history()&lt;/code&gt; with runnable examples.&lt;/p&gt;

&lt;p&gt;A simple batch call looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;

&lt;span class="n"&gt;symbols&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AAPL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"MSFT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"NVDA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"AMZN"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;symbols&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;interval&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;group_by&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ticker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;auto_adjust&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;threads=4&lt;/code&gt; rather than leaving the default &lt;code&gt;threads=True&lt;/code&gt;. In the yfinance source, &lt;code&gt;threads=True&lt;/code&gt; becomes one worker per CPU core, so a 32-core runner can fire 32 requests at once. That burst is exactly what a shared cloud IP does not need. A small integer keeps the parallelism but makes it predictable.&lt;/p&gt;

&lt;p&gt;Caching is the other half of batching. Unadjusted daily bars do not change after the session, though adjusted prices can be revised when a dividend or split occurs, which is why the cache key includes the fetch date. A rerun should not ask Yahoo for the same history again. Cache per symbol, include the date in the filename so a file from yesterday is not served as today's data, and refuse to write an empty frame:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="no"&gt;CACHE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yf-cache"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;CACHE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;cache_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;stamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;today&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;CACHE&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{symbol}_{period}_{stamp}.pkl"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;load_bars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1y"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cache_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_pickle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;save_bars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1y"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{symbol}: refusing to cache an empty frame"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_pickle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cache_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only fetch the symbols that do not have a cache file for the current period. The empty-frame check is important: a cache written during an outage would otherwise be read back as if it were real data on every later run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 4: Retry empty frames with bounded backoff
&lt;/h2&gt;

&lt;p&gt;Once batching and caching are in place, retries become a smaller, more targeted tool. The retry condition is an empty frame or an empty ticker column, not &lt;code&gt;except YFRateLimitError&lt;/code&gt;. Start with a long wait, add jitter so parallel jobs do not retry at the same instant, and stop after a fixed number of attempts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;download_with_backoff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbols&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;900&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;symbols&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"5d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;interval&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
        &lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"empty frame; sleeping {wait:.0f}s before retry {attempt + 1}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wait&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thirty seconds is a better starting point than one second. A tight retry loop keeps the block alive; yfinance's own source notes that once Yahoo rate-limits, more requests only extend the block. Five escalating waits with a 15-minute cap give a genuine volume limit time to clear without hiding a client-level rejection.&lt;/p&gt;

&lt;p&gt;Do not use &lt;code&gt;yf.config.network.retries&lt;/code&gt; as your 429 strategy. The &lt;a href="https://ranaroussi.github.io/yfinance/advanced/config.html" rel="noopener noreferrer"&gt;yfinance config documentation&lt;/a&gt; describes that setting as automatic retry for transient network errors, with waits of 1, 2, and 4 seconds; an HTTP 429 response is not a transient network error. It is a successful round trip with a refusal, and it needs your own policy.&lt;/p&gt;

&lt;p&gt;For a multi-ticker frame, &lt;code&gt;not frame.empty&lt;/code&gt; is too coarse. One surviving ticker makes the whole frame non-empty. Use the per-ticker extraction shown earlier, retry only the missing symbols, and keep the rest of the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put the fixes in one resumable loader
&lt;/h2&gt;

&lt;p&gt;The pieces fit together in a loader that batches missing symbols, caches successful bars, retries empty results, and records what it could not fetch. The skipped list is the handoff to the next run: symbols that outlasted the retries have no cache file, so the next run picks them up automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;

&lt;span class="no"&gt;CACHE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yf-cache"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;CACHE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;SKIPPED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yf-skipped.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;cache_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;stamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;today&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;CACHE&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{symbol}_{period}_{stamp}.pkl"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ticker_frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MultiIndex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_level_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_level_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"all"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;chunked&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update_cache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbols&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;missing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;symbols&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;cache_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;skipped&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;chunked&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;pending&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;900&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wait&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;interval&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;group_by&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ticker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;auto_adjust&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;pending&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;bars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ticker_frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;bars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;empty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;bars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_pickle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cache_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;
            &lt;span class="n"&gt;batch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pending&lt;/span&gt;
        &lt;span class="n"&gt;skipped&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="no"&gt;SKIPPED&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skipped&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;indent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skipped&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Call &lt;code&gt;update_cache(symbols)&lt;/code&gt; once per run. It returns the symbols that still need attention, writes them to &lt;code&gt;yf-skipped.json&lt;/code&gt;, and leaves a cache file for every success. On the next run, the cache check skips the completed symbols and tries the rest. The six-attempt loop starts with a 30-second wait, doubles it, adds jitter, and caps each wait at 15 minutes, so a bad afternoon does not turn into an infinite request loop.&lt;/p&gt;

&lt;p&gt;Two operational details are worth adding in a real job. Delete old cache files periodically so the directory does not grow forever, and log the skipped list with the run ID. If the same symbols appear in the skipped file for several runs, stop retrying them and investigate the symbols or the network before the next scheduled run.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to stop retrying
&lt;/h2&gt;

&lt;p&gt;There are two cases where more retries are the wrong move.&lt;/p&gt;

&lt;p&gt;The first is a 429 on the very first request from a known-good symbol on a network that worked before. That pattern points to a client or IP-level rejection, not a volume limit that will clear in 15 minutes. Check the version and &lt;code&gt;curl_cffi&lt;/code&gt; backend, remove custom sessions, and test from a different network. Shared cloud addresses used by Colab, CI runners, and serverless functions are often already throttled before your job sends anything.&lt;/p&gt;

&lt;p&gt;The second is a scheduled production workload that keeps hitting the limit even after batching, caching, and long backoff. &lt;a href="https://legal.yahoo.com/us/en/yahoo/terms/product-atos/apiforydn/index.html" rel="noopener noreferrer"&gt;Yahoo's Developer API Terms&lt;/a&gt; state that the APIs may be subject to rate limits at Yahoo's sole discretion, and they prohibit selling, leasing, or deriving income from the APIs without permission. yfinance's own documentation describes the project as a research and educational tool and points users to Yahoo's terms for the data. That is a reasonable fit for notebooks and research; it is not a service-level agreement for a nightly product job.&lt;/p&gt;

&lt;p&gt;When the job must not fail, move it to a source with a published quota and a support contract. If you only need filed fundamentals rather than prices, the &lt;a href="https://www.sec.gov/about/developer-resources" rel="noopener noreferrer"&gt;SEC's developer resources&lt;/a&gt; document free JSON APIs on &lt;code&gt;data.sec.gov&lt;/code&gt; and a fair-access guideline of no more than 10 requests per second. If you need prices and intraday history, use a market-data vendor with a stated request allowance. A proxy can move you off a burned shared IP, but it does not turn Yahoo's endpoints into a supported API or change the terms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Diagnostic checklist
&lt;/h2&gt;

&lt;p&gt;Work down this list when a run fails or returns empty frames:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the same date range for a known-good symbol. If it also fails with 429, treat it as a client, network, or IP problem. If it succeeds, inspect the suspect symbol and date range.&lt;/li&gt;
&lt;li&gt;Print the yfinance and &lt;code&gt;curl_cffi&lt;/code&gt; versions and confirm &lt;code&gt;_http.HAS_CURL_CFFI&lt;/code&gt; is &lt;code&gt;True&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Search the code for &lt;code&gt;session=&lt;/code&gt;. Remove custom sessions, especially caching sessions.&lt;/li&gt;
&lt;li&gt;Check whether the failure is an exception or an empty result. &lt;code&gt;yf.download()&lt;/code&gt; logs the error and returns an empty frame; &lt;code&gt;Ticker.history()&lt;/code&gt; raises.&lt;/li&gt;
&lt;li&gt;For a multi-ticker frame, check each ticker's columns. Do not rely on the whole frame being empty.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;Ticker.history()&lt;/code&gt; loops with &lt;code&gt;yf.download()&lt;/code&gt; in chunks of about 50, using &lt;code&gt;threads=4&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a date-stamped cache and refuse to write an empty frame.&lt;/li&gt;
&lt;li&gt;Use a 30-second base, jitter, a 15-minute cap, and six attempts. Do not retry in a tight loop.&lt;/li&gt;
&lt;li&gt;If it fails only on cloud or CI runners, move the job to a cleaner network or switch to a quota-backed source.&lt;/li&gt;
&lt;li&gt;If the same symbols survive several retry cycles, stop and investigate instead of extending the block.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The yfinance YFRateLimitError fix is a sequence, not a single flag. Confirm the failure with a known-good symbol, reproduce the silent empty DataFrame, then upgrade yfinance and &lt;code&gt;curl_cffi&lt;/code&gt;, remove custom sessions and caching sessions, batch and cache your tickers, and retry only the empty results with long, bounded backoff.&lt;/p&gt;

&lt;p&gt;The most common mistake is treating &lt;code&gt;yf.download()&lt;/code&gt; like a function that raises. It does not. Check the returned frame and the per-ticker columns, and record skipped symbols so the next run can resume. When the same job fails from the first request or keeps failing after a proper backoff, stop retrying and move the workload to a source with a published quota.&lt;/p&gt;

</description>
      <category>api</category>
      <category>debugging</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
