开启代理后无法正常下载Python包提示:
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))
不开启代理下载过程很慢速度就几百k,如何解决。
首先,需要一个VPN,解决办法详情如下:
解决办法:
查看你的代理接口号码:以我的为例就是60033
以安装Pytorch为例
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
报错如下:
(.venv) D:\多模态实体识别\adaseq git:[master]
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121
Looking in indexes: https://download.pytorch.org/whl/cu121
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /whl/cu121/torch/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /whl/cu121/torch/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /whl/cu121/torch/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /whl/cu121/torch/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError(0, 'Error'))': /whl/cu121/torch/
ERROR: Could not find a version that satisfies the requirement torch==2.2.1 (from versions: none)
ERROR: No matching distribution found for torch==2.2.1
[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip
解决途径在安装的命令中做出如下修改:
添加代理:
pip -- proxy 127.0.0.1:60033
总体命令如下:
pip --proxy 127.0.0.1:60033 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu121
结果如图:
(.venv) D:\多模态实体识别\adaseq git:[master]
pip --proxy 127.0.0.1:60033 install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu121
Looking in indexes: https://download.pytorch.org/whl/cu121
Collecting torch==2.2.2
Downloading https://download.pytorch.org/whl/cu121/torch-2.2.2%2Bcu121-cp38-cp38-win_amd64.whl (2454.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 GB 576.4 kB/s eta 0:00:00
Collecting torchvision==0.17.2
Downloading https://download.pytorch.org/whl/cu121/torchvision-0.17.2%2Bcu121-cp38-cp38-win_amd64.whl (5.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 6.0 MB/s eta 0:00:00
Collecting torchaudio==2.2.2
Downloading https://download.pytorch.org/whl/cu121/torchaudio-2.2.2%2Bcu121-cp38-cp38-win_amd64.whl (4.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.1/4.1 MB 2.9 MB/s eta 0:00:00
Requirement already satisfied: filelock in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torch==2.2.2) (3.15.4)
Requirement already satisfied: typing-extensions>=4.8.0 in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torch==2.2.2) (4.12.2)
Requirement already satisfied: sympy in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torch==2.2.2) (1.13.0)
Requirement already satisfied: networkx in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torch==2.2.2) (3.1)
Requirement already satisfied: jinja2 in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torch==2.2.2) (3.1.4)
Requirement already satisfied: fsspec in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torch==2.2.2) (2024.2.0)
Requirement already satisfied: numpy in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torchvision==0.17.2) (1.24.4)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from torchvision==0.17.2) (10.4.0)
Requirement already satisfied: MarkupSafe>=2.0 in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from jinja2->torch==2.2.2) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in d:\多模态实体识别\adaseq\.venv\lib\site-packages (from sympy->torch==2.2.2) (1.3.0)
Installing collected packages: torch, torchvision, torchaudio
Attempting uninstall: torch
Found existing installation: torch 2.3.0
Uninstalling torch-2.3.0:
Successfully uninstalled torch-2.3.0
Attempting uninstall: torchvision
Found existing installation: torchvision 0.18.0
Uninstalling torchvision-0.18.0:
Successfully uninstalled torchvision-0.18.0
Attempting uninstall: torchaudio
Found existing installation: torchaudio 2.3.0
Uninstalling torchaudio-2.3.0:
Successfully uninstalled torchaudio-2.3.0
Successfully installed torch-2.2.2+cu121 torchaudio-2.2.2+cu121 torchvision-0.17.2+cu121
[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip
问题成功解决,如果有其他问题可以继续交流。