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

pip issues #41

Closed
jonorthwash opened this issue Mar 26, 2018 · 10 comments
Closed

pip issues #41

jonorthwash opened this issue Mar 26, 2018 · 10 comments
Assignees
Labels

Comments

@jonorthwash
Copy link
Member

apertium-init does not seem to install correctly using pip.

jwashin1@pearson105:~/Documents$ sudo pip3 install apertium-init
Collecting apertium-init
  Downloading apertium_init-2.1.0-py3-none-any.whl (75kB)
    100% |████████████████████████████████| 81kB 4.2MB/s 
Installing collected packages: apertium-init
Successfully installed apertium-init-2.1.0
jwashin1@pearson105:~/Documents$ apertium-init -h
Traceback (most recent call last):
  File "/usr/local/bin/apertium-init", line 7, in <module>
    from apertium_init import main
  File "/usr/local/lib/python3.6/dist-packages/apertium_init.py", line 13, in <module>
    module = __import__('apertium-init')
ModuleNotFoundError: No module named 'apertium-init'
@sushain97
Copy link
Member

https://github.com/apertium/apertium-init/blob/master/apertium_init.py#L12

What is your sys.prefix and what's inside it? Your sudo installation might be the source of the problem.

@sushain97
Copy link
Member

For context, the installation of this package is extremely hacky since apertium-init isn't a valid name for a Python module. It should have been apertium_init from the start but I'm preserving the dash for backwards compatibility.

@jonorthwash
Copy link
Member Author

>>> sys.prefix
'/usr'

@sushain97
Copy link
Member

sushain97 commented Mar 26, 2018

What is your sys.prefix and what's inside it?

os.listdir(sys.prefix) should work :)

In theory, it should have an apertium_init folder... If not, try this:

$ sudo python3
>>> sys.prefix
...
>>> import os
>>> os.listdir(sys.prefix)
...

If it's there but not in the first version, that could explain it. Not really sure how to fix it in that case (aside from telling people not to install with sudo).

@jonorthwash
Copy link
Member Author

$ python3
...
>>> os.listdir(sys.prefix) 
['games', 'share', 'include', 'lib', 'local', 'sbin', 'bin', 'src']
$ sudo python3
Python 3.6.3 (default, Oct  3 2017, 21:16:13) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.prefix
'/usr'
>>> import os
>>> os.listdir(sys.prefix)
['games', 'share', 'include', 'lib', 'local', 'sbin', 'bin', 'src']

@sushain97
Copy link
Member

Argh. Okay, I can re-confirm that the install works for me this evening and see if we can't figure this out.

Can you try locate apertium_init or whatever the equivalent for your platform is? The folder must be somewhere...

@jonorthwash
Copy link
Member Author

Seems to've put it here:

/usr/local/apertium_init/
/usr/local/apertium_init/__pycache__
/usr/local/apertium_init/__pycache__/apertium-init.cpython-36.pyc
/usr/local/apertium_init/apertium-init.py

Seems like a bad place for python stuff...

@sushain97
Copy link
Member

Interesting. Well, it installs to your sys.prefix. Other data like what NLTK downloads ends up there as well presumably. Or the countries package.

I have an idea to get rid of the hacky install and fix this problem in one go. I'll try it this evening.

@sushain97
Copy link
Member

sushain97 commented Mar 26, 2018

(I think the current solution can be un-overengineered by making an apertium_apy.py target in make release, etc. that copies over apertium-init.py and then we add that file to the .gitignore.)

@sushain97 sushain97 self-assigned this Mar 27, 2018
@sushain97 sushain97 added the bug label Mar 27, 2018
@sushain97
Copy link
Member

Okay, all better now. I'm really sorry about this :\ Should have checked on another machine after I released. Regardless, v2.1.1 is released to PyPi and tagged in GitHub:

sushain@azurite:~$ sudo -H pip3 install apertium-init
Collecting apertium-init
  Downloading apertium_init-2.1.1-py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 2.0MB/s
Installing collected packages: apertium-init
Successfully installed apertium-init-2.1.1
sushain@azurite:~$ apertium-init
usage: apertium-init [-h] [-d DESTINATION] [-p] [-pe PUSH_EXISTING_TO_GITHUB]
                     [-u USERNAME] [-a {lt,lttoolbox,hfst}]
                     [-a1 {lt,lttoolbox,hfst}] [-a2 {lt,lttoolbox,hfst}]
                     [--no-rlx1] [--no-rlx2] [--no-prob1] [--no-prob2]
                     [--no-pgen1] [--no-pgen2]
                     name
apertium-init: error: the following arguments are required: name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants