<?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: AM tank</title>
    <description>The latest articles on DEV Community by AM tank (@am_tank_67c74e70efc6bd23b).</description>
    <link>https://dev.to/am_tank_67c74e70efc6bd23b</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%2F4166768%2F78b9a536-c8b9-41f8-b2e2-352a4303b7a7.png</url>
      <title>DEV Community: AM tank</title>
      <link>https://dev.to/am_tank_67c74e70efc6bd23b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/am_tank_67c74e70efc6bd23b"/>
    <language>en</language>
    <item>
      <title>pip Cache How to Clear It on Windows</title>
      <dc:creator>AM tank</dc:creator>
      <pubDate>Wed, 07 Oct 2026 15:56:32 +0000</pubDate>
      <link>https://dev.to/am_tank_67c74e70efc6bd23b/pip-cache-how-to-clear-it-on-windows-2ekg</link>
      <guid>https://dev.to/am_tank_67c74e70efc6bd23b/pip-cache-how-to-clear-it-on-windows-2ekg</guid>
      <description>&lt;p&gt;You can clear pip's cache on Windows with &lt;code&gt;py -m pip cache purge&lt;/code&gt; after checking its location and size. This removes cached downloads and wheels, not packages already installed in your Python environments. If you only need to remove a particular cached wheel, use a targeted removal instead of purging everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspect the cache from the Python you use
&lt;/h2&gt;

&lt;p&gt;Open Start &amp;gt; Command Prompt under your normal development account. These steps assume Python and pip are installed and the &lt;code&gt;py&lt;/code&gt; command is available. Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="na"&gt;--version
&lt;/span&gt;&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="nb"&gt;dir&lt;/span&gt;
&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="kd"&gt;info&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep the output so you know which installation and cache you inspected. The directory command reports the configured cache; the information command reports its contents and size. They help you decide whether cache cleanup is relevant before any deletion.&lt;/p&gt;

&lt;p&gt;The usual Windows cache path is &lt;code&gt;%LocalAppData%\pip\Cache&lt;/code&gt;, but do not assume that default matches your setup. Paste the path returned by the command into File Explorer to inspect the folder. Note the free space on its drive in File Explorer &amp;gt; This PC.&lt;/p&gt;

&lt;p&gt;If you normally use &lt;code&gt;python -m pip&lt;/code&gt; inside an activated virtual environment, use that same prefix for every command here. If neither &lt;code&gt;py&lt;/code&gt; nor &lt;code&gt;python&lt;/code&gt; identifies the Python you use, stop and locate that installation rather than running whichever pip happens to be found first.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://pip.pypa.io/en/stable/cli/pip_cache/" rel="noopener noreferrer"&gt;pip cache command reference&lt;/a&gt; lists the inspection and maintenance commands. Keep the interpreter prefix consistent throughout this task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose a targeted removal or a full purge
&lt;/h2&gt;

&lt;p&gt;Close or finish running pip installations before deleting cache entries. Your choice should follow the problem you measured: one unwanted cached build and a large collection of reusable downloads are different situations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Remove cached wheels for one package
&lt;/h3&gt;

&lt;p&gt;For a specific package, first inspect matching wheel entries. This example uses setuptools; substitute the package you actually intend to inspect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="kd"&gt;list&lt;/span&gt; &lt;span class="kd"&gt;setuptools&lt;/span&gt;
&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="kd"&gt;remove&lt;/span&gt; &lt;span class="kd"&gt;setuptools&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Removal has no built-in undo. It removes matching cached wheels, so a later installation may need to download or build the package again. Existing installed packages remain separate from these cached copies. Cancel your plan before the second command if you need to retain those cached files.&lt;/p&gt;

&lt;p&gt;Targeted wheel removal does not clear pip's HTTP cache. If the remaining size is mostly HTTP data, deleting wheels for one package will not recover all of it. Avoid using a broad wildcard just to make the reported removal count larger.&lt;/p&gt;

&lt;h3&gt;
  
  
  Purge pip's reusable cache
&lt;/h3&gt;

&lt;p&gt;To remove all wheel and HTTP cache files managed by this operation, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="kd"&gt;purge&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no built-in rollback, and these command-line deletions do not use the normal Recycle Bin workflow. Future installations may have to download files or rebuild wheels. Before purging, make sure required package sources and credentials are available; postpone it if you need those cached files for upcoming work without reliable network access.&lt;/p&gt;

&lt;p&gt;Pip does not provide a restore command for the exact deleted cache. It can create new entries through later installation activity, which is different from recovering the old files. Do not reinstall your environments simply to refill the cache.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check what changed
&lt;/h2&gt;

&lt;p&gt;Run the same inspection commands again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="nb"&gt;dir&lt;/span&gt;
&lt;span class="kd"&gt;py&lt;/span&gt; &lt;span class="na"&gt;-m &lt;/span&gt;&lt;span class="kd"&gt;pip&lt;/span&gt; &lt;span class="kd"&gt;cache&lt;/span&gt; &lt;span class="kd"&gt;info&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compare the cache size and the drive's free space with the values you recorded. Use the command result and actual storage figures, not an assumed number of gigabytes that cleanup should recover.&lt;/p&gt;

