Fundamentals 7 min read

Speed Up Conda and pip in China: 2026 Guide to Configuring Domestic Mirrors

This guide explains why the default Conda and pip sources are slow in China, shows how to check current settings, switch to Tsinghua mirrors for both Conda and pip, verify the configuration, and provides additional tips such as using mamba, creating isolated environments, and avoiding common AI‑project pitfalls.

Code of Duty
Code of Duty
Code of Duty
Speed Up Conda and pip in China: 2026 Guide to Configuring Domestic Mirrors

Why Switch Mirrors?

By default Conda pulls packages from overseas repositories and pip uses the official PyPI source, which leads to extremely slow downloads, SSL errors, timeouts, interrupted installations, and unresolved packages when the network is poor, especially for AI projects with many dependencies.

Check Current Conda Mirror

Open a terminal (CMD, PowerShell, or Anaconda Prompt) and run: conda config --show channels If the output contains defaults, the configuration is still using the official overseas source.

Switch to Tsinghua Conda Mirror

Execute the following commands to replace the existing channels with Tsinghua mirrors and show channel URLs:

conda config --remove-key channels
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
conda config --set show_channel_urls yes

Configure conda‑forge

Many AI packages are hosted on the conda-forge channel. Add it with:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

Verify Success

Run: conda info If the output shows mirrors.tuna.tsinghua.edu.cn, the mirror configuration is successful.

Configure pip Mirror

Set the global pip index to the Tsinghua mirror:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Verify with:

pip config list

Temporary pip Mirror Usage

If you prefer not to modify the global configuration, install requirements with an explicit index URL:

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

Recommended Stable AI Development Stack

For modern AI projects, the author recommends:

Python 3.11

Conda

pip using the Tsinghua mirror

This combination offers noticeably higher stability than the default environment.

Create Isolated Development Environments

Create a separate environment per project to avoid dependency conflicts: conda create -n longgang python=3.11 -y Activate it with: conda activate longgang Then install project dependencies:

pip install -r requirements.txt

Install mamba

mamba

is a high‑performance drop‑in replacement for Conda that resolves dependencies much faster: conda install mamba -n base -c conda-forge Future installations can use:

mamba install <package>

Common AI Project Pitfalls

The most frequent error is: ERROR: No matching distribution found Typical causes include:

Python version too low (many AI SDKs require Python >= 3.10).

Out‑dated pip; upgrade with python -m pip install --upgrade pip.

Incorrect version specifiers in requirements.txt, e.g., mistralai==1.10.1 which may not exist.

Check available versions with:

pip index versions mistralai

Author's Recommended Setup

For Windows or Linux AI projects, the author uses the following stack:

Windows / Linux
Python 3.11
Conda
Tsinghua Conda mirror
Tsinghua pip mirror
FastAPI
uvicorn
LiteLLM
PostgreSQL
Redis

This configuration provides far higher stability than the default environment.

Final Summary

If you are developing AI applications with FastAPI, LangChain, RAG, or large‑model services, the first step should be to configure domestic mirrors for Conda and pip. Doing so eliminates about 80% of common installation issues.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonAIcondapipmirrorTsinghuamamba
Code of Duty
Written by

Code of Duty

"Code of Duty" — Every line of code has its own mission. We avoid shortcuts and quick fixes, focusing on authentic coding reflections and the joys and challenges of technical growth. The journey of learning matters more than any destination. Join us as we humbly forge ahead in the world of code.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.