Open poltrian opened 1 year ago
I'd like to know that too
You can reinstall LibreTranslate and update the models:
cd ~/LibreTranslate-init
git pull
rm -rf ~/LibreTranslate/env
virtualenv ~/LibreTranslate/env
~/LibreTranslate/env/bin/pip install ~/LibreTranslate/ --no-cache-dir
~/LibreTranslate/env/bin/libretranslate --update-models
It would be good to add better built in support and or docs for updating.
@argosopentech Looking a way to update, I've found this script. Thanks! However, I've seen that, as virtualenv is deleted, so is gunicorn. I've fixed it adding "~/LibreTranslate/env/bin/pip install gunicorn" after LibreTranslate install.
Ok, it gets trickier...
I've been using that way of updating LibreTranslate without issues, but recently I've upgraded Debian (to bookworm version) and something makes LT not to work anymore. The update itself works, and the page loads, but as soon as some text is typed to be translated, systemctl status libretranslate.service says:
gunicorn: File "/home/libretranslate/LibreTranslate/env/lib/python3.11/site-packages/stanza/models/tokenize/utils.py", line 85, in output_predictions
batch = data_generator.next(eval_offsets=offsets)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/libretranslate/LibreTranslate/env/lib/python3.11/site-packages/stanza/models/tokenize/data.py", line 206, in next
units, labels, features = list(map(convert, [(units, np.int64), (labels, np.int64), (features, np.float32)]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/libretranslate/LibreTranslate/env/lib/python3.11/site-packages/stanza/models/tokenize/data.py", line 204, in <lambda>
convert = lambda t: (torch.from_numpy(np.array(t[0], dtype=t[1])))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available
It seems related to the way Debian has changed the way of using "pip"; now "pipx" is recommended. Anyway, I've installed python3-numpy, and even "pipx install numpy", but the issue remains.
I'm willing to make more tests if someone can guide me in the right direction :)
RuntimeError: Numpy is not available
I think this is a Numpy issue
That's right!
Adding "~/LibreTranslate/env/bin/pip install numpy==1.26.4 --force" at the end of the script fixes the issue.
Thanks!
it's possible to run an update with the script?