depot/third_party/nixpkgs/pkgs/development/python-modules/cmdstanpy/use-nix-cmdstan-path.patch
Default email d5f4a57cbf Project import generated by Copybara.
GitOrigin-RevId: ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e
2023-08-10 09:59:29 +02:00

25 lines
1.1 KiB
Diff

diff --git a/cmdstanpy/utils/cmdstan.py b/cmdstanpy/utils/cmdstan.py
index 227d97a..27c3ccc 100644
--- a/cmdstanpy/utils/cmdstan.py
+++ b/cmdstanpy/utils/cmdstan.py
@@ -163,19 +163,7 @@ def cmdstan_path() -> str:
if 'CMDSTAN' in os.environ and len(os.environ['CMDSTAN']) > 0:
cmdstan = os.environ['CMDSTAN']
else:
- cmdstan_dir = os.path.expanduser(os.path.join('~', _DOT_CMDSTAN))
- if not os.path.exists(cmdstan_dir):
- raise ValueError(
- 'No CmdStan installation found, run command "install_cmdstan"'
- 'or (re)activate your conda environment!'
- )
- latest_cmdstan = get_latest_cmdstan(cmdstan_dir)
- if latest_cmdstan is None:
- raise ValueError(
- 'No CmdStan installation found, run command "install_cmdstan"'
- 'or (re)activate your conda environment!'
- )
- cmdstan = os.path.join(cmdstan_dir, latest_cmdstan)
+ cmdstan = '@cmdstan@'
os.environ['CMDSTAN'] = cmdstan
validate_cmdstan_path(cmdstan)
return os.path.normpath(cmdstan)