On Debian 13 after having followed https://opennmt.net/CTranslate2/installation.html#install-from-sources I face:
```bash python3 -c 'from ctranslate2 import Translator' ``` ``` Traceback (most recent call last): File "<string>", line 1, in <module> from ctranslate2 import Translator ImportError: cannot import name 'Translator' from 'ctranslate2' (/home/benjamin_loison/CTranslate2/python/ctranslate2/__init__.py) ```
why?
Mar 2, 11:50pm
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.
Possible Causes and Solutions
1. Build Not Completed or Failed
The CTranslate2 Python bindings require the project to be built from source. If the build step (cmake --build . -j) failed or was not run, the Python module will not be properly installed.
If you built CTranslate2 with one Python version but are trying to import it in another, the module will not be found.
Solution: Ensure you are using the same Python environment for both building and importing. You can check your Python version with python3 --version and ensure it matches the one used during the build.
3. API Changes
The API may have changed in newer versions of CTranslate2. The Translator class might have been renamed or moved.