I have been working on some projects for long. For each project, I end up creating multiple virtual environments using pipenv
. Many of the virtualenvs I won't use for couple months, but I may resume work on them afterwards. Also, I do all this inside WSL2 Ubuntu and also with docker inside WSL2. So over the last few months, the size of my virtualenvs folder (located at \\wsl$\Ubuntu-20.04\home\mahesha999\.local\share\virtualenvs
) has grown to some 30+ GBs!!! And since all these are stored in Windows C:
drive, it's consuming a lot of space in the system C:
drive. For example, when I checked file sizes, the file C:\Users\mahesha999\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
is of whopping 63.5 GB!!! Also, the file C:\Users\mahesha999\AppData\Local\Docker\wsl\data\ext4.vhdx
is of size 19.1 GB. This has resulted in fast filling of my C:
drive. I was pondering on the solution for this. Here is what I thought of different options:
Since
pipfile.lock
file contains all dependencies freezed, I can go on to completely delete these virtual environments and then re-setup them withpipenv install
command whenever I wish to resume. However, some dependencies are installed from github and am not sure whetherpipenv install
can install them as well. Also, many times installing frompipenv
takes time, especially locking.I was guessing whether move wsl to another, possibly bigger and empty partition. But my Ubuntu is already 60 GB so, am unsure how much time it will take to backup tar and how smooth it will be given that my
C:
drive is already full. Also, it will still be consuming space on my SSD.I was thinking of some solution that will let me free some space on my SSD and at the same time allow me to get back to the setup quickly. I was thinking if it is possible to copy unused environments in the directory
\\wsl$\Ubuntu-20.04\home\mahesha999\.local\share\virtualenvs
to say some external hard disk and paste it back to the same directory when I am to resume work on corresponding projects.
Can you please share how do you handle this issue? What you prefer or if there is some standard solution which am completely missing?
PS: I believe this problem exists even in plain Windows or Ubuntu environment without WSL. Also pipenv uses virtualenv under the hood.