Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyTeX needs Perl #419

Closed
3 tasks done
mfansler opened this issue Aug 9, 2023 · 16 comments
Closed
3 tasks done

TinyTeX needs Perl #419

mfansler opened this issue Aug 9, 2023 · 16 comments
Assignees

Comments

@mfansler
Copy link

mfansler commented Aug 9, 2023

This issue is to report a finding that on the Conda Forge CI (running on image quay.io/condaforge/linux-anvil-cos7-x86_64), we found that tinytex::install_tinytex() would result in error unless Perl was installed on the system. I realize most end-user systems will have this, but containers may not, and I did not see this expectation documented. I suggest it should be documented.

For replication, here are examples running with and without Perl.

Failure without Perl

Shell

$ docker run --rm -it mambaorg/micromamba:1.4.9
(base) $ micromamba install -yn base -c conda-forge r-base=4.3 r-tinytex
(base) $ R -e 'tinytex::install_tinytex()'

Result

R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-conda-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> tinytex::install_tinytex()
trying URL 'https://yihui.org/tinytex/TinyTeX-1.tar.gz'
Content type 'application/octet-stream' length 92097989 bytes (87.8 MB)
==================================================
downloaded 87.8 MB

tlmgr option sys_bin ~/bin
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
tlmgr option repository 'https://mirror.mwt.me/ctan/systems/texlive/tlnet'
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
tlmgr update --list
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
tlmgr option repository ctan
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
BEGIN failed--compilation aborted at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.
You may have to restart your system after installing TinyTeX to make sure ~/bin appears in your PATH variable (https://github.com/rstudio/tinytex/issues/16).
Warning messages:
1: In system2("tlmgr", args, ...) :
  running command ''tlmgr' info --list --only-installed --data 'name'' had status 2
2: In tinytex::install_tinytex() :
  The repository https://mirror.mwt.me/ctan/systems/texlive/tlnet/ does not seem to be accessible. Reverting to the default CTAN mirror.
>

Expected behavior with Perl

Shell

$ docker run --rm -it mambaorg/micromamba:1.4.9
(base) $ micromamba install -yn base -c conda-forge r-base=4.3 r-tinytex perl
(base) $ R -e 'tinytex::install_tinytex()'

Result

R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-conda-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> tinytex::install_tinytex()
trying URL 'https://yihui.org/tinytex/TinyTeX-1.tar.gz'
Content type 'application/octet-stream' length 92097989 bytes (87.8 MB)
==================================================
downloaded 87.8 MB

tlmgr option sys_bin ~/bin
tlmgr: setting option sys_bin to /home/mambauser/bin.
tlmgr: updating /home/mambauser/.TinyTeX/tlpkg/texlive.tlpdb
tlmgr option repository 'https://ctan.mirrors.hoobly.com/systems/texlive/tlnet'
tlmgr: setting default package repository to https://ctan.mirrors.hoobly.com/systems/texlive/tlnet
tlmgr: updating /home/mambauser/.TinyTeX/tlpkg/texlive.tlpdb
tlmgr update --list
tlmgr: package repository https://ctan.mirrors.hoobly.com/systems/texlive/tlnet (not verified: gpg unavailable)
update:   texlive-scripts    [112k]: local:    67839, source:    67842
> 

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('tinytex'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/tinytex').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@mfansler mfansler changed the title TinyTex needs Perl TinyTeX needs Perl Aug 10, 2023
@yihui
Copy link
Member

yihui commented Aug 15, 2023

Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /home/mambauser/.TinyTeX/texmf-dist/scripts/texlive /home/mambauser/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /home/mambauser/.TinyTeX/bin/x86_64-linux/tlmgr line 87.

@norbusan I wonder if this error message could be improved when Perl is not present in the system. I don't know much about Perl, and I have no idea what this error message means. Thanks!

@mfansler
Copy link
Author

On second glance, looks like I was a bit hasty concluding that Perl wasn't installed in the first container. Rather, that error message is complaining that the File::Find module is missing.

@norbusan
Copy link

I don't understand, File::Find is a core perl module, if you have Perl installed, that module should be installed, too.

@mfansler
Copy link
Author

I don't understand, File::Find is a core perl module, if you have Perl installed, that module should be installed, too.

Apologies if I'm misinterpreting the error. 😬 (not a Perl person)

In the container I see:

$ docker run --rm -it mambaorg/micromamba:1.4.9
(base) $ which perl
/usr/bin/perl
(base) $ perl -v

This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-gnu-thread-multi
(with 47 registered patches, see perl -V for more detail)

Copyright 1987-2021, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

(base) $ perl -mFile
Can't locate File.pm in @INC (you may need to install the File module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl).
BEGIN failed--compilation aborted.

(base) $ perl -mFile::Find
Can't locate File/Find.pm in @INC (you may need to install the File::Find module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl).
BEGIN failed--compilation aborted.

I interpret that as Perl 5.32.1 is installed, but not the File::Find module. Note that this is a container targeting production, i.e., it's not surprising to find extreme minimization.

@norbusan
Copy link

norbusan commented Aug 16, 2023

Thanks @mfansler
Wow, that is really stripped down, and I consider this BADLY incorrect.
The image you are using is based on Debian, and only has perl-base installed.
To quote from https://packages.debian.org/bookworm/perl-modules-5.36

Architecture independent Perl modules. These modules are part of Perl and required if the `perl' package is installed.

Now, I agree that perl is not installed, only perl-base. But to be honest, this is badly broken because (to quote again):

Note that this package only exists to save archive space and should be considered an internal implementation detail of the perl package. Other packages should not depend on perl-modules-5.36 directly, they should use perl (which depends on perl-modules-5.36) instead.

So, as much as I understand your problem, I think this is purely a problem of a completely misconfigured docker image.

@mfansler
Copy link
Author

Good to know!

I think for Conda Forge purposes I'm going to have the package emit a message at installation time informing users that tinytex::install_tinytex() requires a perl installation. We could go as far as requiring perl through Conda, but I think this is such an edge case (and, as you identify, substandard context) that it should rarely be encountered. I won't pursue getting the micromamba image adjusted. It suffices for the target application (micromamba) and when needed a proper perl can easily be added to any Conda environment, as shown by OP.

For purposes of this issue, my take is that:

  • it would be helpful to document that perl is a requirement, and that perl-base is insufficient; and
  • it would improve user experience if tinytex::install_tinytex() checked for perl -mFile::Find prior to downloading, and short-circuited with a user-friendly message when unavailable

Thanks for the feedback/insights! I appreciate that this is in no way urgent (you both certainly have more productive matters at hand!) and perhaps just having this issue filed is satisfactory documentation.

@yihui
Copy link
Member

yihui commented Aug 17, 2023

I just tested on macOS and it's odd that perl -mFile also fails but tinytex::install_tinytex() works fine.

% which perl
/usr/bin/perl

% perl -mFile      
Can't locate File.pm in @INC (you may need to install the File module) (@INC contains: /Library/Perl/5.30/darwin-thread-multi-2level /Library/Perl/5.30 /Network/Library/Perl/5.30/darwin-thread-multi-2level /Network/Library/Perl/5.30 /Library/Perl/Updates/5.30.3 /System/Library/Perl/5.30/darwin-thread-multi-2level /System/Library/Perl/5.30 /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level /System/Library/Perl/Extras/5.30).
BEGIN failed--compilation aborted.

@mfansler
Copy link
Author

Sorry, that part might have been misleading. File::Find being a module probably doesn't entail File being a module. I was just trying it out.

@yihui
Copy link
Member

yihui commented Aug 17, 2023

perl -mFile::Find hangs on my machine and there's no output. Not sure why.

@mfansler
Copy link
Author

mfansler commented Aug 17, 2023

I believe it's waiting for input. Not sure what the standard is, but passing empty file (e.g., /dev/null) will get it going. Here's from macOS:

## not found
$ perl -mFile /dev/null
Can't locate File.pm in @INC (you may need to install the File module) (@INC contains: /Users/mfansler/miniconda3/lib/perl5/5.32/site_perl /Users/mfansler/miniconda3/lib/perl5/site_perl /Users/mfansler/miniconda3/lib/perl5/5.32/vendor_perl /Users/mfansler/miniconda3/lib/perl5/vendor_perl /Users/mfansler/miniconda3/lib/perl5/5.32/core_perl /Users/mfansler/miniconda3/lib/perl5/core_perl .).
BEGIN failed--compilation aborted.

## found
$ perl -mFile::Find /dev/null

So one could run something like:

$ perl -mFile::Find /dev/null 2> /dev/null

Then check that $? is 0.

@yihui
Copy link
Member

yihui commented Aug 17, 2023

Okay, that works. Thanks!

However, I think a better solution is to declare the dependency on perl for the (conda?) package r-tinytex. I prefer not having to manage this dependency inside an R function. I have no idea how conda packages are built, and don't know whom to contact in this case.

@mfansler
Copy link
Author

I have no idea how conda packages are built, and don't know whom to contact in this case.

I'm on the Conda Forge R team. 😉

However, I think a better solution is to declare the dependency on perl for the (conda?) package r-tinytex.

I hesitate to do this because it's a waste of 100 MB of disk space for users on desktop Linux or macOS (both have functional system Perl) and suspect they comprise the majority user base. I think an install message suffices for the DevOps people deploying to containers that actually need it. I'm only proposing to do this on the Conda Forge feedstock and requires nothing to be done here.

I prefer not having to manage this dependency inside an R function.

I'm already satisfied just having it documented. I think those that hit it could find it.

@yihui
Copy link
Member

yihui commented Aug 18, 2023

I'm already satisfied just having it documented.

Okay, I can certainly do that.

I'm on the Conda Forge R team.

Haha, didn't know that and good to know now!

@yihui yihui closed this as completed in a45272c Aug 19, 2023
@yihui yihui self-assigned this Aug 19, 2023
mfansler added a commit to conda-forge-admin/r-tinytex-feedstock that referenced this issue Oct 24, 2023
yihui added a commit that referenced this issue Nov 28, 2023
@pdimens

This comment was marked as off-topic.

@mfansler

This comment was marked as off-topic.

@mfansler
Copy link
Author

mfansler commented Jan 9, 2024

I've made the editorial decision to remove the notification emitted by the Conda Forge package regarding the need for Perl. There was both issue with the mechanism for emitting the message and confusion around interpretation of the message when it did work (users misinterpreted it as a warning/thought it meant Perl was not detected). In the end, seemed like more trouble than it was worth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants