[Conda] Error: CondaError — Missing write permissions to Conda packages directory — How to Fix It
Summary
The CondaError: Missing write permissions to Conda packages directory occurs when Conda cannot write to its package cache or environment directories. This typically happens on system-wide or multi-user installations, where directories like /opt/anaconda3/pkgs or C:\ProgramData\Anaconda3\pkgs are protected. Running Conda with elevated privileges or configuring it to use user-owned directories resolves the issue safely.
Context
Conda stores downloaded package archives in a global cache (pkgs/) shared across environments. When that cache or the environment location is read-only, Conda fails to link or unpack new packages. This problem often affects users of shared systems, managed corporate setups, or environments created under administrative privileges. On Windows, group policies and antivirus locks can also block access; on Linux and macOS, system installs in /opt/ or /usr/local/ are frequent culprits.
Probable Cause
- System-wide Conda installation without write permissions for your user account.
- Attempting to install or update packages without administrative rights.
- Corporate or IT-managed permissions blocking modifications in Conda directories.
- Environment or cache created by another user on a shared machine.
- Read-only or locked package directory due to antivirus or filesystem protection.
Quick Fix
Apply one of the following methods to restore write access:
- Check which Conda directories are being used:
conda info | grep -E 'base environment|pkgs_dirs'
- If the listed
pkgs_dirspath is protected (e.g./opt/anaconda3/pkgsorC:\ProgramData\Anaconda3\pkgs), choose one of these solutions:
- Option 1 — Run Conda with elevated privileges:
# Windows
# Open Anaconda Prompt → Right-click → “Run as Administrator”
# Linux/macOS
sudo conda install
- Option 2 — Change ownership of the Conda directories:
# Linux/macOS
sudo chown -R $(whoami) $CONDA_PREFIX
- Option 3 — Use user-owned directories for packages and environments:
conda config --add pkgs_dirs ~/conda_pkgs
conda config --add envs_dirs ~/conda_envs
- Option 4 — Create a new local environment:
conda create -n myenv python=3.11
conda activate myenv
conda install numpy pandas
- Option 5 — Clean and retry after fixing permissions:
conda clean --all
conda update conda
Full Example
A user attempts:
conda install scikit-learn
and receives:
CondaError: Missing write permissions to Conda packages directory
PermissionError: [Errno 13] Permission denied: '/opt/anaconda3/pkgs/'
They check the current package cache:
conda info | grep pkgs_dirs
# pkgs_dirs : /opt/anaconda3/pkgs
Since it’s a protected directory, they configure Conda to use their own user path:
conda config --add pkgs_dirs ~/conda_pkgs
conda config --add envs_dirs ~/conda_envs
After retrying, the package installs successfully without permission errors.
Pitfalls & Debug
- Symptom: Conda still fails even after using
sudo→ Fix: The environment may belong to another user; recreate it under your account. - Symptom: Error appears intermittently → Fix: Antivirus may be locking files; whitelist Conda directories.
- Symptom: No
pkgs_dirsentry inconda info→ Fix: Manually add writable paths viaconda config. - Symptom: Multi-user cluster → Fix: Always use local
~/conda_pkgsand~/conda_envspaths. - Symptom: Persistent read-only flag → Fix: Move Conda installation to your home directory.
Validation & Next Steps
After making changes, verify that your package directories are writable:
conda info | grep pkgs_dirs
touch $(conda info --base)/pkgs/testfile && echo "Write test successful"
If the write succeeds, Conda will now install and update packages normally. Keep user-owned directories for environments to avoid future permission conflicts.
Sources
Anaconda Documentation — Conda troubleshooting guide
Stack Overflow — “Missing write permissions to Conda packages directory” discussions
conda-forge Wiki — user-owned environment setup
Anaconda Community — permission and environment configuration threads