The error you're encountering, ImportError: cannot import name 'Translator' from 'ctranslate2', typically means that the Python module was not built or installed correctly, or the API has changed since the documentation you followed was written.
cmake --build . -j) failed or was not run, the Python module will not be properly installed.Then, install the Python package:bashmkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON=ON .. cmake --build . -j
bashpip install .
python3 --version and ensure it matches the one used during the build.Translator class might have been renamed or moved.orpythonfrom ctranslate2 import Generator
pythonfrom ctranslate2 import TranslationModel
PYTHONPATH or install it in development mode:
bashpip install -e .
bashsudo apt-get install cmake build-essential python3-dev pip install -r requirements.txt
cmake --build . -j step.pip list | grep ctranslate2 to confirm the package is installed.pythonimport ctranslate2 print(dir(ctranslate2))
If you still face issues, let me know the output of the above steps, and I can help you debug further!
Le Chat can make mistakes. Check answers. Learn more