Skip to content

Commit

Permalink
Fix EasyNMT, fasttext dependency installation problem on Python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirozha1337 committed May 12, 2024
1 parent 1cbd6df commit cf00b9d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -16,8 +16,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install application
run: |
pip install wheel
pip install -e .
pip install --no-deps EasyNMT==2.0.2
pip list
pip install -v -e .
- name: Check that package was installed successfully
run: |
faster_auto_subtitle -h
12 changes: 8 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ faster-whisper==0.10.0
tqdm==4.56.0
ffmpeg-python==0.2.0
wheel==0.42.0
fasttext==0.9.2
pybind11==2.11.1
EasyNMT==2.0.2
langcodes==3.3.0
langcodes==3.3.0
transformers>=4.4,<5
torch>=1.6.0
numpy
nltk
sentencepiece
protobuf
EasyNMT==2.0.2
39 changes: 31 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
from setuptools import setup, find_packages
from importlib.metadata import version, PackageNotFoundError


def is_package_installed(package_name, v):
try:
print(version(package_name))
return version(package_name) == v
except PackageNotFoundError as e:
print('Error:')
print(e)
return False


dependencies = [
'faster-whisper',
'tqdm',
'ffmpeg-python',
'langcodes',
'transformers>=4.4,<5',
'torch>=1.6.0',
'numpy',
'nltk',
'sentencepiece',
'protobuf',
]

print('checking EasyNMT')
if not is_package_installed('EasyNMT', '2.0.2'):
print('EasyNMT is not installed. Installing it now')
dependencies.append('EasyNMT==2.0.2')

setup(
version="1.1",
name="faster_auto_subtitle",
packages=find_packages(),
py_modules=["auto_subtitle"],
author="Sergey Chernyaev",
install_requires=[
'faster-whisper',
'tqdm',
'ffmpeg-python',
'fasttext',
'EasyNMT',
'langcodes',
],
install_requires=dependencies,
description="Automatically generate and embed subtitles into your videos",
entry_points={
'console_scripts': ['faster_auto_subtitle=auto_subtitle.cli:main'],
Expand Down

0 comments on commit cf00b9d

Please sign in to comment.