Download of CmdStan failed from GitHub

Hi, I already have cmdstanr working and I saw a message about updating it. Then I encountered this error. Coincidentally, my coworker is trying to install cmdstan for the first time and he is encountering the same error. Please help.

> install_cmdstan(cores = 2)
The C++ toolchain required for CmdStan is setup properly!
* Latest CmdStan release is v2.28.2
* Installing CmdStan v2.28.2 in /mnt/home/u062721/.cmdstanr/cmdstan-2.28.2
* Downloading cmdstan-2.28.2.tar.gz from GitHub...
Error: Download of CmdStan failed. Please try again.
1 Like

Can you try

install_cmdstan(release_url="https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz")

?

>install_cmdstan(release_url="https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz")

The C++ toolchain required for CmdStan is setup properly
Installing CmdStan from https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz
Error: Download of CmdStan failed. Please check if the supplied release URL is valid.

@rok_cesnovar - any insights?

Can you try running:

utils::download.file(url = "https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz", destfile =tempfile(fileext = ".tar.gz"))

The most likely cause is that you are unable to download a file from Github for some reason. The reasons for that can be: firewall issues, you or your organization (if everyone is behind the same IP) hit the rate limit to Github or something else.

The above line should provide us with a bit more info.

This is what I see:

trying URL 'https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz'
Error in utils::download.file(url = "https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz",  : 
  cannot open URL 'https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz'
In addition: Warning message:
In utils::download.file(url = "https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz",  :
  URL 'https://objects.githubusercontent.com/github-production-release-asset-2e65be/16967338/12e28f63-e66f-41ea-af5c-1e3b4a515df6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211207%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211207T191040Z&X-Amz-Expires=300&X-Amz-Signature=2ff683e17e00df03c384054ace86387ef7378f6e90b1c321aeb3d7232dcc8278&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=16967338&response-content-disposition=attachment%3B%20filename%3Dcmdstan-2.28.2.tar.gz&response-content-type=application%2Foctet-stream': status was 'SSL connect error'

If I download the tar file and store in a folder, is there a command that allows me to install cmdstan using a local tar? Thanks.

Ohhh, I believe AWS is experiencing issues or degraded performance in some locations - https://status.aws.amazon.com ( the URLs in the error message mentions AWS, so I am going to assume Github stores it there).

You can definitely try to download it manually. In that case just store it to the following location:

file.path(cmdstanr::cmdstan_default_install_path(), "cmdstan-2.28.2")

and untar the file there and then call

rebuild_cmdstan()
1 Like

That’s most likely the cause. AWS is down on my side too. Thx @rok_cesnovar

Hi, I managed to download the 2.28.2.tar.gz manually and untar it in the “cmdstan-2.28.2” folder. But I am still having the following issue. Would you know what the issue is?

>set_cmdstan_path(path = "~/.cmdstanr/cmdstan-2.28.2")
CmdStan path set to: ~/.cmdstanr/cmdstan-2.28.2
Warning message:
Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 
> rebuild_cmdstan()
make: *** No rule to make target 'clean-all'.  Stop.
make: *** No rule to make target 'build'.  Stop.
Warning messages:
1: Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 
2: Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 
3: Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 
4: Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 
5: Can't find CmdStan makefile to detect version number. Path may not point to valid installation.

If you go to the ~/.cmdstanr/cmdstan-2.28.2 folder, does it have another cmdstan-xyz folder in it?

it should have the bin, src and other folders in it directly.

These are what I see inside the ~/.cmdstanr/cmdstan-2.28.2 folder

$ ls
bin       install-tbb.bat  lib      make      README.md           src   test-all.sh
examples  Jenkinsfile      LICENSE  makefile  runCmdStanTests.py  stan

Hm, that looks fine at first glance. Can you paste the contents of the makefile. Maybe there was an issue when downloading or untarring.

##
# CmdStan users: if you need to customize make options,
#   you should add variables to a new file called
#   make/local (no file extension)
#
# A typical option might be:
#   CXX = clang++
#
# Users should only need to set these variables:
# - CXX: The compiler to use. Expecting g++ or clang++.
# - O: Optimization level. Valid values are {s, 0, 1, 2, 3}.
#      Default is 3.
# - STANCFLAGS: Extra options for calling stanc
##

# The default target of this Makefile is...
help:

-include $(HOME)/.config/stan/make.local  # user-defined variables
-include make/local                       # user-defined variables
"makefile" 351L, 12017C                                                                    2,1           Top

Yeah, that file is broken. It should have 351 files. So either the download failed or the untar was unsuccesful.

It’s solved! I untared wrong. Thank you.