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 from AWS EC2 Windows Server #326

Closed
3 tasks done
MHDBNS opened this issue Aug 19, 2021 · 10 comments
Closed
3 tasks done

Tinytex from AWS EC2 Windows Server #326

MHDBNS opened this issue Aug 19, 2021 · 10 comments
Labels

Comments

@MHDBNS
Copy link

MHDBNS commented Aug 19, 2021

Hi,

I use RStudio from an AWS EC2 Windows Server. To get .pdf file from my rmarkdown I tried to install MiKTeX on my EC2 and faced some issues, so I decided to try the tinytex solution. I correctly installed the tinytex package but I had some trouble to install tinytex from it. For your info, following security reasons only selected websites are whitelisted. So to be able to install tinytex I asked for whitelisting:

yihui.org
miktex.org
ci.appveyor.com
www.ctan.org

but I still can't get tinytex installed on my EC2 Windows. I also downloaded separately TinyTeX.zip to install it but tinytex:::install_windows_zip() is not available anymore.

When I try tinytex::install_tinytex() I got the following error:

trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
Error in xfun::download_file(..., quiet = Sys.getenv("APPVEYOR") != "") :
  No download method works (auto/wininet/wget/curl/lynx)
In addition: Warning messages:
1: In download.file(url, output, ..., method = method) :
  InternetOpenUrl failed: 'A connection with the server could not be established'
2: In download.file(url, output, ..., method = method) :
  URL 'https://appveyorcidatav2.blob.core.windows.net/yihui-27038/tinytex/1-0-1628/31j2ygh3xv2sk7xd/TinyTeX-1.zip?sv=2015-12-11&sr=c&sig=HJOnYMwO2zT2iFAlwT859FH53nzIHB0oV2RslIq990g%3D&st=2021-08-05T14%3A40%3A04Z&se=2021-08-05T14%3A46%3A04Z&sp=r': status was 'SSL connect error'
3: In download.file(url, output, ..., method = method) :
  InternetOpenUrl failed: 'A connection with the server could not be established'

I am not sure to understand the error message, should I ask for whitelisting another websites?

For information, some insights related to my R config:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 14393), RStudio 1.3.959
Locale:
  LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
  LC_MONETARY=English_United States.1252 LC_NUMERIC=C
  LC_TIME=English_United States.1252
Package version:
  graphics_4.0.2  grDevices_4.0.2 stats_4.0.2     tinytex_0.33    tools_4.0.2
  utils_4.0.2     xfun_0.24

Thanks in advance for any assistance on that as I got no solution for my issue:
https://community.rstudio.com/t/tinytex-from-ec2-windows/112053
https://stackoverflow.com/questions/68708561/r-markdown-tinytex-install-mirrors-aws-ec2-windows

