adamhaber / stan2tfp

stan2tfp is a lightweight interface to the TensorFlow Probability backend of the Stan compiler. It provides the necessary objects and functions to compile a Stan program and fit the model to data using TFP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken download of stan2tfp compiler

kuchaale opened this issue · comments

Running your example I encountered the following error:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In [5], line 1
----> 1 model = Stan2tfp(stan_model_code=stan_code);
      2 # # do whatever you want here
      3 model.init_model(data_dict=eight_schools_data_dict)

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/site-packages/stan2tfp/stan2tfp.py:98, in Stan2tfp.__init__(self, stan_file_path, stan_model_code, data_dict, compiler_path, compiler_version)
     96     self.compiler_path = compiler_path
     97 if not self.compiler_path.exists():
---> 98     download_stan2tfp_compiler(
     99         str(self.compiler_path), version=compiler_version
    100     )
    102 # call the compiler
    103 if stan_file_path is None:

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/site-packages/stan2tfp/stan2tfp.py:45, in download_stan2tfp_compiler(compiler_path, version)
     41 url = "[https://github.com/stan-dev/stanc3/releases/download/{}/{}-stan2tfp](https://github.com/stan-dev/stanc3/releases/download/%7B%7D/%7B%7D-stan2tfp)".format(
     42     version, plat
     43 )
     44 print("Downloading the latest stan2tfp compiler...")
---> 45 urllib.request.urlretrieve(url, compiler_path)
     46 os.chmod(compiler_path, 755)
     47 print("Download complete, saved to: " + compiler_path)

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:239, in urlretrieve(url, filename, reporthook, data)
    222 """
    223 Retrieve a URL into a temporary location on disk.
    224 
   (...)
    235 data file as well as the resulting HTTPMessage object.
    236 """
    237 url_type, path = _splittype(url)
--> 239 with contextlib.closing(urlopen(url, data)) as fp:
    240     headers = fp.info()
    242     # Just return the local path and the "headers" for file://
    243     # URLs. No sense in performing a copy unless requested.

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:214, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    212 else:
    213     opener = _opener
--> 214 return opener.open(url, data, timeout)

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:523, in OpenerDirector.open(self, fullurl, data, timeout)
    521 for processor in self.process_response.get(protocol, []):
    522     meth = getattr(processor, meth_name)
--> 523     response = meth(req, response)
    525 return response

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:632, in HTTPErrorProcessor.http_response(self, request, response)
    629 # According to RFC 2616, "2xx" code indicates that the client's
    630 # request was successfully received, understood, and accepted.
    631 if not (200 <= code < 300):
--> 632     response = self.parent.error(
    633         'http', request, response, code, msg, hdrs)
    635 return response

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:561, in OpenerDirector.error(self, proto, *args)
    559 if http_err:
    560     args = (dict, 'default', 'http_error_default') + orig_args
--> 561     return self._call_chain(*args)

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:494, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
    492 for handler in handlers:
    493     func = getattr(handler, meth_name)
--> 494     result = func(*args)
    495     if result is not None:
    496         return result

File /projekt2/hochatm/akuchar/.conda/envs/stan/lib/python3.9/urllib/request.py:641, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
    640 def http_error_default(self, req, fp, code, msg, hdrs):
--> 641     raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: HTTP Error 404: Not Found

Thanks for your help and promising library.