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

[setup-r] Ghostscript and/or qpdf installation error on Windows #812

Closed
MichaelChirico opened this issue Mar 25, 2024 · 17 comments
Closed

Comments

@MichaelChirico
Copy link
Contributor

I am trying to activate a Windows runner for data.table (Rdatatable/data.table#6022) but 2 of 3 runs I've tried so far failed at the setup-r phase (example failure; associated config):

Error: Failed to get R release: Failed to get qpdf and ghostscript in 10 tries :(

Poking around for how this error has been resolved elsewhere did not turn up much:

The only thing that sticks out to me as different for our setup vs. e.g. that of {lintr} which I'm more familiar with is this setup-pandoc step. And indeed after adding that step my pipeline passed, making me wonder if this step is recommended for Windows.

This is somewhere between a bug report and a documentation request -- if adding setup-pandoc is really the right fix, it would be nice for it to be documented somewhere; if this apparent relationship to setup-pandoc is spurious, it would be nice to get a recommended fix to stabilize the windows check.

@MichaelChirico MichaelChirico added the bug an unexpected problem or unintended behavior label Mar 25, 2024
@gaborcsardi
Copy link
Member

gaborcsardi commented Mar 25, 2024

This was an error in the chocolatey repo where we install ghostscript and qpdf from. It seems to be fixed already. [1] It has nothing to do with setup-pandoc.

[1] https://github.com/r-lib/actions/actions/runs/8358418322/job/23043762630#step:4:42

@gaborcsardi gaborcsardi removed the bug an unexpected problem or unintended behavior label Mar 25, 2024
@gaborcsardi
Copy link
Member

gaborcsardi commented Mar 25, 2024

Ah, now it is failing with

ghostscript not installed. The package was not found with the source(s) listed.
 Source(s): 'https://community.chocolatey.org/api/v2/'
 NOTE: When you specify explicit sources, it overrides default sources.
If the package version is a prerelease and you didn't specify `--pre`,
 the package may not be found.
Please see https://docs.chocolatey.org/en-us/troubleshooting for more
 assistance.

https://github.com/r-lib/callr/actions/runs/8417567882/job/23046294770#step:4:19

This sucks, because while ghostscript provides a windows installer (https://github.com/ArtifexSoftware/ghostpdl-downloads/releases), it does not work non-interactively:
https://artifex.com/news/ghostscript-10.01.0-disabling-silent-install-option

We could put the Ghostscript.app choco package into a GH release, and download and install it manually, I guess. It also needs that autohotkey.portable package. Installation goes like this:

Invoke-WebRequest -Uri https://community.chocolatey.org/api/v2/package/Ghostscript.app -outfile Ghostscript.app.nupkg
choco install Ghostscript.app -source .

(First the same for autohotkey.portable.)

Check installation:

❯ where.exe gswin64c
C:\Program Files\gs\gs10.03.0\bin\gswin64c.exe

@gaborcsardi gaborcsardi reopened this Mar 25, 2024
@gaborcsardi
Copy link
Member

Btw. qpdf is included in Rtools43 (possible Rtools42 as well), so we don't need to download that for newer R versions.

@cderv
Copy link
Contributor

cderv commented Mar 25, 2024

It seems an issue with choco service - we install R on several runners for Quarto and it only fails for some
https://github.com/quarto-dev/quarto-cli/actions/runs/8417921833/job/23047356466

Though there is a retry mechanism and it fails all the tries.

This sucks, because while ghostscript provides a windows installer (ArtifexSoftware/ghostpdl-downloads/releases), it does not work non-interactively:
artifex.com/news/ghostscript-10.01.0-disabling-silent-install-option

About this, I do understand the .exe file could be extracted as an archive and then the bin and lib folder added to PATH.
This is how the installation with "Scoop" windows package manager works.

@gaborcsardi
Copy link
Member

gaborcsardi commented Mar 25, 2024

About this, I do understand the .exe file could be extracted as an archive and then the bin and lib folder added to PATH.

Possibly, with 7zip, but the installer also creates some registry entries. So I think it is cleaner to put the choco package (and its single dependency) to GH releases and then download and install them manually with choco.

@cderv
Copy link
Contributor

cderv commented Mar 25, 2024

but the installer also creates some registry entries

Yes I saw that. "Scoop" manifest did add some manual registry addition following the 10.01.0 update
https://github.com/ScoopInstaller/Main/blob/f612116c30348f0624ffe50ae8951336bcfcef7c/bucket/ghostscript.json#L35-L53

So I think it is cleaner to put the choco package (and its single dependency) to GH releases and then download and install them manually with choco.

It would indeed work if they maintain their choco app.

It seems the issue is happening from time to time. The previously failed job are working currently

@gaborcsardi
Copy link
Member

gaborcsardi commented Mar 25, 2024

It would indeed work if they maintain their choco app.

We would download the choco package and put it on GH releases. I doubt that we would need to update it frequently.

And we are already doing this, we might as well do it for qpdf.

@gaborcsardi gaborcsardi pinned this issue Mar 25, 2024
@gaborcsardi gaborcsardi changed the title Is setup-pandoc step strongly recommended (required?) for Windows R CMD check? [setup-r] Ghostscript and/or qpdf installation error on Windows Mar 25, 2024
@gaborcsardi
Copy link
Member

This should be fixed now in @v2. Please let me know if you still see issues.

@cderv
Copy link
Contributor

cderv commented Mar 28, 2024

Just to share I got this error with new workflow today

Error while running 'C:\ProgramData\chocolatey\lib\Ghostscript.app\tools\ChocolateyInstall.ps1'.
   See log for details.
  Unable to move directory 'C:\ProgramData\chocolatey\lib\Ghostscript.app':
   (5) Access is denied: [\\?\C:\ProgramData\chocolatey\lib-bad\Ghostscript.app\10.3.0]
  Retrying by moving individual files
  Unable to move file 'C:\ProgramData\chocolatey\lib\Ghostscript.app\tools\gs10030w64.exe':
   (32) The process cannot access the file because it is being used by another process: [\\?\C:\ProgramData\chocolatey\lib-bad\Ghostscript.app\10.3.0\tools\gs10030w64.exe]

I'll see if this will happen again or not.

@gaborcsardi
Copy link
Member

@cderv can you show the workflow and the workflow run?

@cderv
Copy link
Contributor

cderv commented Mar 28, 2024

This was here: https://github.com/quarto-dev/quarto-cli/actions/runs/8457845577/job/23170802370?pr=9206#step:4:84
Re-run failed job solved it so it was not persistent

@gaborcsardi
Copy link
Member

Thanks, for the record, there is this:

Wed, 27 Mar 2024 20:06:38 GMT  Installing 64 bit version
Wed, 27 Mar 2024 20:06:38 GMT  Installing Ghostscript.app...
Wed, 27 Mar 2024 20:51:37 GMT  Chocolatey timed out waiting for the command to finish. The timeout 
Wed, 27 Mar 2024 20:51:37 GMT   specified (or the default value) was '2700' seconds. Perhaps try a
Wed, 27 Mar 2024 20:51:37 GMT   higher `--execution-timeout`? See `choco -h` for details.

so I suspect that something happened during the ghostscript install, probably an interactive prompt.

And that also made the whole step stuck:

Wed, 27 Mar 2024 20:51:53 GMT  Error: Failed to get R 4.3.2: Failed to get qpdf and ghostscript.
Thu, 28 Mar 2024 01:58:00 GMT  Error: The operation was canceled.

On the one hand, this is not great. On the other hand, if it happened with the local install it can probably happen with the non-local install...

In any case, definitely something to keep an eye on.

@gaborcsardi gaborcsardi reopened this Mar 28, 2024
@cderv
Copy link
Contributor

cderv commented Mar 29, 2024

It happened again, but only in one of the 20 windows install we do in the same CI run
https://github.com/quarto-dev/quarto-cli/actions/runs/8475926973/job/23224776001#step:4:48

I don't see for now what condition or state triggers it 🤔

@gaborcsardi
Copy link
Member

@cderv I'll see if setting the registry is important, probably not. Then we can just uncompress a ZIP and set the path instead of the choco install...

@gaborcsardi
Copy link
Member

OK, I updated setup-r, to download ghostscript from a zip file. Seems to work well. Plus qpdf is not needed, actually, it is now part of rtools. Will update @v2 tomorrow.

@gaborcsardi
Copy link
Member

OK, @v2 now downloads and extract a .zip file for GHostscript. This should work much better. Please let me know if you still see issues.

Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2024
@gaborcsardi gaborcsardi unpinned this issue Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants