3

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?

Alex Ames
  • 107
  • 1
  • 5

2 Answers2

2

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.

scottkosty
  • 2,410
  • 1
  • 16
  • 22
  • 1
    Everything appears to be working again (except for the built-in `reconfigure` command). I tried running the script in C:/Programs/Lyx2.1 several times unsuccessfully before giving up and reading your answer more carefully--running in the user directory did the trick. – Alex Ames Nov 29 '14 at 06:43
  • @AlexAmes Glad it works! We've fixed a few bugs like this for the next version of LyX. If you happen to try to install LyX again in the future and come across this problem again, that means there's a bug lurking that we don't know about. We would really appreciate it if you posted a bug report at http://www.lyx.org/trac so we can find it and fix it. – scottkosty Nov 29 '14 at 07:34
  • I went to C:/Program Files (x86)/Lyx 2.1/Resources and double clicked configure.py. The windows command window pops up in a FLASH, it closes so quickly that I can't read it. After trying several dozen times to get lucky with printing the screen early enough, I got the error message. There's a few lines and then: IOError: [Errno 13] Permission denied: 'C:\Program Files (x86)\LyX 2.1\Resources\configure.log' – Nike Oct 12 '15 at 17:23
  • @user1271772 that is not how you want to run configure. If you did do it that way, you would have to run configure from your user directory (in Linux you would just do `cd ~/.lyx && /usr/share/lyx/configure.py`), but it is better to remove your user directory (actually back it up first) and then open LyX and go to Tools > Reconfigure. – scottkosty Oct 13 '15 at 01:30
  • @scottkosty, I had already tried that. I did not mention it, because the question whose answer we are commenting on, already explains the error message that I got : "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." – Nike Oct 15 '15 at 09:29
  • Also, I do not have a /usr/ directory. I am on Windows 10. – Nike Oct 15 '15 at 09:37
  • @user1271772 unfortunately that error is not very informative. Can you please post the output from configure? – scottkosty Oct 15 '15 at 14:35
  • Yes, the window closes in a flash, so I had to try taking a screenshot dozens of times. The best screenshot I got was this one: http://postimg.org/image/87mj2bvdn/ . Error seems to be in python.exe – Nike Oct 16 '15 at 06:26
  • @user1271772 See my comment above. It is normal that permission is denied there. I don't think you have write access to "Program Files". You do not want to run configure manually. Please start LyX, go to View > Messages, and then to Tools > Configure. Then show us the log that you get that shows up in View > Messages. – scottkosty Oct 16 '15 at 15:17
  • @scottkosty. I got: The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program. 04:02:36.000: Reloading configuration.....\..\..\src\support\Systemcall.cpp (261): Systemcall: 'python -tt "C:/Program Files (x86)/LyX 2.1/Resources/configure.py" --binary-dir="C:/Program Files (x86)/LyX 2.1/bin/"' did not start! ..\..\..\src\support\Systemcall.cpp (262): error The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program. 04:02:37.804: (reconfigure) – Nike Oct 16 '15 at 19:04
  • Even when I right clicked lyx.exe and pressed "run as administrator" – Nike Oct 16 '15 at 19:04
  • @user1271772 There might be an issue with python versions. You could try changing your default Python version to something else. I've never had a problem with this type of issue on Ubuntu so I don't have many suggestions for you to try. – scottkosty Oct 16 '15 at 19:38
  • @scottkosty Thank you. How do I change python version? What does it even mean to change python version? My computer was brand new and the first thing I did was install the LyX 2.1 binary for Windows: I think this installed python automatically. There were no options related to python though, and I just kept all the default settings because my students said they had no trouble installing lyx on windows 10 (how embarrassing it is for me as their supervisor and the one that first taught them LyX, that now they can use it and I can't !!) – Nike Oct 17 '15 at 05:21
  • @user1271772 I wish I had more advice for you but I only use Ubuntu and don't understand Windows. You should not feel embarrassed at all. This problem is not because of you. It is probably due to a bug somewhere (either LyX or Windows). I recommend that you send an email to lyx-users@lists.lyx.org explaining your problem in detail. – scottkosty Oct 17 '15 at 16:16
1

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.

Pete P
  • 1,048
  • 7
  • 12