Sometimes poetry
can fail to install packages because there is not enough space on the disk, Saying:
OSError
[Errno 122] Disk quota exceeded
Are there any ways of fixing this, (like uninstalling unnecessary dependencies, or optimizing space management) or is this something I’m just going to have to deal with…
REPL:
https://replit.com/@ErrorbotTHE2nd/Voice-Synthathizer-1
Hi @ErrorbotTHE2nd when I forked your Repl I saw the following resource usage:
I have the hacker plan on this account so maybe that’s the difference?
1 Like
That would be the problem. You only get 500MB with the free plan
2 Likes
I have 1024MB on free plan. This is either an issue with files that are then being deleted after the operation failed, or they have solved the issue
1 Like
This is becuse its the error when installing a package / multiple packages
P.S. I have recently learned that most of the space is being taken up by .git
folder:
~/Voice-Synthathizer-1$ du -sh .git
401M .git
UPDATE
Here’s a look at my folder usage!
~/Voice-Synthathizer-1$ du -h --max-depth=1 * .*
24K argparser.py
0 clean.sh
8.0K install.log
4.0K install.sh
16K main.py
38M models/pocketsphinx
38M models
4.0K output.mp3
340K poetry.lock
8.0K __pycache__
4.0K pyproject.toml
4.0K replit.nix
4.0K requirements.txt
1.2M test_two_speakers.mp3
5.6M test.wav
0 venv/include
74M venv/lib
88K venv/bin
74M venv
286M ./.cache
28K ./.config
4.0K ./.upm
401M ./.git
686M .
4.0K ../.nix-defexpr
...
you could reduce the .git size by running in shell (takes a while):
git gc --aggressive
3 Likes
I found a fix for this recently!
Basicly, if you using git
then use:
UMARismyname:
git gc --aggressive
After that, you need to remove ALL cache
as it can really build up after a while. To do this run:
rm -rf .cache/
There are the two main ways I leaned to fix this issue.
PS: Here is a script i made to fix this issue!
Script!
size_ext="M"
agressive=false # Agresivly delete files
verbosity=1 # 1 = Normal Output | 0 = Use log file
log_file="cleanup.log"
# Functions
usage() {
echo "Usage: $(basename $0) [-a -g (-q | -s SIZE)]"
}
print_error() {
local msg="$@" # Get all args
>&2 echo "$(basename $0): $msg"
exit 1
}
get_size() {
local path=$1
local block_size=$full_ext
if [[ $2 != "" ]]; then
block_size=$2
fi
read current_size _ < <(du "$path" --max-depth=0 --block-size=$full_ext )
# Extract the digets from the text (https://stackoverflow.com/a/36798723/13592230)
echo $current_size | sed -nE 's/(\d*)[A-Za-z]{1,3}$/\1/p'
}
to_lowercase() { tr "[[:upper:]]" "[[:lower:]]" <<< $1; }
# Error handling
trap "exit 0" EXIT
# Parse Arguments
while getopts 'al:qs:' opt; do
case "$opt" in
a) # Agressive
agressive=true
;;
l) # Log Output
log_file=$OPTARG
;;
q) # QUIET
verbosity=1
;;
s) # Block Size
first_char=$(to_lowercase ${OPTARG:0:1})
if [[ $first_char == "k" ||
$first_char == "m" ||
$first_char == "g" ||
$first_char == "t" ||
$first_char == "p" ||
$first_char == "e" ||
$first_char == "z" ||
$first_char == "y" ]]
then
size_ext="${OPTARG^^}"
else
print_error "--$opt: Invalid choice \"$OPTARG\""
fi
;;
?) # Invalid option
exit 1
;;
esac
done
# Main Code
# Clear the log file
> $log_file
# Get the full size extentions
full_ext="${size_ext}B"
# Get the current folder's staring size
starting_size=$(get_size .)
# Deleate Commit Refences
rm -rf .git/refs/original/
if [[ $agressive == true ]]; then
if [[ verbosity -gt 1 ]]; then
# Murslislly delete all cashed files
rm -rf .cache/
rm -rf __pycache__/
git prune --expire=now # Remove unreachable objects
git repack -a -d --depth=250 --window=250 # Compress objects
git gc --aggressive --prune=now # Collect garbage
git prune-packed
git reflog expire --expire=now --expire-unreachable=now --all # Remove commit refences
else
rm -rfv .cache/ >> "$log_file" 2>&1
rm -rfv __pycache__/ >> "$log_file" 2>&1
script -aqc "git prune --expire=now" $log_file > /dev/null 2>&1
script -aqc "git repack -a -d --depth=250 --window=250" $log_file > /dev/null 2>&1
script -aqc "git gc --aggressive --prune=now" $log_file > /dev/null 2>&1
script -aqc "git prune-packed" $log_file > /dev/null 2>&1
script -aqc "git reflog expire --expire=now --expire-unreachable=now --all" $log_file > /dev/null 2>&1
fi
else
if [[ verbosity -gt 1 ]]; then
# Delete semingly uneeded caches
rm -rf .cache/pip
rm -rf .cache/pypoetry
rm -rf __pycache__/
git prune
git repack
git gc --prune
git prune-packed
git reflog expire --expire-unreachable=now --expire=1.month.ago --all
else
rm -rfv .cache/pip >> "$log_file" 2>&1
rm -rfv .cache/pypoetry >> "$log_file" 2>&1
rm -rfv __pycache__/ >> "$log_file" 2>&1
script -aqc "git prune" $log_file > /dev/null 2>&1
script -aqc "git repack" $log_file > /dev/null 2>&1
script -aqc "git gc --prune" $log_file > /dev/null 2>&1
script -aqc "git prune-packed" $log_file > /dev/null 2>&1
script -aqc "git reflog expire --expire-unreachable=1.week.ago --expire=1.month.ago --all" $log_file > /dev/null 2>&1
fi
fi
new_size=$(get_size .)
saved_size=$((starting_size - new_size))
echo "You've saved $saved_size${size_ext}s of space!"
exit 0
1 Like
system
Closed
December 29, 2022, 11:09pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.