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

app.language has no attribute languages #262

Closed
MiguelMJ opened this issue May 11, 2022 · 10 comments
Closed

app.language has no attribute languages #262

MiguelMJ opened this issue May 11, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@MiguelMJ
Copy link

Hi!
I'm launching the app with these options: --load-only es,en,fr --disable-web-ui but the models don't update: I get the following message:

Cannot update models (normal if you're offline): module 'app.language' has no attribute 'languages'

As the message says, app.language has no attribute languages, but still it is accessed in init.py, lines 58 and 68.

I haven't found any other place where app.language.languages is used, via grep -nr "app.language.languages" and grep -nr "from app.language" so I guessed that maybe those lines were meant to access app.language.__languages. However changing those lines to use app.language.__languages only changes the error to:

Cannot update models (normal if you're offline): 'NoneType' object is not iterable

I understand that this happens because the line 58, that would assign app.language.__languages a value, is never executed and line 68 tries to iterate through its default value: None.

Some solutions I came up with:

  • Change lines 58 and 68 to use app.language.__languages instead of app.language.languages and set the default value of app.language.__languages to [] instead of None. I don't think this is a good idea, though.
  • Just add new app.language.languages variable with default value []. Short solution, not sure if the best.

What do you think? I'm missing something? If you tell me one of those is OK I'll open a PR.
Thank you

@ServOKio
Copy link

ServOKio commented Jun 1, 2022

I also have the same problem. After [polyglot_data] Downloading package transliteration2.vi to nothing is happening.

2022-06-01_17-58

I tried to copy packages from my old server where everything worked, but now I get Cannot update models (normal if you're offline): module 'app.language' has no attribute 'languages'

@raitman005
Copy link

I tried this one and when i execute the python main.py nothing is happening.

i change the line 58 and 68 on init.py file
then change the None to [] and add languages = [] on languages.py

@aguajardo
Copy link

Has there been any progress on this? I am having the same error did the same thing and it did not work...

@Seabright22
Copy link

This issue seems to still be here (unless anyone has found another fix?), neither of the attempted solutions above work for me.

@dingedi
Copy link
Collaborator

dingedi commented Oct 5, 2022

I have the same error message however the api works correctly.

$ python3 --version
Python 3.10.6

$ pip --version
pip 22.2.2 from /home/dingedi/.local/lib/python3.10/site-packages/pip (python 3.10)

$ libretranslate --load-only es,en,fr --disable-web-ui
Cannot update models (normal if you're offline): module 'app.language' has no attribute 'languages'

@aguajardo
Copy link

I have the same error message however the api works correctly.

$ python3 --version
Python 3.10.6

$ pip --version
pip 22.2.2 from /home/dingedi/.local/lib/python3.10/site-packages/pip (python 3.10)

$ libretranslate --load-only es,en,fr --disable-web-ui
Cannot update models (normal if you're offline): module 'app.language' has no attribute 'languages'

Do you mean that even with the error, it still processes requests? Does it translate even with that or is it just that the api server boots up?

@dingedi
Copy link
Collaborator

dingedi commented Oct 5, 2022

The api works fully even with this error on my side, the message must be irrelevant but I'll look into detail when I have time.

@cemalokten
Copy link

cemalokten commented Oct 11, 2022

I'm also receiving this error, any progress on it?

Web UI works but I receive the error when trying to translate :
Cannot translate text: 'NoneType' object has no attribute 'translate'

If I dismiss the error I get the following: Error while calling /translate

@pierotofy
Copy link
Member

I can't seem to reproduce it on my machine:

[piero:~] [test] $ python3 --version
Python 3.10.8
[piero:~] [test] $ pip --version
pip 22.3 from /home/piero/test/lib/python3.10/site-packages/pip (python 3.10)
[piero:~] [test] $ libretranslate --load-only es,en,fr --disable-web-ui
Updating language models
Found 58 models
...

@pierotofy
Copy link
Member

pierotofy commented Dec 20, 2022

I suspect these issues have been fixed since I can't reproduce them with the latest version. If the issues persist, feel free to re-open this? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants