LyX system reconfiguration failure

4.5k views Asked by At

I've recently been encountering a LyX error in a Windows installation that worked previously without a hitch. I've tried reinstalling LyX and MiKTeX, to no avail. When I open LyX, no document classes are available. When I attempt to reconfigure LyX, I get an error message:

The system reconfiguration has failed. Default textclass is used but LyX may not be able to work properly. Please reconfigure again if needed.

The error log shows the following:

16:37:25.964: Running configure... 16:37:25.989: python -tt "C:/Program Files (x86)/LyX 2.1/Resources/configure.py" --binary-dir="C:/Program Files (x86)/LyX 2.1/bin/" 16:37:26.060: checking for DVI to DTL converter... 16:37:26.062: +checking for "dv2dt"... yes 16:37:26.063: checking for DTL to DVI converter... 16:37:26.065: +checking for "dt2dv"... yes 16:37:26.066: checking for a Latex2e program... 16:37:26.067: +checking for "latex"... yes 16:37:26.068: checking for a DVI postprocessing program... 16:37:26.069: +checking for "pplatex"... yes 16:37:26.071: checking for pLaTeX, the Japanese LaTeX... 16:37:26.072: +checking for "platex"... yes 16:37:26.073: Traceback (most recent call last): 16:37:26.074: File "C:/Program Files (x86)/LyX 2.1/Resources/configure.py", line 1536, in <module> 16:37:26.076: LATEX = checkLatex(dtl_tools) 16:37:26.077: File "C:/Program Files (x86)/LyX 2.1/Resources/configure.py", line 480, in checkLatex 16:37:26.078: if cmdOutput(PLATEX + ' chklatex.ltx').find('pLaTeX2e') != -1: 16:37:26.080: File "C:/Program Files (x86)/LyX 2.1/Resources/configure.py", line 68, in cmdOutput 16:37:26.081: cmd = 'cmd /d /c pushd ' + shortPath(os.getcwdu()) + '&' + cmd 16:37:26.082: File "C:/Program Files (x86)/LyX 2.1/Resources/configure.py", line 84, in shortPath 16:37:26.084: from ctypes import windll, create_unicode_buffer 16:37:26.085: File "C:\Anaconda\Lib\ctypes\__init__.py", line 10, in <module> 16:37:26.086: from _ctypes import Union, Structure, Array 16:37:26.087: ImportError: DLL load failed: %1 is not a valid Win32 application. 16:37:26.089: Reloading configuration.....\..\..\src\support\Systemcall.cpp (292): Systemcall: 'python -tt "C:/Program Files (x86)/LyX 2.1/Resources/configure.py" --binary-dir="C:/Program Files (x86)/LyX 2.1/bin/"' finished with exit code 1 16:39:00.090: (reconfigure)

The error seems to occur following python -tt "C:/Program Files (x86)/LyX 2.1/Resources/configure.py" --binary-dir="C:/Program Files (x86)/LyX 2.1/bin/". When I run the command via cmd, it executes without any errors. What else should I attempt?

2

There are 2 answers

14
scottkosty On BEST ANSWER

If you are able to run the script, you can just cd to your LyX user directory (on Linux this is ~/.lyx. For Windows, see Help > About) and run the configure command inside that directory. Do that without LyX running. Then open LyX. It should work just fine now.

So to be clear, do not run reconfigure within LyX (as this does not appear to be working). As for why that problem occurs, we've gotten a few similar reports from Windows users. A wild guess is that LyX needs to run python 2.x and somehow 3.x is running. Another guess is that some PATH escapes aren't working through the GUI (e.g. the parentheses or the space).

Note, however that I've only used LyX on Ubuntu so these really are wild guesses.

0
Pete P On

I battled for a complete day with this and could get nowhere, until I found what I believe is the problem. Here's what I did:

1) opened a command prompt in windows with administrative privileges.

2) navigated to the directory containing lyx.exe 'c:\program files (x86)\lyx 2.1\bin' on my machine.

3) executed lyx.exe

4) everything involving python calls failed - reconfigure (which uses configure.py), opening old documents (which uses lyx2lyx), etc.

5) exited lyx back to the command prompt

6) on the command line typed 'set pythonpath=' which clears the pythonpath.

7) on the command line typed 'set path=' which clears the path.

8) typed lyx.exe to reenter lyx

9) now everything works!

I'm not sure of all the pertinent information here, but I'm running windows 10 with a 64 bit python installation. I believe the lyx python calls are trying to run my python installation and not the one that comes with Lyx and here is the problem - the two are incompatible. By clearing the path and the pythonpath, it seems to force Lyx to find the python it installed and everything works.

I hope this helps someone and the Lyx developers.