Mhd


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('yihui/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.

@cderv
Copy link
Contributor

cderv commented Aug 19, 2021

tinytex::install_tinytex() will by default install a daily build that is available as an appveyor artifact. It seems that some domain are missing in your whitelist. From the error message the artificat is retrieved from there: https://appveyorcidatav2.blob.core.windows.net
Those artifacts are made available behind https://yihui.org/tinytex/ with redirects, meaning that https://yihui.org/tinytex/TinyTeX-1.zip will redirect to this artifact.
First to https://ci.appveyor.com/ then to this https://appveyorcidatav2.blob.core.windows.net

The easiest things you can do is not install the daily version but the latest release

tinytex::install_tinytex(version = "latest")

In this case, it will download from github release page in tinytex-release repo. Maybe github.com is easier to whitelist in your case.

Also know that you can do manual install

  • Get a release at https://github.com/yihui/tinytex-releases
  • Upload the downloaded file to your EC2 server
  • Use tinytex:::install_prebuilt(pkg = ) with the path to the bundle you would have downloaded in step one.

This should not require internet access. However if you want to install CTAN package to render you document, you need also to have internet access to a CTAN mirror.

The bundle Tinytex.zip is the most heavy and contains already a bunch of package in the bundle. It could be enough for most usage.

Hope it helps

@MHDBNS
Copy link
Author

MHDBNS commented Aug 19, 2021

Thanks @cderv for your help! I tried each option but it did not work for me.

I tried tinytex::install_tinytex(version = "latest") but I got this error:

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : InternetOpenUrl failed: ''

And when I try: tinytex:::install_prebuilt(pkg = "~/Desktop/TinyTeX.zip") I get the following error message :

Error in system2("tlmgr", args, ...) : '"tlmgr"' not found
In addition: Warning message:
In extract(pkg, exdir = path.expand(target)) :
  error 1 in extracting from zip file

Is there something I can do to solve this issue?

Thank guys!

@cderv
Copy link
Contributor

cderv commented Aug 19, 2021

tinytex::install_tinytex(version = "latest")

requires that you get an internet connection to have the last github release fetch.

xfun::github_releases("yihui/tinytex-releases", "latest")

This reaches https://github.com

About

tinytex:::install_prebuilt(pkg = "~/Desktop/TinyTeX.zip")

In seems that unzipping did not work. You add an error. I don't know why. You can try unzip("~/Desktop/TinyTeX.zip", extdir = '<path-somewhere>') to check why the unzipping does not work.

Can you open the zip file on your system ?

@MHDBNS
Copy link
Author

MHDBNS commented Aug 20, 2021

Which is weird is that I can reach https://github.com using Chrome that I installed on the EC2 Windows but it fails when I try to reach github through this command:

xfun::github_releases("yihui/tinytex-releases", "latest")

About

tinytex:::install_prebuilt(pkg = "~/Desktop/TinyTeX.zip")

I can unzip and open outside RStudio and it is weird but as soon as I replace the ~ by the complete path the unzip() function works under R. However even if I put the complete path in ìnstall_prebuilt()`function it does not work and ends with the following error:

The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.

@yihui
Copy link
Member

yihui commented Aug 20, 2021

I can unzip and open outside RStudio and it is weird but as soon as I replace the ~ by the complete path the unzip() function works under R.

I just fixed that issue.

The system cannot find the path specified.

You can ignore this message if tinytex:::is_tinytex() returns TRUE.

@MHDBNS
Copy link
Author

MHDBNS commented Aug 23, 2021

Hi @yihui
Thanks for your reply. Indeed tinytex:::is_tinytex() now returns TRUE. However it seems that TeX is not done with me and wants me to suffer a little bit more.
Have any idea on that message error?

! ...PA011661\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:935: ...PA011661\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:858: no appropriate script or program found: fmtutil
! Running the command D:\Users\PA011661\AppData\Roaming\TinyTeX\bin\win32\fmtutil-user.exe

! Running the command D:\Users\PA011661\AppData\Roaming\TinyTeX\bin\win32\fmtutil-user.exe

! kpathsea: Running mktexfmt pdflatex.fmt

! The command name is D:\Users\PA011661\AppData\Roaming\TinyTeX\bin\win32\mktexfmt

Error: LaTeX failed to compile test4.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test4.log for more info.
Execution halted

No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/

  If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex()

  Otherwise consider MiKTeX on Windows - http://miktex.org

  MacTeX on macOS - https://tug.org/mactex/
  (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

  Linux: Use system package manager

In the test4.log file I have exactly what is indicated above. And by the way I do not understand why R says that there is no LaTeX installation as tinytex:::is_tinytex() returns TRUE.

Thanks!

@yihui
Copy link
Member

yihui commented Aug 23, 2021

! ...PA011661\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:935: ...PA011661\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:858: no appropriate script or program found: fmtutil

I don't know why that could be possible. Could you check if fmtutil.exe exists?

file.exists(r"(D:\Users\PA011661\AppData\Roaming\TinyTeX\bin\win32\fmtutil.exe)")
# should return TRUE

tinytex:::fmtutil()
# should return a long log with the last line being
# fmtutil [INFO]: exiting with status 0

No LaTeX installation detected

You can ignore that. RStudio is unable to detect LaTeX when it's not added to the PATH variable. It seems in your environment, you don't have the privilege to edit the PATH variable, otherwise this should suceed:

(tinytex::tlmgr_path())  # should return 0

@MHDBNS
Copy link
Author

MHDBNS commented Aug 23, 2021

I have just re-installed the TinyTex from the .zip file and it works!!! Finally!
Maybe one last question for my specific case. How should I do in case one TeX package is missing? I have whitelisted a CTAN mirror. How should I specify this mirror to be used if a package is missing? Thanks again guys for your assistance.

@yihui
Copy link
Member

yihui commented Aug 23, 2021

Great!

If you want to specify a specific CTAN mirror, you can use tinytex::tlmgr_repo() (see its help page for usage).

@yihui yihui closed this as completed Aug 24, 2021
@MHDBNS
Copy link
Author

MHDBNS commented Aug 25, 2021

Many thanks for your help @yihui and @cderv !

@cderv cderv added the question label Aug 30, 2021
clrpackages pushed a commit to clearlinux-pkgs/R-tinytex that referenced this issue Sep 30, 2021
…0.34

Christophe Dervieux (1):
      quote the `--data` argument for `tl_sizes()` (#330)

Yihui Xie (4):
      start the next version
      expand ~ in the package path: rstudio/tinytex#326 (comment)
      amscls is newly required
      CRAN release v0.34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants