LibreTranslate-init icon indicating copy to clipboard operation
LibreTranslate-init copied to clipboard

How can i run an update

Open poltrian opened this issue 2 years ago • 6 comments

it's possible to run an update with the script?

poltrian avatar Sep 18 '22 19:09 poltrian

I'd like to know that too

manuelkamp avatar Apr 11 '23 14:04 manuelkamp

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 avatar Oct 01 '23 18:10 argosopentech

@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.

aab3r avatar Nov 09 '23 09:11 aab3r

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 :)

aab3r avatar Jun 30 '24 13:06 aab3r

RuntimeError: Numpy is not available

I think this is a Numpy issue

https://github.com/LibreTranslate/LibreTranslate/issues/638

PJ-Finlay avatar Jun 30 '24 13:06 PJ-Finlay

That's right!

Adding "~/LibreTranslate/env/bin/pip install numpy==1.26.4 --force" at the end of the script fixes the issue.

Thanks!

aab3r avatar Jun 30 '24 16:06 aab3r