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

Better error messages and documentation for dependencies #51

Open
FranseFrikandel opened this issue Nov 26, 2022 · 3 comments
Open

Better error messages and documentation for dependencies #51

FranseFrikandel opened this issue Nov 26, 2022 · 3 comments

Comments

@FranseFrikandel
Copy link

Description of the issue

So, as a user of Overleaf, and thus not having a local LaTeX distribution installed, the first time trying to use this package didn't work. I found it out quite quickly by taking a quick peak in the sourcecode, however the package documentation doesn't appear to really mention the requirements of having a LaTeX distribution installed, and the error you get is a very undescriptive FileNotFoundError with nothing pointing to what exact file it is missing.

The error message I got:

Traceback (most recent call last):
  File "C:\Users\username\path\to\file.py", line 200, in <module>
    x.write("xdsm", cleanup=True, quiet=True)
  File "C:\Python310\lib\site-packages\pyxdsm\XDSM.py", line 628, in write 
    subprocess.run(command, check=True)
  File "C:\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified 

Potential solution

Solving the issue would be two-fold. Firstly, the error message should be more descriptive. An error message saying pdfLaTeX wasent found would be a lot more helpful.

Secondly, the "installation" documentation should mention a LaTeX environment is required for proper operation.

I would be happy to look into making a PR for this if this would be desired.

@ewu63
Copy link
Collaborator

ewu63 commented Dec 2, 2022

I agree that the error message is not very helpful. My proposed solution would be to use something like shutil.which to check if pdflatex is on the $PATH, and throw an error instead of trying to execute the command using subprocess.run. Also note that while a conda package exists, Windows builds are not tested either here or in the feedstock repo.

The documentation does in fact mention requiring a LaTeX installation, however the documentation can certainly be improved. We do welcome PRs to our packages if you're interested.

I also want to point out that there is the possibility of outputting a .tex file without compiling to PDF using pdflatex, by passing in the option build=false. This generates only the .tex file which can then be included in your LaTeX source file and compiled together.

@Mr-PDM
Copy link

Mr-PDM commented Dec 8, 2023

Hi, sorry for intruding in the conversation, but I'm experimenting the same error @FranseFrikandel posted, and I couldn't get how to solve it. I tried to install pdf latex, but it's still happening, I don't know if I need to install LaTeX also or how to obtain the .tex and from the .tex get the PDF

Thanks and sorry for the intrusion

@FranseFrikandel
Copy link
Author

Hi @Mr-PDM ,

I'm going to assume you run Windows. Have you tried running the pdflatex command from within powershell to see if that works? If it doesn't, you'll likely need to include it in your path variable if it is indeed installed. Personally I have MikTeX installed which includes pdflatex, and AFAIK it should set your path variable correctly.

Essentially, you should be able to get pdflatex command to work in your terminal, and it should also resolve this issue.

The option mentioned earlier, where only the .tex file is generated is of course also still an option. It shouldn't require pdflatex, however you'll have to compile the latex file into a PDF yourself. Shouldn't be an issue if you've ever worked with LaTeX before in for example Overleaf.

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

No branches or pull requests

3 participants