LyXLyX and MacTex

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
Blinis
Posts: 4
Joined: Fri May 25, 2012 8:51 pm

LyX and MacTex

Post by Blinis »

Dear all,

I am a long time TeXworks user, so quite familiar with LaTeX. Because my research advisor is working on LyX, I wanted to switch, so I installed first the newest version of MacTex (downloaded on the official website) and the latest version of LyX.

But when I start LyX, the software tells me : "LyX won't work normally because it could not find any document class" (I am translating from French), which basically forbids me to do anything valuable.

So, my questions are the following: first of all, do MacTex install document classes? Where are these document classes anyway? How could I redirect/reconfigure LyX to use them?

Thank you for your time and your answers, I am struggling with this right now and could not find an easy answer on the web!

"Blinis"

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: LyX and MacTex

Post by josephwright »

MacTeX installs a 'full' TeX system, so if it is installed correctly you should be fine. As you're experienced with TeXworks, I'd suggest making a small test document there and compiling it. If all is well then the issue is at the Lyx end, if not then you have a faulty MacTeX installation. Try that and report back.
Joseph Wright
Blinis
Posts: 4
Joined: Fri May 25, 2012 8:51 pm

Re: LyX and MacTex

Post by Blinis »

Dear Joseph,

Thank you for your answer! I am actually still using TeXworks without any issue, and I am able to load different kinds of classes (article, beamer etc.). It really sounds like LyX is unable to configure itself with my TeX distribution (that I installed in the Applications File, as it is by default).

I don't know if it is useful, but I checked in the Library/texmf/tex/latex/lyx file, and it is almost empty.

I am struggling to understand how LaTeX works, talking about the files that are used when compiling a TeX document with TeXworks or LyX. I am guessing that once a TeX distribution is installed, every program using TeX should be redirected to the files installed by the distribution. My problem would happened because TeXworks knows something that LyX does not: where the documentclasses files are. I could not figure out where these files would be, and neither how to redirect LyX to them. So there must be something wrong with my deductions, or I am a very bad researcher ;)

I am a bit thinking out loud here, but that the state of my problem right now.
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: LyX and MacTex

Post by josephwright »

Assuming you did nothing odd when installing MacTeX, the classes are inside /usr/local/texlive/<year>/texmf-dist/tex/latex. TeXworks does not have to 'know' this: it just calls pdfLaTeX, which then finds files using a system called kpsewhich which is built-in to MacTeX (TeX Live). Quite how Lyx works I'm not sure. Could I check your MacTeX and Lyx versions?
Joseph Wright
Blinis
Posts: 4
Joined: Fri May 25, 2012 8:51 pm

Re: LyX and MacTex

Post by Blinis »

Once again, thank you for the answer. I installed the latest versions of MacTeX (2011) and LyX (2.0.3). Seeing that LyX wasn't working, I uninstalled it, put the 2.0.0 version, not working either. So right now I am back to LyX 2.0.3.

I searched through '/usr/local/texlive/2011/texmf-dist/tex/latex' as you mentioned it, and it seems that a lot is already there. It is becomming puzzling... Thank you for your time!
Paul Rey
Posts: 3
Joined: Wed Oct 12, 2011 10:06 am

Re: LyX and MacTex

Post by Paul Rey »

Have you tried do reconfigure Lyx by Tools/Reconfigure (Outils/Reconfigure) ?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

LyX and MacTex

Post by Stefan Kottwitz »

Very good advice by Paul to run "Reconfigure"!

If you do that, you could post the output here, if there are still problems. Alternatively, you could run configure.py at the command prompt, such as

Code: Select all

python2 /usr/share/lyx/configure.py
or wherever it is. Perhaps you can see more output doing this in a terminal window.

Stefan
LaTeX.org admin
Blinis
Posts: 4
Joined: Fri May 25, 2012 8:51 pm

LyX and MacTex

Post by Blinis »

Dear all,

Thanks for your answer. Here is what I get when I start LyX:
LyX will only have minimal functionality because no textclasses have been found. You can either try to reconfigure LyX normally, try to reconfigure without checking your LaTeX installation, or continue.
I tried to reconfigure using LyX -> Reconfigure, and here is the output:
The layout file:
article
could not be found. A default textclass with default
layouts will be used. LyX will not be able to produce
correct output.
And so I am unable to use the most basic LyX functionalities. (I tried to run you code line through the terminal Stefan, but it appears that the function 'python2' is not recognized by the terminal. I am quite sure that Python is installed on my Mac though...)

Sorry to bother you with all of this, thank you for your help. I am a bit puzzled by the issue, and I really can not figure how to work this out.

Maxime
anildas
Posts: 1
Joined: Thu Oct 11, 2012 1:02 am

Re: LyX and MacTex

Post by anildas »

I had the same problem. Finally solved it, without knowing much about Tex internals too.

The problem was not MacTex, but for some reason, how Lyx is invoking python.

If I start lyx from a terminal, I see this command is what the error comes from:

python -tt "/Applications/LyX.app/Contents/Resources/configure.py" --with-version-suffix=-2.0

Yet, if I run that locally it is fine.

So, I looked into the details of the error message, and it had:

IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)
/Users/Shared/LyX/lyx-2.0.4/src/support/Systemcall.cpp(273): Systemcall: 'python -tt "/Applications/LyX.app/Contents/Resources/configure.py" --with-version-suffix=-2.0' finished with exit code 1


I didn't have /usr/include/python2.7/pyconfig.h on my system, but I could see from the stack trace that python was being called from /System/Library/Frameworks/Python.framework/Versions/2.7/...

Poking around, I found that /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
exists, so:

sudo mkdir /usr/include
sudo chmod ugo+rwx /usr/include/
ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 /usr/include/

and then it worked!

(that chmod was probably not required).

I also ended up running: /Applications/MacPython\ 2.4/Update\ Shell\ Profile.command
I probably didn't need to/shouldn't have. Anyway, I now have Lyx running again on my Mac. (Lost it when I replaced the macbook and upgraded to Mountain Lion).

Yay!
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: LyX and MacTex

Post by scottkosty »

anildas, good job figuring it out.

Could you please post a bug report and the solution so that hopefully you (and others) won't have this problem in the future?
You can do so here: http://www.lyx.org/trac
Post Reply