Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i run an update #13

Open
poltrian opened this issue Sep 18, 2022 · 6 comments
Open

How can i run an update #13

poltrian opened this issue Sep 18, 2022 · 6 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@poltrian
Copy link

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

@manuelkamp
Copy link

I'd like to know that too

@argosopentech
Copy link
Owner

argosopentech commented Oct 1, 2023

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 argosopentech added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers documentation Improvements or additions to documentation labels Oct 1, 2023
argosopentech added a commit that referenced this issue Oct 4, 2023
Add script to update LibreTranslate code and models

#13
@aab3r
Copy link

aab3r commented Nov 9, 2023

@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
Copy link

aab3r commented Jun 30, 2024

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

@PJ-Finlay
Copy link
Collaborator

RuntimeError: Numpy is not available

I think this is a Numpy issue

LibreTranslate/LibreTranslate#638

@aab3r
Copy link

aab3r commented Jun 30, 2024

That's right!

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants