From 374676500795aec9d5cbc7fe5f7a96bf00489809 Mon Sep 17 00:00:00 2001 From: Cuong Duong Date: Mon, 19 Jun 2023 07:39:18 +1000 Subject: [PATCH] Fix setup.py stan file temp destination (#2451) --- python/setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/python/setup.py b/python/setup.py index f8ab2cd..b437be9 100644 --- a/python/setup.py +++ b/python/setup.py @@ -95,7 +95,6 @@ def install_cmdstan_deps(cmdstan_dir: Path): cores=cpu_count(), progress=True, ): - raise RuntimeError("CmdStan failed to install in repackaged directory") @@ -121,13 +120,13 @@ def build_cmdstan_model(target_dir): install_cmdstan_deps(cmdstan_dir) model_name = "prophet.stan" - - temp_stan_file = copy(os.path.join(MODEL_DIR, model_name), cmdstan_dir) + # note: ensure copy target is a directory not a file. + temp_stan_file = copy(os.path.join(MODEL_DIR, model_name), cmdstan_dir.parent.resolve()) sm = cmdstanpy.CmdStanModel(stan_file=temp_stan_file) target_name = "prophet_model.bin" copy(sm.exe_file, os.path.join(target_dir, target_name)) - if IS_WINDOWS: + if IS_WINDOWS and repackage_cmdstan(): copytree(cmdstan_dir, target_cmdstan_dir) # Clean up