ilius / pyglossary

A tool for converting dictionary files aka glossaries. Mainly to help use our offline glossaries in any Open Source dictionary we like on any modern operating system / device.
GNU General Public License v3.0
2.23k stars 237 forks source link

FileNotFoundError : No such file or directory: '/usr/bin/main.py #255

Closed m040601 closed 4 years ago

m040601 commented 4 years ago

Hi thanks for your work in this very usefull tool.

I'm getting this error trying to run it on Arch Linux, system Python, 3.8.6.

This might not be a problem with pyglossary itself, but with the way it was packaged and installed in my system.

I'm not sure, and I have limited python knowledge. So I was wondering if you could help me pinpoint the exact root cause for this.

Traceback (most recent call last):
  File "/usr/bin/pyglossary", line 5, in <module>
    with open(join(dirname(__file__), "main.py")) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/main.py'

I tried 3 different installation methods:

  1. A local, not system wide, user installation with pipx, https://pipxproject.github.io/pipx
  2. a clean and isolated install with python venv
  3. The package distributed to Archlinux

Here are the details:

  1. pipx install pyglossary

Seems to install ok but then trying to run it

bash: /usr/bin/pyglossary: No such file or directory

  1. python venv

python -m venv mypyglossvenv cd mypyglossvenv source bin/activate pip install pyglossary

Seems to install ok, but then trying to run it:

/dev/shm/mypyglossven/bin/pyglossary: line 1: build/bdist.linux-x86_64/wheel/pyglossary-3.2.1.data/data/share/pyglossary/pyglossary.pyw: No such file or directory

  1. Using my distro's package

At, https://aur.archlinux.org/packages/pyglossary. Which seems to include some patch ???, https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=pyglossary

Installs ok, but then getting this error trying to run it:

Traceback (most recent call last):
  File "/usr/bin/pyglossary", line 5, in <module>
    with open(join(dirname(__file__), "main.py")) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/main.py'

Thanks in advance

ilius commented 4 years ago

I'm not the maintainer of the AUR package. I will try to fix the pypi package (for pipx) on the next release.

In the meantime, please clone the repo and run as explained in the README

python3 main.py
ilius commented 4 years ago

I fixed pypi paackages https://pypi.org/project/pyglossary/#history

It's still rc/pre so need to pass --pre flag to pip

m040601 commented 3 years ago

I've now retried everything since the last updates.

  1. First what works now,

a clean and isolated install with python venv, system python 3.9


python -m venv mypyglossvenv
cd mypyglossvenv
source bin/activate
pip install pyglossary

Everything works ok now.

  1. Second what doesnt work.

still no luck with the AUR package, the maintainer hasnt updated it.

In the mean time, I'm trying again installing pyglossary with pipx running python 3.9.

... I will try to fix the pypi package (for pipx) on the next release....

I see you have updated thy pypi packages. And my "installation" via pipx seems to run ok, pyglossary -h shows up.

But then, neither


pyglossary --ui=gtk
pyglossary --ui=tk
pyglossary --ui=cmd

work. Always complaining about missing modules. No matter how I try to install those missing module via system python.

I then tried to run pyglossary in non interactive mode

pyglossary somedict.ifo output.txt

and get this error

ModuleNotFoundError: No module named lxml

At this point I gave up. I'm gonna wait to see if the maintainer of pyglossary for my system, cleans up and updates the pyglossary system package.

QUESTION: Since pipx is actually catering for "simple" python applications and pyglossary has so many dependencies. Is it actually possible and confirmed that installing pyglossary via pipx is viable ? Or is it really the only supported installation via the "classical" pip or the system package manager ?

ilius commented 3 years ago

I think your StarDict glossary contains XDXF that's why it needs lxml. Please install it with pip3 install lxml and try again. I'm gonna document it.

ilius commented 3 years ago

Now you can install all (format-specific) dependencies with pip3 install 'pyglossary[full]' But that's generally not needed (most people won't use most of these formats, only a few)

m040601 commented 3 years ago

I think your StarDict glossary contains XDXF that's why it needs lxml

I see, that makes sense. Just as I suspected, installing pyglossary with pipx, one does not get all that's needed. . And that's what I want. I want the full package at once. All that's needed at once for all that's supported. I dont' want to be hunting dependencies later.

Please install it with pip3 install

No, I won't do this. I dont' want to use pip install XYZ. Neither pip install --user XYZ. . I dont want to mess up my system here.

I'll either use my system package manager, if a python app is available, or pipx if it is supported for that peculiar python app

I will only use pip install XYZ in a venv isolated environment. I already did that and confirmed it works, in my post above

you can install all (format-specific) dependencies with pip3 install 'pyglossary[full]'

Thanks, nice to know, it should also be in the README.

Now, back to pipx.

Again, what I am testing here is if pipx is a suitable tool for installing pyglossary.

So I did try,

pipx install lxml

Which did install it, but then auto remove it automatically with the message:

No apps associated with package lxml. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool

I guess the same thing would end up happening for other dependencies, when they were needed.

So conclusion.

pipx is not the right tool to install pyglossary. Period.

You should update the README. Thanks for your answers and attention.