How to Clear Pip Cache in Linux (2024)

How to Clear Pip Cache in Linux (1)

You can built-in cache functionality in pip that plays its role by reducing the time while doing duplicate downloads and builds.

But you may find a situation where the package won't be updated to the latest version as the cache for the older version exists on your system.

And in this tutorial, I will walk you through how you can clear the pip cache.

How to clear Pip cache

First, let's have a look at how you can find the cache size of pip.

To do so, all you have to do is execute the following command:

pip cache info
How to Clear Pip Cache in Linux (2)

And as you can see, the package index cache is 101 MB in my system whereas 17.1 MB of the locally built cache by wheels.

Similarly, if you want to find out the cache of the individual packages, you can use the following:

pip cache list
How to Clear Pip Cache in Linux (3)

And if you want to find the directory where the cache resides, you can use the following command:

pip cache dir
How to Clear Pip Cache in Linux (4)

Now, let's have a look at how you can remove the pip cache.

Remove Pip cache

Once you know which package is taking the most space with the unnecessary cache, you can refer to the given ways to remove the pip cache:

  • Using the pip remove (used to remove individual packages from cache)
  • Using the pip purge (used to remove every package from the cache)

So let's start with how you can remove individual packages from the pip cache.

Removing individual packages from the Pip cache

To remove the individual packages from the cache, you will have to execute the pip remove command in the following manner:

pip remove [pattern]

Here, if you want to remove a specific package from the cache, you can append the package name instead of [pattern] as shown:

pip cache remove [package_name]

So let's say I want to remove the cache of the package named moviepy, then I will be using the following:

pip cache remove moviepy
How to Clear Pip Cache in Linux (5)

Similarly, if you want to remove every package from the cache using the pip cache remove using the * wildcard:

pip cache remove *

Remove every package from the Pip cache

You may encounter such a situation where you have to remove everything from the pip cache and for those times, you have pip cache purge.

To use the purge with the pip cache, all you have to do is execute the following command:

pip cache purge
How to Clear Pip Cache in Linux (6)

And now if you check the cache list, it will show you something like this:

How to Clear Pip Cache in Linux (7)

Remove the pip cache manually

If you don't have access to the pip cache command, you can also remove the pip cache directory manually.

Here, I will be giving the solution for both Linux and Windows so execute the command accordingly.

For Linux:

sudo rm -r ~/.cache/pipsudo rm -rf /root/.cache/pip

For Windows:

rd /s /q "%appdata%\local\pip\cache"

Bonus: Install the pip packages without cache

So if you want to install the pip packages without cache, you will have to use the --no-cache-dir flag while installing the pip package:

pip install package_name --no-cache-dir

So let's say I want to install django-cricket-statistics without cache then, I will be using the following:

pip install django-cricket-statistics --no-cache-dir

Pretty cool. Isn't it?

Want to learn Python for free? Let me help

If you are just getting started and looking for some free resources to learn python, we have shortlisted some of the best courses and e-books for you:

11 Free Courses and eBooks to Learn Python

Wondering how to learn Python for free? We list some of the best Python courses and books that you can use to learn Python online without spending any money.

How to Clear Pip Cache in Linux (8)Linux HandbookAnkush Das

How to Clear Pip Cache in Linux (9)

I hope you will find this guide helpful.

And if you have any issues, feel free to ask in the comments.

How to Clear Pip Cache in Linux (2024)
Top Articles
Airthings Resources - Articles, Research & News on Air Quality - Get it Here!
What’s the Difference Between Donation & Contribution for Nonprofits
Public Opinion Obituaries Chambersburg Pa
Housing near Juneau, WI - craigslist
Pangphip Application
Blanchard St Denis Funeral Home Obituaries
Voorraad - Foodtrailers
Collision Masters Fairbanks
Shorthand: The Write Way to Speed Up Communication
Slapstick Sound Effect Crossword
Rochester Ny Missed Connections
Amateur Lesbian Spanking
Ap Chem Unit 8 Progress Check Mcq
Skylar Vox Bra Size
Lonadine
Identogo Brunswick Ga
Les Schwab Product Code Lookup
Equibase | International Results
Golden Abyss - Chapter 5 - Lunar_Angel
Teacup Yorkie For Sale Up To $400 In South Carolina
Robert Deshawn Swonger Net Worth
Free Personals Like Craigslist Nh
R. Kelly Net Worth 2024: The King Of R&B's Rise And Fall
Nsa Panama City Mwr
Boise Craigslist Cars And Trucks - By Owner
Tuw Academic Calendar
1773x / >
Mississippi Craigslist
Publix Christmas Dinner 2022
Kleinerer: in Sinntal | markt.de
FSA Award Package
Davita Salary
Swimgs Yuzzle Wuzzle Yups Wits Sadie Plant Tune 3 Tabs Winnie The Pooh Halloween Bob The Builder Christmas Autumns Cow Dog Pig Tim Cook’s Birthday Buff Work It Out Wombats Pineview Playtime Chronicles Day Of The Dead The Alpha Baa Baa Twinkle
The Rise of "t33n leaks": Understanding the Impact and Implications - The Digital Weekly
Scat Ladyboy
oklahoma city community "puppies" - craigslist
American Bully Xxl Black Panther
3496 W Little League Dr San Bernardino Ca 92407
Compare Plans and Pricing - MEGA
Barber Gym Quantico Hours
Www Craigslist Com Brooklyn
Colorado Parks And Wildlife Reissue List
Sun Tracker Pontoon Wiring Diagram
Clausen's Car Wash
13 Fun & Best Things to Do in Hurricane, Utah
Go Nutrients Intestinal Edge Reviews
Sara Carter Fox News Photos
What is a lifetime maximum benefit? | healthinsurance.org
F9 2385
Amourdelavie
Thrift Stores In Burlingame Ca
Worlds Hardest Game Tyrone
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 6497

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.