apertium / apertium-python

now you can even use apertium from python
GNU General Public License v3.0
31 stars 27 forks source link

apertium.InstallationNotSupported: Ubuntu 22.04.1 LTS #112

Closed alexeyev closed 9 months ago

alexeyev commented 1 year ago

Dear colleagues, thank you for your work!

Upon installation via pip (Windows Subsystem Linux: Ubuntu 22.04), everything crashes with the following message:

File "/tmp/pip-install-hvsnle_y/apertium_ce068313e7c94643af64456dbc681497/apertium/installer.py", line 164, in install_apertium                                                                                                                   installer = get_installer()                                                                                           
File "/tmp/pip-install-hvsnle_y/apertium_ce068313e7c94643af64456dbc681497/apertium/installer.py", line 158, in get_installer                                                                                                                      raise apertium.InstallationNotSupported(distro_name)                                                                
apertium.InstallationNotSupported: Ubuntu 22.04.1 LTS

Is that it, apertium-python doesn't work on WSL2?

Thank you in advance, best regards.

yash-srivastava19 commented 1 year ago

Same issue !

TinoDidriksen commented 1 year ago

Odd. The relevant code section is https://github.com/apertium/apertium-python/blob/master/apertium/installer.py#L153-L166 which should work just fine on Ubuntu 22.04.

alexeyev commented 1 year ago

Odd indeed

>>> import platform                                                                                                     
>>> platform.system()                                                                                                   
'Linux'                                                                                                                 
>>> with open('/etc/os-release') as os_release:                                                                         
...             distro_name = os_release.read()                                                                         
...                                                                                                                     
>>> distro_name                                                                                                         
'PRETTY_NAME="Ubuntu 22.04.1 LTS"\nNAME="Ubuntu"\nVERSION_ID="22.04"\nVERSION="22.04.1 LTS (Jammy Jellyfish)"\nVERSION_CODENAME=jammy\nID=ubuntu\nID_LIKE=debian\nHOME_URL="https://www.ubuntu.com/"\nSUPPORT_URL="https://help.ubuntu.com/"\nBUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"\nPRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"\nUBUNTU_CODENAME=jammy\n'                                                                                

>>> import re                                                                                                           
>>> re.search('[Dd]ebian|[Uu]buntu', distro_name) is not None                                                           
True                                                           

So, judging by the code, that means that upon the installation, platform.system() returns Ubuntu 22.04.1 LTS instead of Linux?

alexeyev commented 1 year ago
>>> print(platform.platform()); print(platform.system()); print(sys.version); print(sys.platform);                      
Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35                                                           
Linux                                                                                                                   
3.9.12 (main, Apr  5 2022, 06:56:58)                                                                                    
[GCC 7.5.0]                                                                                                             
linux
alexeyev commented 9 months ago

Dear colleagues, is there anything we can do as a temporary hack to make apertium-python work on WSL2?

upd: the same problem arises when installing apertium in colab's environment.

TinoDidriksen commented 9 months ago

It works when installing from source. The version on PyPi is outdated. We'll see about updating it.