Skip to content

Navigation Menu

Sign in
Sign up

Changing PATH on Windows during installation #828

Unanswered
jmanaker asked this question in Q&A
Discussion options

Lines 417-424 of utils/cmdstan.py are as follows:

logger.info('Add C++ toolchain to $PATH: %s', toolchain_root)
os.environ['PATH'] = ';'.join(
 list(
 OrderedDict.fromkeys(
 [compiler_path, tool_path] + os.getenv('PATH', '').split(';')
 )
 )
)

That is, during installation, cmdstan.py logs "Add C++ toolchain to $PATH: toolchain_root". Then it (sort of, see below) adds two different addresses to PATH: compiler_path and tool_path.

I have two questions:

  1. Are the paths added to PATH intended to appear in the logger output?
  2. Is the modification intended to be permanent, or just last for the duration of the installation script?

On Windows, modifying os.environ does not change PATH for other processes (including, say, other cmdstanpy scripts), and certainly does not persist across logon/logoff events. Instead, one must use the winreg module to modify the registry key (for per-user changes) HKCU/Environment or (for all users) HKLM/Environment.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /