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

I think I'm missing something in my machine to run it but I don't know what. #14

Closed
ChelsyMena opened this issue Aug 6, 2021 · 9 comments

Comments

@ChelsyMena
Copy link

ChelsyMena commented Aug 6, 2021

Hello, great library. Thanks for developing it!

I'm trying to get a timeline and in VSC and Jupyter Lab I get the "[WinError 2] The system cannot find the file specified", I used pip install and the library loads just fine with example code, it just won't output anything because of that error. What do I need to have installed to run this? specially the tl = TimelineTex(items, options=options) line.

Must be a noob question, but I thought I'd ask. Thanks again!

@GjjvdBurg
Copy link
Owner

Hi @ChelsyMena, thanks for reporting this issue. I'm sorry to hear you're having trouble getting the code to work. Do you have a working Latex installation on your system, including latexmk? As that is what is used to create the Tex time line.

You might be able to test this by running:

>>> from labella.tex import text_dimensions
>>> text_dimensions("foo", silent=False)

@GjjvdBurg
Copy link
Owner

Closing due to inactivity. Please reopen if the issue persists.

@SeaDude
Copy link

SeaDude commented Jan 25, 2022

Hello,

What is meant by: Do you have a working Latex installation on your system, including latexmk??

Besides pip install latexmk.py, what else constitutes "installation"?

@GjjvdBurg
Copy link
Owner

GjjvdBurg commented Jan 25, 2022 via email

@SeaDude
Copy link

SeaDude commented Jan 25, 2022

Wow..heck of a set of pre-req's for Windows.

From https://ctan.math.utah.edu/ctan/tex-archive/support/latexmk/INSTALL:

1.  Make sure you have working installations of Perl and TeX/LaTeX,    
    complete with viewers for dvi, postscript and/or pdf files.  You will
    also need whatever packages your document needs.

2.  If necessary, unpack the latexmk distribution.  

3.  **Difference compared with UNIX-type systems**: Copy the file
    latexmk.pl to a suitable directory (your choice), and arrange for it to
    be invoked as a command.  (If you don't know how to do this, find out
    about "executable extension for perl on windows", by a web search.) 

For those who come after, looking for Windows 10 instructions:

Determine if Perl is installed

  • Add / Remove Programs
  • Search for "Perl"
  • No results

Download Perl for Windows 10

  • Go to perl.org and download
    • Went with "Strawberry Perl"
    • Select 32 vs 64 bit
  • Install:
    • Next
    • Accept
    • Next
    • Select location C:\Strawberry\
    • Install
    • Approve
      • (takes a fair amount of time to download!)
    • Finish

Determine if "TeX/LaTeX" is installed

  • Add / Remove Programs
  • Search for "TeX" and "LaTeX"
  • No results

Download TeX/LaTeX for Windows 10

  • Visit to https://miktex.org/download
  • Download
  • Accept
  • Next
  • Install for me or all users?
  • Next
  • Select location: C:\Users\<you>\AppData\Local\Programs\MiKTeX
  • Next
  • Set:
    • Preferred paper: A4 and
    • Install missing packages on-the-fly: Ask me first
  • Next
  • Start
    • (takes a fair amount of time to download too!)
  • Next
  • Check for updates now: Checked
  • Next
  • Close

Download the latexmk package from MiKTeX

  • Open MiKTeX
  • You'll probably get a popup stating "Check for updates"
    • Click Ok
  • OPTIONAL:
    • Click Updates tab
    • Check for updates
    • WARNING: I have no idea what these are packages are doing. DO NOT download them until you know they are safe
  • Click Packages tab
  • In the search bar, type latexmk
  • Hit Enter
  • Select latexmk
  • Click the + icon
  • Ok
  • When download is complete, click Close

Test PATH variable

  • Open a cmd/PowerShell/etc terminal
  • Type latexmk -h
  • If the results are an error like this:
    • The latexmk package (program?) added in previous step must be added to your PATH variable
latexmk : The term 'latexmk' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or  
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ latexmk -h
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (latexmk:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Place latexmk in the Users' PATH variable

  • Click Windows button on keyboard
  • Type env
  • Select the result Edit environment variables for your account
    • NOTE: This only installs the program for the particular User (You!)
    • You may want to read-up on User vs. System env variables before setting the System PATH env var
  • Click Environment Variables
  • Under User variables for <yourUserName>, double click the Path variable
  • Click New
  • Unless you change it, MiKTeX installs packages in the following directory.
    • C:\Users\<you>\AppData\Local\Programs\MiKTeX\miktex\bin\x64
    • Add \latexmk.exe to the above path and paste the whole exe path into the new field
    • Should be: C:\Users\<you>\AppData\Local\Programs\MiKTeX\miktex\bin\x64\latexmk.exe
  • IMPORTANT: CLOSE THEN OPEN (RESTART) YOUR TERMINAL WINDOW
    • There isn't a (easy) way to source bash.rc your Windows cmd terminal.
    • You must close/reopen the terminal for the PATH environmental variable to be refreshed

Verify PATH variable

  • Open a new cmd/PowerShell/etc terminal
  • Type latexmk -h
  • Results should look like this:
Latexmk 4.76: Automatic LaTeX document generation routine

Usage: latexmk [latexmk_options] [filename ...]

  Latexmk_options:
   -aux-directory=dir or -auxdir=dir 
                 - set name of directory for auxiliary files (aux, log)


                 - Currently this only works with MiKTeX

...<con't>...

  Run latexmk
with the option -showextraoptions to see a list of these

Report bugs etc to John Collins <jcc8 at psu.edu>.

Additional cleanup

  • When you initially try to run your Python script (say python .\timeline.py), you will get an notification from MiKTeX:
  • image
  • Click Install
  • CTRL+z the execution of your script
  • Rerun python .\timeline.py
  • If you're using the examples, ls should yield a .pdf, '.svg, and a .tex file
  • PDF:
  • image
  • SVG:
  • image
  • TEX:
  • image

@GjjvdBurg
Copy link
Owner

GjjvdBurg commented Jan 25, 2022 via email

@SeaDude
Copy link

SeaDude commented Jan 25, 2022

I also have MiKTeX added to PATH variable. Still getting FileNotFoundError: [WinError 2] The system cannot find the file specified.

image

@GjjvdBurg
Copy link
Owner

GjjvdBurg commented Jan 25, 2022 via email

@SeaDude
Copy link

SeaDude commented Jan 26, 2022

RE: Pull Request:

  • I'd probably just PR the README.md and add
  • "For Windows instructions, see here".

I have to actually see if this tool is going to work for my use case!

Thank you!

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