Sunday, February 04, 2007

Installing LyX on Windows... Successfully!

If you're a writer, and you want to write, say, a book, you really should forget all about working in Microsoft Office or and look into LyX. I know that's a little strange to hear from an proponent such as myself, but I'm also a proponent of using the right tool for the right job, and LyX is an excellent tool. I've used it for a number of years on Linux, but it's nice to have it on any platform you use.

LyX defies categorization. It's not a word processor per se. It's not a text editor. It's a document processor, and through some convolutions it acts as a front-end to the marvelous TeX typesetting system. Here's what Wikipedia has to say on the subject. So let's move past the definitions and whether you want it -- if you're a serious writer or scientific researcher you simply do -- and discuss how to get it and how to install it successfully on your Windows box.

But first I'll make the slight detour to point out that LyX already works with most Linux distributions right out of the box. All the dependencies we'll discuss are handled for you and it's just a case of using it. In Windows you not only need to work around it; you need to work around a bug in the installer.

LyX depends on a number of other important applications. These are:

ProgramGet it from
Python, a programming
GNU Aspell, for spell-checking and
ImageMagick, for image
MikTeX, a Windows port of TeX. (you want the basic distribution, which will install components as required. I've linked you straight to it.)
Ghostscript, for converting to Postscript and

Now, here's the thing... when you install LyX, the installer will offer to install all these things for you. I've had spotty luck with that. Whether this works is about a 50-50 proposition. So I recommend getting all of the dependencies squared away first, then installing LyX.

The second thing that can go wrong is that there is a known bug in the Windows installer. When you've installed LyX, it will not work. Specifically, regardless of what you do, you're going to be told that the document classes aren't installed. Also, Python will not be installed automatically, though you're going to need it to fix the situation.

So, install the programs I've listed above, in the order I've listed them. (Actually, you won't need to install Aspell, as the LyX installer installs it every time whether you've already got it or not. That's another installer bug.) When you install MikTex it will want to know where you want to get updates from... tell it to download from the web as needed. Then get LyX from and install it. This will install fine and will appear to have worked right up until you attempt to open a LyX document. Then it will tell you that a document class is missing, and you won't be able to generate output. Ignore that for the moment.

Now open My Computer, go to the directory into which LyX was installed, and open the Resources subfolder. For most people, this will be C:\Program Files\LyX14\Resources. If you've installed Python then you'll see the Python icon next to the file (or just "configure" if you're not displaying extensions). Double-click this file to execute it.

What's going to happen here is that will examine your installation, detect the missing classes in MikTex, and offer to download them. Download every file it offers.

Don't even bother to run LyX after this... it still won't work. Some resources on the Web suggest editing some configuration files... none of these suggestions have worked on any installation I've tried. It's fastest and most reliable just to go to the Control Panel, then Add/Remove Programs and simply remove LyX. Then re-install it. The installer will once again detect all of the existing stuff (except Aspell).

That's it. It will work.

The one thing that doesn't work very well is the built-in support for version control, so I didn't bother to put instructions for that here. but that's easy to work around using CS-RCS. This is free to use for individuals and open-source projects.



Anonymous Anonymous said...

Thanks Dave!!!!!!!!

The only instructions that have worked at all.

I'm looking forward to working with LyX now.


October 17, 2010 at 3:41 PM  

Post a Comment

<< Home