[Conda] Error: CondaError — Cannot link a source that does not exist — How to Fix It

Summary

The CondaError: Cannot link a source that does not exist occurs when Conda tries to create links from its package cache (pkgs/) to an environment, but the required package files are missing or corrupted. This typically happens after interrupted installations, antivirus interference, or manual deletion of cached files. Cleaning the Conda cache and reinstalling the affected packages resolves the issue.

Context

Conda stores all downloaded packages in a central cache folder (pkgs/) and links them into individual environments when needed. During installation, Conda validates and links binaries from this cache. If files are missing, incomplete, or locked by the operating system, the linking process fails. The problem is common after forced shutdowns, cancelled installs, or partial upgrades. It can appear across all platforms — Windows, macOS, and Linux — especially when filesystem permissions or antivirus programs interfere with file operations.

Probable Cause

  • Incomplete or interrupted package download or extraction.
  • Corrupted or missing package folders in ~/.conda/pkgs/ or C:\Users\\Anaconda3\pkgs\.
  • Antivirus or indexing software deleting temporary Conda files.
  • File permission or lock preventing Conda from accessing cache contents.
  • Manual deletion of cached files that Conda still references in environments.

Quick Fix

Follow these steps to clean the cache and reinstall cleanly:

  1. Remove incomplete or corrupted cached packages:
conda clean --packages --tarballs --yes
  1. If the error persists, fully clear all cached data:
conda clean --all
  1. Inspect the package cache directory for missing or broken files:
# Windows
C:\Users\\Anaconda3\pkgs\

# Linux/macOS
~/.conda/pkgs/
  1. If you find a corrupted package folder (e.g. numpy-1.23.1-py310h...), delete it manually.
  2. Update Conda itself to refresh internal metadata:
conda update conda
  1. Reinstall the affected package:
conda install 
  1. If the error happens during an environment update, rebuild the environment from scratch:
conda remove -n  --all
conda create -n  python=3.10 

Full Example

A user runs:

conda install pandas

and receives:

CondaError: Cannot link a source that does not exist: C:\Users\John\Anaconda3\pkgs\pandas-1.5.0-py310h...

They clean incomplete package data:

conda clean --packages --tarballs --yes

After retrying the install, the error persists, so they perform a full cache reset:

conda clean --all
conda install pandas

The package installs successfully — Conda re-downloads the missing files and links them correctly.

Pitfalls & Debug

  • Symptom: Error repeats for multiple packages → Fix: Delete entire pkgs/ folder manually, then retry.
  • Symptom: Antivirus blocks writes in cache folder → Fix: Add the Anaconda folder to antivirus exclusions.
  • Symptom: “LinkError: post-link script failed” → Fix: Run conda clean --all and reinstall.
  • Symptom: File permission denied → Fix: Run Conda as administrator or adjust directory ownership.
  • Symptom: Environment breaks after forced shutdown → Fix: Recreate it using conda create for consistency.

Validation & Next Steps

After reinstalling, verify Conda’s cache integrity and environment state:

conda list
conda info

If installations complete without linking errors, your cache and filesystem are healthy. Avoid interrupting Conda operations and ensure sufficient disk space and permissions for smoother installs.

Sources

Anaconda Documentation — Troubleshooting package cache errors
Stack Overflow — “CondaError: Cannot link a source that does not exist” solutions
conda-forge Wiki — package cache management and linking behavior
Anaconda Community Forum — cache corruption and recovery discussions

Labels: Tool/Conda, OS/Windows-macOS-Linux, Topic/Package-Linking