← Back to archive
Programming Notes

Quickly Install the transformers Source Code via Tsinghua's pip Mirror

Because of network issues, downloading the source and installing directly is extremely painful, so you can first install via a mirror.

For example: pip install transformers -i https://pypi.tuna.tsinghua.edu.cn/simple

This way all the dependencies are installed.

Then pip uninstall transformers

Then git clone https://github.com/huggingface/transformers.git

In that directory, run python setup.py install and you're done.

*Even after long-term configuration:

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

installing from source may still go to PyPI automatically, so the mirror cannot be used.

Written by Master Sanfu on March 19, 2023. Please credit the source if you share.

Translation Notice: This English version was translated with AI assistance. Specialized, historical, religious, or culturally sensitive terms may contain nuances, inaccuracies, or debatable wording. In case of ambiguity or discrepancy, the original Chinese text shall prevail.