&lt;p&gt;A small remaining folder or a quickly returning cache does not necessarily indicate an error. Later downloads can populate it again. When judging the result, avoid installing packages at the same time as measuring reclaimed space.&lt;/p&gt;

&lt;p&gt;If a purge reports an error, save the message and examine the path before doing anything broader. A permissions problem is not permission to delete a whole user profile or change ownership of every AppData folder. Confirm the account and stop concurrent installs first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand wheels and HTTP responses
&lt;/h2&gt;

&lt;p&gt;Pip caches HTTP responses and reusable locally built wheels. A wheel is a package distribution used during installation; a cached copy is separate from the copy installed into an environment.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://pip.pypa.io/en/stable/topics/caching/" rel="noopener noreferrer"&gt;pip caching guide&lt;/a&gt; explains both categories and their different removal behavior. The internal directory structure can change across pip versions, which is another reason to use pip's own commands rather than picking unfamiliar subfolders to delete.&lt;/p&gt;

&lt;p&gt;Do not confuse the cache with project code, datasets, model files, or a virtual environment. Those can be large too, but they have different owners and recovery requirements. Seeing Python-related names is not enough to establish that a folder is disposable pip cache.&lt;/p&gt;

&lt;p&gt;For the same reason, this procedure does not clean Conda's package cache or remove unused environments. If you use more than one package manager, identify which one owns the space you measured.&lt;/p&gt;

&lt;h2&gt;
  
  
  Multiple environments do not always mean multiple caches
&lt;/h2&gt;

&lt;p&gt;Check &lt;code&gt;cache dir&lt;/code&gt; using the interpreter associated with each environment you want to investigate. Two environments can report the same cache directory. In that case, purging through both does not produce two independent sets of savings.&lt;/p&gt;

&lt;p&gt;Conversely, a configured cache path can differ between setups. Record the path before each operation, and do not treat a successful cleanup for one Python installation as proof that every development tool's cache is empty.&lt;/p&gt;

&lt;p&gt;Keep environment removal outside this task. Deleting an environment removes its installed packages and creates a reconstruction problem; clearing pip cache leaves those installed packages in place. Preserve project requirements and other dependency records regardless of your cleanup choice.&lt;/p&gt;

&lt;p&gt;For a wider view of system-drive usage, the &lt;a href="https://www.aicleandisk.pro/en/blog/how-to-clean-up-and-free-space-on-windows" rel="noopener noreferrer"&gt;Windows cleanup guide&lt;/a&gt; offers other categories to inspect. If you also use JavaScript tools, the &lt;a href="https://www.aicleandisk.pro/en/blog/npm-cache-how-to-clear-it-on-windows" rel="noopener noreferrer"&gt;npm cache guide&lt;/a&gt; covers their separate commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep caching unless you have a reason to change it
&lt;/h2&gt;

&lt;p&gt;Pip's &lt;code&gt;--no-cache-dir&lt;/code&gt; option disables caching for an operation. It is not required to clear existing cached files, and routinely disabling caching can cause repeated downloads and builds.&lt;/p&gt;

&lt;p&gt;Decide based on your workflow: a one-time purge can recover space now, while retaining caching can reduce repeated work later. Do not add cache-disabling flags to every project just because one cleanup was useful.&lt;/p&gt;

&lt;p&gt;If the cache keeps becoming large, compare its measured growth with other Python storage before setting a schedule. An installed environment or a dataset may be the larger recurring cost, and purging pip cannot recover that unrelated space.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reviewing Python caches with AiCleanDisk Pro
&lt;/h2&gt;

&lt;p&gt;I'm the developer of &lt;a href="https://www.aicleandisk.pro/en" rel="noopener noreferrer"&gt;AiCleanDisk Pro&lt;/a&gt;. It includes pip cache in its auto-clean items, with developer items behind Show all items. Each item shows a risk level and asks for confirmation before cleaning. System-drive scanning and auto clean, except AI auto-clean, are free; other-drive scanning, AI analysis, AI auto-clean items, and folder moving require a license, paid once without automatic renewal. On my own machine, overall cleaning reclaimed about 14 GB and folder migration freed about 80 GB on C:, mostly caches, Temp and installed software; these are whole-machine results, not savings from pip cache alone or a guarantee for another PC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftrzruf7igxjbjajjpcyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftrzruf7igxjbjajjpcyq.png" alt="AiCleanDisk Pro folder scan showing sizes and cleanup advice" width="800" height="477"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdfza0u8qweacomtq8zrw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdfza0u8qweacomtq8zrw.png" alt="AiCleanDisk Pro migration review showing folders selected for moving to another NTFS drive" width="800" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
