Pystan / httpstan "Timeout" with large model

I am having an issue with fitting a large model with pystan (v3.1.1; more information below).
It is a hierarchical model and works well when I use a subset of the data (and groups) for testing, but I get the following error when I use the full data set (and all of the groups).

------------------------------------------------------------------------------- 138 <module>
app() 214 __call__
return get_command(self)(*args, **kwargs) 829 __call__
return self.main(*args, **kwargs) 782 main
rv = self.invoke(ctx) 1066 invoke
return ctx.invoke(self.callback, **ctx.params) 610 invoke
return callback(*args, **kwargs) 500 wrapper
return callback(**use_params)  # type: ignore 610 invoke
return callback(*args, **kwargs) 500 wrapper
return callback(**use_params)  # type: ignore 115 fit_bayesian_model
trace = fit_model( 228 fit_model
stan_model = model.stan_model(data=data, random_seed=seed) 172 stan_model
return 511 build
return 44 run
return loop.run_until_complete(main) 642 run_until_complete
return future.result() 460 go
resp = await"/{model_name}/params", json={"data": data}) 50 post
async with"{self.base_url}{path}", json=json) as resp: 1138 __aenter__
self._resp = await self._coro 559 _request
await resp.start(conn) 913 start
self._continue = None 721 __exit__
raise asyncio.TimeoutError from None


I am fitting the model on a Linux server that I don’t have root access to. Because of this limited access, I cannot install the latest versions of ‘httpstan’ and ‘pystan’ and currently am using v4.4.2 of ‘httpstan’ and v3.1.1 of ‘pystan’. (I can’t remember exactly, but I believe the conflict is with the version of the Linux operating system and requirements of ‘httpstan’.) I am using a conda virtual environment, but had to install ‘httpstan’ and ‘pystan’ with pip to get them to work. (Again, I am able to use Stan to sample successfully from the posterior with the smaller data set / subset of groups.) I am using Python v3.9.9 and not fitting the models in a Jupyter notebook.

I hope someone can provide some insight into this problem I am having. Thank you for any help!

Wish I could be of more help.

Looks like it’s hitting a timeout in a place that suggests the problem could be with file access or compilation.

Anaconda is not supported. Can you try creating a normal Python virtualenv? Things should work better in that.

Sorry for not following up on this problem, but I couldn’t get it to work after trying various fixes. I need to use anaconda because of the system requirements and permissions (on a shared compute cluster). I ended up focussing on using PyMC to build the model, but if I was to try again with Stan, I would probably look into directly using CmdStanPy – I think it is the currently recommend interface, but could be wrong.