Hi All,

I recently became aware of what appears to be some kind of incompatibility 
between the Perl distribution that is included in the RTools 4.4 distribution 
and my WriteXLS package on CRAN, running R 4.4.1. As far as I can tell, since 
the vast majority of the users of my package, which requires Perl, are running 
standard Perl installations, that is native OS, Strawberry Perl or Active State 
Perl, this appears to be something of a unique issue. 

It is not clear to me what the root cause of the problem is, and whether it is 
the RTools Perl binary itself and/or any of the other related components that 
are included in RTools, if this is specific to RTools, or may be an upstream 
issue from MSYS2. Thus, before I think about going down the rabbit hole, I am 
wondering if anyone has any intuitive guidance on this issue.

I was also a bit confused by this, as my aging memory recalled that the old 
Vanilla Perl had been removed from RTools many years ago circa R 2.x.y, so 
presume that there was motivation to reintroduce Perl in recent versions of 
RTools.

I have been able to largely replicate the problem on my MacBook Pro, running a 
Windows 11 VM under Parallels on macOS 14.5, and confirmed a workaround using a 
current Strawberry Perl installation for Windows on the same system. 

The initial report was from a user running Windows 10 on a native Intel based 
PC, with R 4.4.1 and RTools 4.4 installed, and they reported the following 
error:

> WriteXLS::WriteXLS(iris, "test.xlsx", verbose=T)
Creating Temporary Directory for CSV Files:  
C:\Users\Kleinbub\AppData\Local\Temp\RtmpuO4911/WriteXLS 

Creating CSV File: 1.csv
Creating SheetNames.txt

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LANG = "en"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
. No such file or 
directory\Kleinbub\AppData\Local\Temp\RtmpuO4911/WriteXLS/1.csv
Creating Excel File: C:\Users\Kleinbub\Documents\test.xlsx

Reading: C:\Users\Kleinbub\AppData\Local\Temp\RtmpuO4911/WriteXLS/1.csv
The Perl script 'WriteXLSX.pl' failed to run successfully.
Cleaning Up Temporary Files and Directory


The basic workflow steps are that my R code wrapper function writes a CSV file 
containing the 'iris' dataframe into a temporary directory, my Perl script then 
reads in and parses that CSV file. and creates the Excel file using the 
relevant Perl packages included. The 'verbose = TRUE' setting outputs some 
additional diagnostic messages.

Note above that there are some warnings regarding locale settings from Perl, 
which I could not replicate on my Windows VM, albeit I can replicate the key 
error and failure of the Perl script as indicated.

If I run the same test code on my Windows 11 VM system, I get the following, 
including the initial testing function, which points to Perl in RTools:

> testPerl()
A system perl installation found in C:\rtools44\usr\bin\perl.exe

The perl modules included with WriteXLS are located in 
C:/Users/marcschwartz/AppData/Local/R/win-library/4.4/WriteXLS/Perl

All required Perl modules were found.

> WriteXLS(iris, "test.xlsx")
ERROR: cannot open 
C:\Users\MARCSC~1\AppData\Local\Temp\RtmpmKwGGX/WriteXLS/1.csv
. No such file or directory
The Perl script 'WriteXLSX.pl' failed to run successfully.


Note that I do not get the locale warnings, and this does not appear to be a 
permissions issue, but the Perl script still fails after indicating the 
inability to find the CSV file in the temporary directory.

With a Strawberry Perl installation in place, and explicitly pointing 
WriteXLS() to that Perl binary, I get a successful creation of the Excel file:

> WriteXLS(iris, "test.xlsx", perl = "C:\\Strawberry\\perl\\bin\\perl")
> 
> WriteXLS(iris, "test.xlsx", perl = "C:/Strawberry/perl/bin/perl")
>


Thus, I am confused as to the source of the incompatibility, and may be missing 
some nuances regarding the Perl binary and related components in RTools.

Any thoughts/pointers would be appreciated. 

Thank you,

Marc Schwartz

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to