修改TMPDIR仍触发Errno 28设备无剩余空间问题求助
TMPDIR Didn't Fix Your Conda Installation Error Your root partition (/) is nearly full (99% used), and while redirecting TMPDIR to /media/sd makes sense for temporary files, Conda has a few other critical storage spots that are still tied to your cramped root drive. Let’s break down the likely issues and how to fix them:
1. Conda’s Package Cache Is Still Clogging the Root Partition
By default, Conda stores downloaded packages in ~/.conda/pkgs — which lives on your root partition (/) since your home folder is part of /dev/root. Even if you set TMPDIR, Conda will first download packages to this cache, filling up your root drive before it ever touches the temporary directory.
Fixes:
- Clear existing cache immediately: Free up space by deleting unused packages and cached files:
conda clean -a - Move the cache to
/media/sd: Redirect Conda’s package storage to your spacious SD partition:# Create a dedicated cache folder on the SD partition mkdir -p /media/sd/conda_pkgs # Tell Conda to use this new location for packages conda config --add pkgs_dirs /media/sd/conda_pkgs
2. Your Conda Virtual Environment Lives on the Root Partition
If your virtual environment was created in the default location (like ~/miniconda3/envs or ~/.conda/envs), it’s still residing on the root partition. Installing Bokeh requires writing files directly to the environment directory — which will fail if / is full, regardless of your TMPDIR setting.
Fixes:
- Create a new environment on
/media/sd: Install Bokeh directly into an environment on the SD partition:conda create --prefix /media/sd/my_bokeh_env bokeh - Migrate an existing environment: If you want to keep your current setup, export it and recreate it on the SD partition:
# Export your environment configuration to a YAML file conda env export > environment.yml # Recreate the environment in the new location conda env create --prefix /media/sd/my_bokeh_env -f environment.yml
3. Conda Isn’t Recognizing Your TMPDIR Setting
Sometimes Conda ignores the system’s TMPDIR variable and uses its own configured temporary directory instead.
Fixes:
- Check Conda’s current tmp_dir configuration:
conda config --show tmp_dir - Set Conda’s tmp_dir to
/media/sd:# Create a temporary directory on the SD partition mkdir -p /media/sd/conda_tmp # Configure Conda to use this directory for temp files conda config --set tmp_dir /media/sd/conda_tmp - Or specify
TMPDIRinline when running Conda:TMPDIR=/media/sd/conda_tmp conda install bokeh
Quick Checks to Confirm Fixes
- Verify
TMPDIRis set correctly in your terminal:echo $TMPDIR - Ensure Conda has write permissions for the new directories on
/media/sd:ls -ld /media/sd/conda_pkgs /media/sd/conda_tmp
内容的提问来源于stack exchange,提问作者Huy Vinh

