for Chinese users, replace Tsinghua pip mirrors with Alibaba Cloud to avoid 403 http error

This commit is contained in:
josc146 2024-03-13 21:37:35 +08:00
parent 333619839a
commit 5692579f56
5 changed files with 8 additions and 8 deletions

View File

@ -227,12 +227,12 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages") ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages")
installScript := python + " ./backend-python/get-pip.py -i https://pypi.tuna.tsinghua.edu.cn/simple --no-warn-script-location\n" + installScript := python + " ./backend-python/get-pip.py -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" +
python + " -m pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url https://download.pytorch.org/whl/cu117 --no-warn-script-location\n" + python + " -m pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url https://download.pytorch.org/whl/cu117 --no-warn-script-location\n" +
python + " -m pip install -r ./backend-python/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --no-warn-script-location\n" + python + " -m pip install -r ./backend-python/requirements.txt -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" +
"exit" "exit"
if !cnMirror { if !cnMirror {
installScript = strings.Replace(installScript, " -i https://pypi.tuna.tsinghua.edu.cn/simple", "", -1) installScript = strings.Replace(installScript, " -i https://mirrors.aliyun.com/pypi/simple", "", -1)
} }
err = os.WriteFile(a.exDir+"install-py-dep.bat", []byte(installScript), 0644) err = os.WriteFile(a.exDir+"install-py-dep.bat", []byte(installScript), 0644)
if err != nil { if err != nil {
@ -242,7 +242,7 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
} }
if cnMirror { if cnMirror {
return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_without_cyac.txt", "-i", "https://pypi.tuna.tsinghua.edu.cn/simple") return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_without_cyac.txt", "-i", "https://mirrors.aliyun.com/pypi/simple")
} else { } else {
return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_without_cyac.txt") return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_without_cyac.txt")
} }

View File

@ -1,7 +1,7 @@
echo $@ echo $@
if [[ ${cnMirror} == 1 ]]; then if [[ ${cnMirror} == 1 ]]; then
export PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple" export PIP_INDEX_URL="https://mirrors.aliyun.com/pypi/simple"
if grep -q "mirrors.aliyun.com" /etc/apt/sources.list; then if grep -q "mirrors.aliyun.com" /etc/apt/sources.list; then
echo "apt cnMirror already set" echo "apt cnMirror already set"
else else

View File

@ -96,7 +96,7 @@
"Python dependencies are incomplete, would you like to install them?": "Pythonの依存関係が不完全です、インストールしますか", "Python dependencies are incomplete, would you like to install them?": "Pythonの依存関係が不完全です、インストールしますか",
"Install": "インストール", "Install": "インストール",
"This is the latest version": "これは最新バージョンです", "This is the latest version": "これは最新バージョンです",
"Use Tsinghua Pip Mirrors": "清華大学Pipミラーサーバーを使用", "Use Alibaba Cloud Pip Mirrors": "Alibaba Cloud Pipミラーサーバーを使用",
"Model Config Exception": "モデル設定例外", "Model Config Exception": "モデル設定例外",
"Use Gitee Updates Source": "Gitee更新ソースを使用", "Use Gitee Updates Source": "Gitee更新ソースを使用",
"Use Custom CUDA kernel to Accelerate": "カスタムCUDAカーネルを使用して加速", "Use Custom CUDA kernel to Accelerate": "カスタムCUDAカーネルを使用して加速",

View File

@ -96,7 +96,7 @@
"Python dependencies are incomplete, would you like to install them?": "Python依赖缺失, 是否安装?", "Python dependencies are incomplete, would you like to install them?": "Python依赖缺失, 是否安装?",
"Install": "安装", "Install": "安装",
"This is the latest version": "已是最新版", "This is the latest version": "已是最新版",
"Use Tsinghua Pip Mirrors": "使用清华大学Pip镜像源", "Use Alibaba Cloud Pip Mirrors": "使用阿里云Pip镜像源",
"Model Config Exception": "模型配置异常", "Model Config Exception": "模型配置异常",
"Use Gitee Updates Source": "使用Gitee更新源", "Use Gitee Updates Source": "使用Gitee更新源",
"Use Custom CUDA kernel to Accelerate": "使用自定义CUDA算子加速", "Use Custom CUDA kernel to Accelerate": "使用自定义CUDA算子加速",

View File

@ -246,7 +246,7 @@ const Settings: FC = observer(() => {
} }
{ {
commonStore.settings.language === 'zh' && commonStore.platform !== 'linux' && commonStore.settings.language === 'zh' && commonStore.platform !== 'linux' &&
<Labeled label={t('Use Tsinghua Pip Mirrors')} flex spaceBetween content={ <Labeled label={t('Use Alibaba Cloud Pip Mirrors')} flex spaceBetween content={
<Switch checked={commonStore.settings.cnMirror} <Switch checked={commonStore.settings.cnMirror}
onChange={(e, data) => { onChange={(e, data) => {
commonStore.setSettings({ commonStore.setSettings({