whisper stepped on the pit! Multi-environment Python switching ERROR: Could not find a version that satisfies the requirement tiktoken==0.3.1

When playing whisper speech recognition, I stepped on a lot of pitfalls when installing the environment, and encountered many problems:
How does whisper correspond to the Python version?
How can I see a list of native Python environments?
How to switch between multiple environments in Python?
How to switch pip's default environment?
How to solve the slow download of PyTorch?
The solution to this error: pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
Here is a summary.

Question 1: Matching of Python environment version and whisper

The original environment used was Python3.6, and various errors were reported, such as:
ERROR: Could not find a version that satisfies the requirement tiktoken==0.3.1(from openai-whisper) (from versions: none)
ERROR: No matching distribution found for tiktoken==0.3.1

insert image description here
See some explanations of whisper on https://pypi.org/project/openai-whisper/ website later.
Discovery: We use Python 3.9.9 and PyTorch 1.10.1 to train and test our models, but the codebase is expected to be compatible with Python 3.8-3.10 and recent PyTorch versions.

insert image description here
I remembered that there are many Python environments on this machine, so I quickly checked the current operating environment and entered the command:

Python --version

Sure enough, the current running Python environment is 3.6.5,
and the python version environment is queried through the "where python" command, as follows

insert image description here
Switch python environment:
1. win+R input:

Sysdm.cpl

insert image description here
2. Enter the environment variable configuration

insert image description here
3. Double-click path to enter the environment variable editing page

insert image description here
4. Put the Python environment that needs to be switched before the original Python environment path by "moving up" (the machine originally used Anaconda)

insert image description here
Note (very important): When moving up the path, the \Scripts file under the path must be moved up, as shown in the figure above. Otherwise, the Python environment has been switched, but the default environment of pip is still the original. When installing the package through the pip command, the package will be installed in the original Python environment.

5. After the change is completed, check the current pip through the following command line:

pip -V

Successfully changed!
insert image description here

Question 2: How to solve the slow download of PyTorch?

Install PyTorch through pip, enter https://pytorch.org/, select the required configuration, and find the corresponding installation command, as shown in the figure:
insert image description here

pip3 install torch torchvision torchaudio

It is measured that if the direct download is performed, the speed is very slow, only a few k per second. At this time, if the foreign mirror source is replaced with a domestic one, the speed will skyrocket! The current domestic mirror source addresses are:

# pip国内镜像源:

# 阿里云	http://mirrors.aliyun.com/pypi/simple/
# 中国科技大学 	https://pypi.mirrors.ustc.edu.cn/simple/
# 豆瓣	 http://pypi.douban.com/simple
# Python官方	 https://pypi.python.org/simple/
# v2ex	 http://pypi.v2ex.com/simple/
# 中国科学院 	http://pypi.mirrors.opencas.cn/simple/
# 清华大学	 https://pypi.tuna.tsinghua.edu.cn/simple/

Add the parameter -i [mirror source address] to the original command to replace the foreign source with the domestic source, namely:

pip3 install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple

Install quickly, haha!
insert image description here

Question 3: Error reporting solution pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

When executing the following command, an error is reported

pip install git+https://github.com/openai/whisper.git

insert image description here

insert image description here
It can be seen that the numba installation failed, and this problem occurred after re-executing "pip install git+https://github.com/openai/whisper.git".
insert image description here

Solution:
Enter the following command:

pip --default-timeout=100 install library name -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

Library name: Fill in whatever library reports an error. In this example, you should fill in numba
installation success!

insert image description here


This time I had a first experience with the whisper open source audio-to-text model. The above is the detour I took in this attempt. I hope it will be helpful to readers. I will introduce the overall installation and operation of whisper in the next blog~

Guess you like

Origin blog.csdn.net/weixin_43401024/article/details/129652575