環境
Anaconda 4.11.0
Python 3.9.10
Visual Studio Build Tools 2019 C++によるデスクトップ開発インストール済
この条件で
https://pystan2.readthedocs.io/en/latest/windows.html
にある手順の通りやってみたら
1
1import pystan
はできたのですが
2
1model_code = 'parameters {real y;} model {y ~ normal(0,1);}' 2model = pystan.StanModel(model_code=model_code)
で以下のようなエラーが起こりました
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW. WARNING:pystan:MSVC compiler is not supported --------------------------------------------------------------------------- DistutilsExecError Traceback (most recent call last) ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\_msvccompiler.py in compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends) 411 try: --> 412 self.spawn(args) 413 except DistutilsExecError as msg: ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\_msvccompiler.py in spawn(self, cmd) 516 with self._fallback_spawn(cmd, env) as fallback: --> 517 return super().spawn(cmd, env=env) 518 return fallback.value ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\ccompiler.py in spawn(self, cmd, **kwargs) 916 def spawn(self, cmd, **kwargs): --> 917 spawn(cmd, dry_run=self.dry_run, **kwargs) 918 ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\spawn.py in spawn(cmd, search_path, verbose, dry_run, env) 68 raise DistutilsExecError( ---> 69 "command %r failed with exit code %s" % (cmd, exitcode)) 70 DistutilsExecError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 During handling of the above exception, another exception occurred: CompileError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_2012\2043026653.py in <module> 1 model_code = 'parameters {real y;} model {y ~ normal(0,1);}' ----> 2 model = pystan.StanModel(model_code=model_code) ~\anaconda3\envs\stan_env\lib\site-packages\pystan\model.py in __init__(self, file, charset, model_name, model_code, stanc_ret, include_paths, boost_lib, eigen_lib, verbose, obfuscate_model_name, extra_compile_args, allow_undefined, include_dirs, includes) 376 377 try: --> 378 build_extension.run() 379 finally: 380 if redirect_stderr: ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\command\build_ext.py in run(self) 337 338 # Now actually compile and link everything. --> 339 self.build_extensions() 340 341 def check_extensions_list(self, extensions): ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\command\build_ext.py in build_extensions(self) 446 self._build_extensions_parallel() 447 else: --> 448 self._build_extensions_serial() 449 450 def _build_extensions_parallel(self): ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\command\build_ext.py in _build_extensions_serial(self) 471 for ext in self.extensions: 472 with self._filter_build_errors(ext): --> 473 self.build_extension(ext) 474 475 @contextlib.contextmanager ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\command\build_ext.py in build_extension(self, ext) 532 debug=self.debug, 533 extra_postargs=extra_args, --> 534 depends=ext.depends) 535 536 # XXX outdated variable, kept here in case third-part code ~\anaconda3\envs\stan_env\lib\site-packages\setuptools\_distutils\_msvccompiler.py in compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends) 412 self.spawn(args) 413 except DistutilsExecError as msg: --> 414 raise CompileError(msg) 415 416 return objects CompileError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
対処法を教えて頂ければ幸いです
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2023/04/30 02:06