From 989aec441378e10c1ff3f0b98d10aa55efd20fa4 Mon Sep 17 00:00:00 2001 From: huangyuxin Date: Wed, 1 Dec 2021 06:26:57 +0000 Subject: [PATCH] optimize the setup.py and setup.sh --- docs/source/install.md | 19 ++++++++++---- requirements.txt | 6 ----- setup.cfg | 3 +++ setup.py | 58 ++++++++++++++++++++++++++++++++++++++++-- setup.sh | 2 +- tools/Makefile | 7 +---- 6 files changed, 75 insertions(+), 20 deletions(-) diff --git a/docs/source/install.md b/docs/source/install.md index d68b990d..1057242f 100644 --- a/docs/source/install.md +++ b/docs/source/install.md @@ -10,16 +10,25 @@ To avoid the trouble of environment setup, [running in Docker container](#runnin For user who working on `Ubuntu` with `root` privilege. -```python +```bash git clone https://github.com/PaddlePaddle/DeepSpeech.git -cd DeepSpeech -pip install -e . +cd PaddleSpeech +``` + +If you want to use the basic function of the repo, you can use: +```bash +pip install . +``` + +If you want to do the development, you can use: +``` +pip install -e .[develop] ``` For user who only needs the basic function of paddlespeech, using conda to do installing is recommended. You can go to [minicoda](https://docs.conda.io/en/latest/miniconda.html) to select a version and install it by yourself, or you can use the scripts below to install the last miniconda version. -```python +```bash pushd tools bash extras/install_miniconda.sh popd @@ -27,7 +36,7 @@ bash ``` After installing the conda, run the setup.sh to complete the installing process. -```python +```bash bash setup.sh ``` diff --git a/requirements.txt b/requirements.txt index 2ee60d3f..658e64c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,19 @@ ConfigArgParse coverage -distro editdistance g2p_en g2pM gpustat -GPUtil h5py inflect jieba jsonlines kaldiio librosa -llvmlite loguru matplotlib nara_wpe nltk -numba paddlespeech_ctcdecoders paddlespeech_feat pandas @@ -25,9 +21,7 @@ phkit Pillow praatio~=4.1 pre-commit -psutil pybind11 -pynvml pypi-kenlm pypinyin python-dateutil diff --git a/setup.cfg b/setup.cfg index 62545480..7bca47cc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,3 +7,6 @@ description-file = README.md [magformat] formatters=yapf + +[easy_install] +index-url=https://pypi.tuna.tsinghua.edu.cn/simple diff --git a/setup.py b/setup.py index a4ce181a..b8c6b3aa 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,58 @@ from setuptools.command.install import install HERE = Path(os.path.abspath(os.path.dirname(__file__))) +requirements = { + "install": [ + "editdistance", + "g2p_en", + "g2pM", + "h5py", + "inflect", + "jieba", + "jsonlines", + "kaldiio", + "librosa", + "loguru", + "matplotlib", + "nara_wpe", + "nltk", + "pandas", + "paddlespeech_ctcdecoders", + "paddlespeech_feat", + "praatio~=4.1", + "pypi-kenlm", + "pypinyin", + "python-dateutil", + "pyworld", + "resampy==0.2.2", + "sacrebleu", + "scipy", + "sentencepiece~=0.1.96", + "soundfile~=0.10", + "sox", + "soxbindings", + "textgrid", + "timer", + "tqdm", + "typeguard", + "visualdl", + "webrtcvad", + "yacs", + ], + "develop": [ + "ConfigArgParse", + "coverage", + "gpustat", + "phkit", + "Pillow", + "pybind11", + "snakeviz", + "unidecode", + "yq", + "pre-commit", + ] +} + @contextlib.contextmanager def pushd(new_dir): @@ -130,7 +182,7 @@ class UploadCommand(Command): setup_info = dict( # Metadata name='paddlespeech', - version='0.0.1a', + version='0.1.0a', author='PaddlePaddle Speech and Language Team', author_email='paddlesl@baidu.com', url='https://github.com/PaddlePaddle/PaddleSpeech', @@ -158,8 +210,10 @@ setup_info = dict( "gan", ], python_requires='>=3.6', - install_requires=[d.strip() for d in read('requirements.txt').split()], + install_requires=requirements["install"], extras_require={ + 'develop': + requirements["develop"], 'doc': [ "sphinx", "sphinx-rtd-theme", "numpydoc", "myst_parser", "recommonmark>=0.5.0", "sphinx-markdown-tables", "sphinx-autobuild" diff --git a/setup.sh b/setup.sh index 0bfacb54..c2ed16d7 100644 --- a/setup.sh +++ b/setup.sh @@ -2,7 +2,7 @@ conda install -c conda-forge sox libsndfile swig bzip2 bottleneck gcc_linux-64=8.4.0 gxx_linux-64=8.4.0 --yes # Install the python lib -pip install -r requirements.txt +pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple # Install the auto_log pushd tools/extras diff --git a/tools/Makefile b/tools/Makefile index 2a2c1463..1e0c2dfb 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -10,7 +10,7 @@ WGET ?= wget --no-check-certificate .PHONY: all clean -all: virtualenv.done apt.done kenlm.done sox.done soxbindings.done mfa.done sclite.done +all: virtualenv.done apt.done kenlm.done sox.done mfa.done sclite.done virtualenv.done: test -d venv || virtualenv -p $(PYTHON) venv @@ -45,11 +45,6 @@ sox.done: cd sox-14.4.2 && ./configure --prefix=/usr/ && make -j4 && make install touch sox.done -soxbindings.done: - test -d soxbindings || git clone https://github.com/pseeth/soxbindings.git - cd soxbindings && python setup.py install - touch soxbindings.done - mfa.done: test -d montreal-forced-aligner || $(WGET) https://paddlespeech.bj.bcebos.com/Parakeet/montreal-forced-aligner_linux.tar.gz tar xvf montreal-forced-aligner_linux.tar.gz