ppizarror / PyDetex

An application that transforms LaTeX code to plain text
https://pydetex.readthedocs.io
MIT License
33 stars 4 forks source link

Installation instruction on the web page #42

Open pauloney opened 1 week ago

pauloney commented 1 week ago

The installation command on the main web-page does not seem to work for Ubuntu 22.04

$ python3 pip install pydetex -U
python3: can't open file 'pip': [Errno 2] No such file or directory

I was able to install it using:

pip install pydetex -U

but things do not seem to have gone very well:

$ python3 -m pydetex.gui
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/paulo/.local/lib/python3.8/site-packages/pydetex/gui.py", line 12, in <module>
    import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'

Did an upgrade of 'python3-update-manager' after that, but the error continues.

pauloney commented 5 days ago

Problem solved, the requirements are in fact a bit more stringent:

  1. You need python3 installed
  2. python needs to be python3
  3. You need to have python3-pip installed
  4. pip needs to be python3-pip

If you have all of that, that may involve makekin pip to be pythou3-pip with the command:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1

The you can avoid the command on the web-page installation instruction and do:

pip install pydetex -U

and then you are ready to run it.

pauloney commented 5 days ago

I am not closing it yet, because the installation instructions should be changed to accomodate it.

ppizarror commented 4 days ago

Hi @pauloney. Feel free to create a new PR with documentation changes to make it clear. I think it can be an excellent contribution, thanks!

pauloney commented 4 days ago

Hi @ppizarror. I'll do it, but this covers only Ubuntu, and tried several possible installations with the machine having and not-having python2, etc ... and the conclusions here are for Ubuntu only. I am still going to try MacOS and Windows to make sure we cover all bases.

Also a colleague of mine here in Berkeley, has suggested that some small modifications on the installation, possible testing and using specific python3 and python3-pip would make the whole thing work, under all scenarios, without making the instructions any more complex.

pauloney commented 2 days ago

Hi @ppizarror We experimented a bit more with the MacOS installation, and yes indeed, if Python comes from HomeBrew then the installation process for PyDeTeX described here will not work. There are several recipes to fix, like:

  1. ïnstal pip3
  2. instal pipx
  3. install pipenv
  4. set up a virtual environment for packages ....
  5. install with the option --break-system-packages

for things to work more seamless, pydetex would have to be part of HomeBrew, so I think that in the end it is not worth it. People that need the HomeBrew environment probably know how to deal with it, so here the best would be to recommend the installation of Python from the standard package.