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

cmdstan installation issue -- GitHub API Requests #1067

Closed
halljc76 opened this issue Mar 18, 2025 · 10 comments
Closed

cmdstan installation issue -- GitHub API Requests #1067

halljc76 opened this issue Mar 18, 2025 · 10 comments
Labels
bug Something isn't working

Comments

@halljc76
Copy link

halljc76 commented Mar 18, 2025

TL;DR: For anyone encountering this, we solved it through:

  • Creating a new Github PAT key (see one of the replies below)
  • Installing the package from the original R command in the tutorial below, not the development version

Describe the bug
In attempting to install cmdstanr, I follow the steps at here.

What Happens: There are 5 requests made to the API Link https://api.github.com/repos/stan-dev/cmdstan/releases/latest, but to no avail. Thus, the function does not download a file and returns an error.

To Reproduce
Run, quite literally, the same steps as the above link. This is followed through install_cmdstan(cores = 2).

Expected behavior
The GitHub API to obtain the necessary files for installation and perform the function to install cmdstan.

Operating system
Windows 11

CmdStanR version number
0.8.1

Additional context
I do have the message noting that the toolchain is installed correctly! Additionally, there were no messages of path issues before running install_cmdstan.

@halljc76 halljc76 added the bug Something isn't working label Mar 18, 2025
@jgabry
Copy link
Member

jgabry commented Mar 18, 2025

Are you getting a particular error message?

Either way, can you try installing the development version from GitHub instead and see if that helps?

You can do

remotes::install_github("stan-dev/cmdstanr")

And after that finishes then try

library(cmdstanr)
packageVersion("cmdstanr") # should be 0.8.1.9000
install_cmdstan(cores = 2)

@halljc76
Copy link
Author

I have tried the remotes::install_github() command, with the following error:

Using github PAT from envvar GITHUB_PAT
Error: Failed to install 'unknown package' from GitHub:
HTTP error 401.
Bad credentials

Rate limit remaining: 29/60
Rate limit reset at: 2025-03-18 16:49:02 UTC

I edited my original message with what occurred; the particular error message is simply

Error: GitHub download of release list failed with error: cannot open URL 'https://api.github.com/repos/stan-dev/cmdstan/releases/latest'

@andrjohns
Copy link
Collaborator

Are you on a corporate/university network? They can block some APIs

@halljc76
Copy link
Author

At the moment, I am not! Just on a home/apartment internet. :)

@andrjohns
Copy link
Collaborator

This error:

Using github PAT from envvar GITHUB_PAT
Error: Failed to install 'unknown package' from GitHub:
HTTP error 401.
Bad credentials

Indicates that the PAT you have stored in the GITHUB_PAT environment variable is not valid, and so Github is rejecting all requests as unauthorised

@halljc76
Copy link
Author

halljc76 commented Mar 18, 2025

Any recommendations on how to edit that environment variable? Or, do I need to do something w/in GitHub?

@andrjohns
Copy link
Collaborator

Any recommendations on how to edit that environment variable?

If you're not sure where you've set the environment variable or how to clear it, the easiest approach would just be to configure a new PAT. Try this guide: https://carpentries.github.io/sandpaper-docs/github-pat.html

@halljc76
Copy link
Author

Duly noted! I'll keep this open just in case it does not remedy the situation.

Thanks for the help!

@halljc76
Copy link
Author

halljc76 commented Mar 18, 2025

Update: The PAT issue is solved! I had an expired token. However, running @andrjohns next code to install_cmdstan encountered the error

fatal error: cannot write PCH file: required memory segment unavailable

This is after downloading the file and it begins unpacking. It is worth noting I did restart the R session and have closed all other windows besides the web browser I'm using here and RStudio itself.

@halljc76
Copy link
Author

Update 2: Installing the package from the original command (not the development version) after reconciling the PAT issue works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants