Open karenkane opened 3 years ago
Hi @karenkane,
What function did you run to get this error? Also, did you receive any other messages regarding the failure?
Thanks for your reply!
I tried the newly implemented 'bart_ewmv' model and got into trouble.
Model name = bart_ewmv
Details:
Error in open.connection(con, open = mode) :
Timeout was reached: [github.com] Operation timed out after 10003 milliseconds with 0 out of 0 bytes received
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/rtools40/usr/mingw_/bin/g++' not found
Use random values as initial values
SAMPLING FOR MODEL 'bart_ewmv' NOW (CHAIN 1).
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: bernoulli_logit_lpmf: Logit transformed probability parameter is nan, but must not be nan! (in 'model39a4241b148_bart_ewmv' at line 90)
[1] "Error in sampler$call_sampler(args_list[[i]]) : Initialization failed."
[1] "error occurred during calling the sampler; sampling not done"
Stan model 'bart_ewmv' does not contain samples.
Many thanks!
Karen
Karen,
It seems the issue is not specific to bart_ewmv
but to the installation of Rtools in Windows. Could you run this ra_prospect
function to check out if it properly works?
ra_prospect('example', ncore = 1, nchain = 4, nwarmup = 100, niter = 200)
If it returns the same error, it'd be better to re-install the Rtools on the machine. You can find further information from the following link: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows
Jaeyeong
Hi Jaeyeong,
Thanks for your advice!
The ra_prospect function can work with a few warnings. But I will try to re-install the Rtools.
My problem is likely to be the same as a user's problem: Chain 1: Exception: bernoulli_logit_lpmf: Logit transformed probability parameter is nan, but must not be nan! (in 'model39a4241b148_bart_ewmv' at line 90)
Thanks again! Karen
@JaeyeongYang Hi Jaeyeong, I meet the same problems in python!
I install the hBayesDM follow the totorial and run the example code as follow:
from hbayesdm import rhat, print_fit
from hbayesdm.models import alt_delta
output = alt_delta(data='example', niter=200, nwarmup=100, nchain=4, ncore=4)
output.plot(type='trace')
output.plot()
rhat(output, less=1.1)
print_fit(output)
output.plot(type='trace')
output.plot()
rhat(output, less=1.1)
print_fit(output
and errors occur:
INFO:pystan:COMPILING THE C++ CODE FOR MODEL alt_delta_2b8ebe6cd62987b45f12a44257b2a57d NOW.
Traceback (most recent call last):
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/unixccompiler.py", line 186, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/ccompiler.py", line 1007, in spawn
spawn(cmd, dry_run=self.dry_run, **kwargs)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/spawn.py", line 71, in spawn
"command {!r} failed with exit code {}".format(cmd, exitcode)
distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sangtian/ST_floder/qm_code/hBayesDM_test/main.py", line 5, in <module>
output = alt_delta(data='example', niter=2000, nwarmup=1000, nchain=4, ncore=4)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/hbayesdm/models/_alt_delta.py", line 239, in alt_delta
**additional_args)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/hbayesdm/models/_alt_delta.py", line 43, in __init__
**kwargs,
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/hbayesdm/base.py", line 63, in __init__
= self._run(**kwargs)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/hbayesdm/base.py", line 160, in _run
gen_init = self._prepare_gen_init_vb(data_dict, n_subj)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/hbayesdm/base.py", line 443, in _prepare_gen_init_vb
sm = self._designate_stan_model(model)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/hbayesdm/base.py", line 669, in _designate_stan_model
include_paths=[str(PATH_STAN)])
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/pystan/model.py", line 378, in __init__
build_extension.run()
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
self._build_extensions_serial()
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
self.build_extension(ext)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 554, in build_extension
depends=ext.depends,
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/ccompiler.py", line 599, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/home/sangtian/miniconda3/envs/hbayesdm/lib/python3.7/site-packages/setuptools/_distutils/unixccompiler.py", line 188, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
Process finished with exit code 1
I'm confused about this, my conda env is brand new because I follow the tutorial and run the script
pip install "pystan==2.19.1.1" # Use PyStan 2, for now
pip install hbayesdm # Install using pip
and the env packages are as follow:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=conda_forge
_openmp_mutex=4.5=2_gnu
arviz=0.10.0=pypi_0
ca-certificates=2022.9.24=ha878542_0
cftime=1.6.2=pypi_0
cycler=0.11.0=pypi_0
cython=0.29.32=pypi_0
fonttools=4.37.4=pypi_0
hbayesdm=1.1.1=pypi_0
importlib-metadata=3.10.1=pypi_0
kiwisolver=1.4.4=pypi_0
ld_impl_linux-64=2.39=hc81fddc_0
libffi=3.3=h58526e2_2
libgcc-ng=12.2.0=h65d4601_18
libgomp=12.2.0=h65d4601_18
libsqlite=3.39.4=h753d276_0
libstdcxx-ng=12.2.0=h46fd767_18
libzlib=1.2.13=h166bdaf_4
matplotlib=3.5.3=pypi_0
ncurses=6.3=h27087fc_1
netcdf4=1.6.1=pypi_0
numpy=1.21.6=pypi_0
openssl=1.1.1q=h166bdaf_0
packaging=21.3=pypi_0
pandas=1.3.5=pypi_0
pillow=9.2.0=pypi_0
pip=22.3=pyhd8ed1ab_0
pyparsing=3.0.9=pypi_0
pystan=2.19.1.1=pypi_0
python=3.7.11=h12debd9_0
python-dateutil=2.8.2=pypi_0
pytz=2022.4=pypi_0
readline=8.1.2=h0f457ee_0
scipy=1.7.3=pypi_0
setuptools=65.5.0=pyhd8ed1ab_0
six=1.16.0=pypi_0
sqlite=3.39.4=h4ff8645_0
tk=8.6.12=h27826a3_0
typing-extensions=4.4.0=pypi_0
wheel=0.37.1=pyhd8ed1ab_0
xarray=0.20.2=pypi_0
xz=5.2.6=h166bdaf_0
zipp=3.9.0=pypi_0
zlib=1.2.13=h166bdaf_4
Thank you, and I am happy to get your reply
-best
INFO:pystan:COMPILING THE C++ CODE FOR MODEL bart_ewmv_32f5883e88006cf8ab2634f30610150a NOW. Traceback (most recent call last): File "/usr/local/anaconda3/lib/python3.8/distutils/unixccompiler.py", line 117, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + File "/usr/local/anaconda3/lib/python3.8/distutils/ccompiler.py", line 910, in spawn spawn(cmd, dry_run=self.dry_run) File "/usr/local/anaconda3/lib/python3.8/distutils/spawn.py", line 36, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/usr/local/anaconda3/lib/python3.8/distutils/spawn.py", line 157, in _spawn_posix raise DistutilsExecError( distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 1, in
File "/usr/local/anaconda3/lib/python3.8/site-packages/hbayesdm/models/_bart_ewmv.py", line 225, in bart_ewmv
return BartEwmv(
File "/usr/local/anaconda3/lib/python3.8/site-packages/hbayesdm/models/_bart_ewmv.py", line 15, in init
super().init(
File "/usr/local/anaconda3/lib/python3.8/site-packages/hbayesdm/base.py", line 63, in init
= self._run(**kwargs)
File "/usr/local/anaconda3/lib/python3.8/site-packages/hbayesdm/base.py", line 160, in _run
gen_init = self._prepare_gen_init_vb(data_dict, n_subj)
File "/usr/local/anaconda3/lib/python3.8/site-packages/hbayesdm/base.py", line 443, in _prepare_gen_init_vb
sm = self._designate_stan_model(model)
File "/usr/local/anaconda3/lib/python3.8/site-packages/hbayesdm/base.py", line 668, in _designate_stan_model
sm = StanModel(file=model_path, model_name=model,
File "/usr/local/anaconda3/lib/python3.8/site-packages/pystan/model.py", line 378, in init
build_extension.run()
File "/usr/local/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/usr/local/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/usr/local/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/usr/local/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "/usr/local/anaconda3/lib/python3.8/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/local/anaconda3/lib/python3.8/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1