LyX system reconfiguration failure - lyx

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?

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.

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.

Related

php-cs-fixer got broken for linux users after fixing the issue 6 for windows users

I use Linux Ubuntu 16.04. I have well installed php-cs-fixer for atom 1.9.8.
$ php-cs-fixer
PHP CS Fixer version 1.11.6 by Fabien Potencier
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
fix Fixes a directory or a file
help Displays help for a command
list Lists commands
readme Generates the README content, based on the fix command help
self-update Update php-cs-fixer.phar to the latest version.
selfupdate Update php-cs-fixer.phar to the latest version.
The problem comes with config of php-cs-fixer with atom. In fact, package requires:
a PHP Executable path (which is by defaut php) (for linux user it must be empty which is not possible with actual version of the package) (see isse #6 )
a PHP-CS fixer Executable path (which is simply for linux user php-cs-fixer (without the use of PHAR file))
Consequently, when I run php-cs-fixer from atom I get this error: Could not open input file: php-cs-fixer.
I can generate this error message with this console command:
php php-cs-fixer fix Class.php
Could not open input file: php-cs-fixer
So, can you make PHP Executable path optional (not compulsory) for that package of atom???
thanks,
Update on this issue:
I managed to download php-cs-fixer.phar from https://github.com/FriendsOfPHP/PHP-CS-Fixer and I put it in the folder ~/.composer/ so that:
a PHP Executable path is php
a PHP-CS fixer Executable path is: ~/.composer/php-cs-composer.phar
But now I am getting this error: Could not open input file: ~/.composer/php-cs-fixer.phar
So what's wrong??
For you information, running the console php ~/.composer/php-cs-composer.phar Class.php command is successful.
The solution is found on github:
a PHP Executable path is php
a PHP-CS fixer Executable path is: /home/username/.composer/php-cs-composer.phar and don't use the ~ in atom.

running .exe from R: status 127 warning on Linux not on Windows

I'm calling an .exe from R using system("script.exe object").
I get Warning: running command had status 127. I know it means the .exe file has not been found.
I'm on windows. When I use shell instead of system it works like a charm. However, I am designing a Shiny application that will be deployed in a Linux environment (shinyapps.io). This is why I need to use system.
EDIT
On Windows, it works with system(paste("cmd.exe /c", "script.exe object"), intern = FALSE, wait = TRUE) as suggested here. But not when I deploy the app (on Linux).
HINT
Locally on Windows, if I replace system with system2: system2(paste("cmd.exe /c", "script.exe object"), wait = TRUE), it raises the status 127 warning and the output is exactly the same as in my deployed app on Linux.
It's tough to create a reproducible example here but if needed I can try. Please tell me.
Context: basically the .exe is a black box (compiled C++ code) that takes a .txt file as input and outputs another .txt file. I am using R to dump the .txt file to the current working directory, then read back in the .txt file generated by the .exe (created in the current working directory, where the .exe file is stored).
Just add \" could solve you problem, e.g.
> setwd("W:/www/ADemo/")
> system(paste0(getwd(),"/Hi 2.exe"))
Hello, world.
> setwd("W:/www/A Demo/")
> system(paste0(getwd(),"/Hi 2.exe"))
Warning message:
running command 'W:/www/A Demo/Hi 2.exe' had status 127
> system(paste0("\"",getwd(),"/Hi 2.exe","\" "))
Hello, world.
Update:
The 127 error is usually seen when there is a space in the path. One also needs to worry about the input of the application, e.g. "/path A/A 2" --in-path "/home/A/B C/d 123.dta". Here are some update comments:
system(shQuote(paste0(getwd(),"/Hi 2.exe"))) is much more convenient.
At least in R 3.2.4, the manual of system() recommends to use system2() instead to avoid path problem under Win/Linux/OSX/.
Update 2:
For Linux user, I created a function to detect the given file in your working directory is executable or not:
chkpermission<-function(file, mode='0777'){
exe_list <- system("echo `ls -l | grep -E ^-.{2}x\\|^-.{5}x\\|^-.{8}x` | awk '{print $9}'", intern=T)
if(length(exe_list)==0){
stop("no file is executable");
##Make sure you know what you are doing here, add a+x permission:
## if (!(file%in%exe_list)) Sys.chmod(file, mode = mode)
}
return(file%in%exe_list);
}
I've tested it on GNU awk/grep. The 2/5/8 indicates the executable permission of [u/2]ser, [g/5]roup, [o/8]thers., one could change it to meet the requirement.
The problem actually stemmed from the fact that .exe files are executables for Windows only. It does not work out of the box on Linux environments (you can use WINE but in my case it is not possible because I am calling the executable from within R, I don't have any sudo rights or anything on the virtual machine used by the host of my app). So I compiled the c++ code I had using g++ on a Linux virtual machine and used the .out file rather than the .exe.
Then in my R script I just needed these two calls:
system("chmod a+x script.out") # to make Linux understand that the file is an executable
system("./script.out object") # to run the script

Unable to run R script through .bat files in Windows Server

I'm trying to run a R script through a .bat file. When I run myself the commands line by line it works. But when I try to run the .bat file, it doesn't works.
This is the .bat file
cd "C:\Program Files\R\R-3.1.2\bin"
R CMD BATCH "C:\Users\Administrator\Downloads\testa_vps.R"
This is the R script
setwd('C:\Users\Administrator\Documents')
file.create('mycsv.csv')
I'm not an expert with Windows and generally try to stick to Unix-like systems for things like this, but I have found that using programs non-interactively (e.g. via .bat files) is usually less error-prone when you add the appropriate directories to your (user) PATH variable, rather than cding into the directory and calling the executable from within the .bat file. For example, among other things, my user PATH variable contains C:\PROGRA~1\R\R-3.0\bin\; - the directory that contains both R.exe and Rscript.exe - (where PROGRA~1 is an alias for Program Files which you can use in an unquoted file path, since there are no spaces in the name).
After you do this, you can check that your PATH modification was successful by typing Rscript in a new Command Prompt - it should print out usage information for Rscript rather than the typical xxx is not recognized as an internal or external command... error message.
In the directory C:\Users\russe_000\Desktop\Tempfiles, I created test_r_script.r, which contains
library(methods)
setwd("C:\Users\russe_000\Desktop\Tempfiles")
file.create("mycsv.csv")
and test_r.bat, which contains
Rscript --vanilla --no-save "C:\Users\russe_000\Desktop\Tempfiles\test_r_script.r"
Clicking on the Windows Batch File test_r ran the process successfully and produced mycsv.csv in the correct folder.
Before running test_r.bat:
After running test_r.bat:
I've never worked with a Windows server, but I don't see why the process would be fundamentally different than on a personal computer; you just may need your sysadmin to modify the PATH variable if you don't have sufficient privileges to alter environment variables.
As already suggested by #nrussel in the comments you should use RScript.exe for this.
Create a file launcher.bat with the following content:
cd C:\Users\Administrator\Documents
Rscript testa_vps.R
In addition, add C:\Program Files\R\R-[your R version]\bin\x64; or C:\Program Files\R\R-[your R version]\bin\i386to the System PATH variable in the Environment Variables menu depending if you run R on a 64-bit or 32-bit system.
I just tested the approach above successfully on a Windows Server 2008 64-bit system and mycsv.csv got created as expected.
EDIT
One important point I forgot to mention is the following: You need to specify the path in your R file in the setwd() call using \\ instead of \.
setwd('C:\\Users\\Administrator\\Documents')
Here is a screenshot of the successful run on the Windows 2008 server:
Note: I added cmd /k to the .bat file so that the cmd window stays open after clicking on the file.

Spyder not recognizing splinter

Though splinter is installed on my Windows Vista, spyder gives an error when I import it.
When I import in windows command prompt, it successfully imports & also shows path to the init file.
Have added explicit path in PYTHONPATH Manager of Spyder and Updated module list. Yet, did not help.
Have checked my PATH environment variable. It contains the path to Python, Python/Scripts & Python/Lib/site-packages. PATH contains no spaces and PATH is indeed named as PATH & not as Path (probably thats why able to import successfully via command prompt)
When I try to install splinter again (just to confirm if it exists or not), pip says it already exists. When I try to upgrade, pip says it is already up-to-date
Have read lots & lots of articles on stackoverflow & across the web, but no solution helped.
Spyder recognizes other packages like os, numpy, etc.
Had run this code successfully on a temporary testing machine. Now trying to run on my system and its failing with error ImportError: No module named 'splinter'
Python ver. 3.4; Spyder ver. 3.4
Hoping for a solution...
Complete trackeback:
runfile('E:/Rampy/DS/Python/Code/AGMARK.py', wdir='E:/Rampy/DS/Python/Code')
Traceback (most recent call last):
File "", line 1, in
runfile('E:/Rampy/DS/Python/Code/AGMARK.py', wdir='E:/Rampy/DS/Python/Code')
File "C:\Users\ramprasad.g\AppData\Local\Continuum\Anaconda3\lib\site->packages\spyderlib\widgets\externalshell\sitecustomize.py", line 580, in runfile
execfile(filename, namespace)
File "C:\Users\ramprasad.g\AppData\Local\Continuum\Anaconda3\lib\site->packages\spyderlib\widgets\externalshell\sitecustomize.py", line 48, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "E:/Rampy/DS/Python/Code/AGMARK.py", line 8, in
from splinter import Browser
ImportError: No module named 'splinter'
Okay. So, I could make it work with a work-around.
Inspite of adding C:\Python34 & its Lib (site-packages) folder to PATH environment variable and Spyder's Python Path Manager, it failed to recognize splinter package while running the code in Spyder. So, I copied & pasted Splinter (followed by Selenium) package-folders from C:\Python34\Lib\site-packages (location where PIP installed the packages) to C:\Users\ramprasad.g\AppData\Local\Continuum\Anaconda3\Lib\site-packages (Anaconda's package location which alone Spyder seems to recognize) and boom! It started working!

Cannot install AutoIT library for Robot Framework

I'm going to install AutoIT library for Robot framework to do automation task for Win Application, during on this, I've encountered a problem as below:
My OS : Win Vista 32-bits
1. Install Python 2.7.6 using Windows installer
2. Install Robot Framework using 'pip' command line
3. Run 'python setup.py install' from C:/temp/AutoItLibrary-1.1 (unzipped) by Administration permission.
The command line show error:
Don't think we need to unregister the old one...
%SYSTEMROOT%\system32\regsvr32.exe /S C:\Python27\Lib\site-packages\AutoItLibrary\lib\AutoItX3.dll
The system cannot find the path specified.
Traceback (most recent call last):
File "setup.py", line 70, in <module>
subprocess.check_call(cmd, shell=True)
File "C:\Python27\lib\subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '%SYSTEMROOT%\system32\regsvr32.exe /S C:\Python27\Lib\site-p
ackages\AutoItLibrary\lib\AutoItX3.dll' returned non-zero exit status 1
So, Does the version Autoit_1.1. match with Win Vista or not ? please help me figure out the issue.
In my case the problem was solved setting the missing environment variable HOMEDRIVE and run python setup.py install as administrator. My Python is installed in C:\Python27 so I need to set HOMEDRIVE to C:
Login as an Administrator to console and then install (case from win 8.1)
Try installing wheel before installing robotframework-autoitlibrary.
It worked like a charm.
pip install wheel
then
pip install robotframework-autoitlibrary
I solve the problem by the following steps:
1> go to
http://www.testingnotes.eu/howto-install-robot-framework-windows-7-8-64/
find the paragraph as below:
Download AutoIT library (64bits) from here:
AutoItLibrary-1.1_x64
8.1. Unzip “AutoItLibrary-1.1_x64” folder. (i.e. in this example I will unzip to “C:\”)
8.2. Open command shell as Administrator. Click on “Start”, type “cmd”, right click > “Run as Administrator“).
8.3. Go to AutoIT folder (i.e. in this example I had to type: “cd C:\AutoItLibrary-1.1_x64”
8.4. Run configuration script: type “setup.py install” and ENTER.
the key point is
8.2. Open command shell as Administrator. Click on “Start”, type “cmd”, right click > “Run as Administrator“).
2> just do it: Click on “Start”, type “cmd”, right click > “Run as Administrator“.
I am from China, before answer the question when I get the solution, I need to over the wall. It is not easy.
Remove everything under Python/AutoItLibrary folder:
..\Python36\Lib\site-packages\AutoItLibrary
and rerun python setup.py install
it will work.
run pip install robotframework-autoitlibrary as an admin.
I'll fix this problem by installing AutoIT on local computer (log to computer by local account) not member of domain(log with domain). And it's solved.

Resources