# How can I fix the error “GUI framework cannot be initialized” with TeXnicCenter and MiKTeX?

I don't know what I've done, but all of a sudden I am unable to compile any document which uses the geometry package. Minimal (non)-working example:

\documentclass[11pt]{article}
\usepackage{geometry}
\begin{document}
test
\end{document}


doesn't produce any output, and this is what I see in my error summary screen in TeXnicCenter:

The red arrow points to what seems to be the problem: something about the bundle "oberdiek" and its package "ifvtex" is causing pdflatex.exe (which, while I don't really know what it does, sounds pretty important) to "not be initialized". I looked up this package, and it's relevance here is a mystery to me.

I've confirmed that all of my files without the geometry package compile just fine; however, that doesn't mean that the problem is with the geometry package - what seems more likely is that there is some hidden cause of the error, and geometry happens to be one way to induce that. By the way, I've tried compiling a document which includes the ifpdf and ifvtex packages separately, and they do just fine; it's only when I include the geometry package (which for some reason requires these ifpdf and ifvtex packages) that the error occurs.

I've tried the only things I can think of:

• going into MiKTeX Package Manager (by the way I am using 2.8), and removing + reinstalling both geometry and oberdiek
• refreshing the file name database ("FNDB")
• deleting all automatically generated files, as well as simply starting over in a new document

So I'm stuck now. I've considered attempting to just get rid of all traces of MiKTeX and TeXnicCenter from my computer and starting over, but that seems a bit excessive - after all, the geometry package was working for me just earlier today. I honestly am not sure what I did to cause this; I've spent today trying to make a better template file for myself, and so I've been trying out new packages, but if I'm not loading these new packages there shouldn't be any conflicts, right?

Actually, I've just now thought of something that I think I did between the last time it worked and now, so is a possible candidate for the cause: I had to install some package manually, as it wasn't available on MiKTeX, and so I created a folder and pointed MiKTeX to it (i.e. the second option described here). The package didn't do what I wanted, so I deleted the folder and removed it from the list of folders I told MiKTeX to check. Perhaps it's still trying to reach it for some reason?

-
Have you read this: MiKTeX 2.8 Issues? –  Werner Sep 1 '11 at 1:20
I also note that the search for the oberdiek bundle is in \Users\<name>\... and not \Program Files (x86)\MiKTeX 2.8\.... Following "the second option" suggests adding a folder to the latter structure rather than the first. Also, what do you mean when you say "pointed MiKTeX to it"? –  Werner Sep 1 '11 at 1:27
+1 for @Werner's link- I've had this error before, and it went as soon as I changed "Install missing packages on-the-fly" to "Yes" or "No" –  cmhughes Sep 1 '11 at 1:38
@Werner: Thank you for the link, I hadn't seen that. I've had that option set to "Yes" for a long time; testing it now, the problem goes away but (curiously) only when set to No. So that does resolve the problem, though it'd be a pain to have to install packages by hand forever. –  Zev Chonoles Sep 1 '11 at 1:50
@Doncherry: I've marked the duplicate 'in reverse' as this question is probably clearer than the older one. –  Joseph Wright Sep 2 '11 at 7:17

This is a known issue with MiKTeX 2.8. From the MiKTeX 2.8 issues website:

### TeXnicCenter compatibility

LaTeX terminates with "GUI framework cannot be initialized" if invoked from TeXnicCenter (1.0 Stable Release Candidate 1). This happens when a missing package needs to be installed and the pop-up window cannot be displayed.

Remedy: start MiKTeX Options and choose either Yes or No (but not "Ask me first") for the option "Install missing packages on-the-fly".

If No is the only option that works, I would suggest updating to MiKTeX 2.9. This is something that you would probably do in the future anyway.

-
Your other comment above actually gets at the heart of the matter, I think - I did install that package manually in a folder other than the recommended one (I guess I should have paid closer attention), and now I see that when I go to MiKTeX Settings, there are extraneous folders listed (the top two). Interestingly, I only see these folders when I use the non-admin version of the MiKTeX Settings program. I also can't get rid of them; "remove" is greyed out. So reinstalling MiKTeX (and I might as well go to 2.9 now) should erase my blunder. –  Zev Chonoles Sep 1 '11 at 2:08
I'm installing MiKTeX 2.9 now, I'll post back when I see if it lets me keep the "Yes" option. –  Zev Chonoles Sep 1 '11 at 2:16
Everything is all working now with the update to 2.9. Thanks so much for your help! –  Zev Chonoles Sep 1 '11 at 2:56

For me the MiKTeX's "Install packages on the fly" solution didn't work. What did work was to run latex once from command line (cd to the directory, then run "latex myfile.tex"). This way the GUI won't be interfering with package installation. Afterwards you can compile normally from TeXnicCenter, as you now have the packages installed.

-