添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Dear Stan experts,

I am trying to install cmdstanpy on a win10 computer, however there is some warning in installing cmdstan.

import cmdstanpy
cmdstanpy.install_cmdstan()
Installing CmdStan version: 2.29.0
Install directory: C:\Users\KLIPS\.cmdstan
Downloading CmdStan version 2.29.0
Download successful, file: C:\Users\KLIPS\AppData\Local\Temp\tmpi_3ehdht
Unpacked download as cmdstan-2.29.0
Building version cmdstan-2.29.0
WARNING:cmdstanpy:CmdStan installation failed.
Command "make build" failed
'cut' is not recognized as an internal or external command,
operable program or batch file.
'cut' is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, expr >= 8, ...) failed.
mingw32-make: makefile:125: pipe: Bad file descriptor
INFO: Could not find files for the given pattern(s).
process_begin: CreateProcess(NULL, cp bin/windows-stanc bin/stanc.exe, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [bin/stanc.exe] Error 2
deleting tmpfiles dir: C:\Users\KLIPS\AppData\Local\Temp\tmpt9qr4j5j

Thanks

After I download the cmdstan file and set the path. There is some warning in compling the stan model:

INFO:cmdstanpy:compiling stan program, exe file: D:/PeoplesFolders/Guo/cmdstan-2.28.2/cmdstan-2.28.2/examples/bernoulli/bernoulli.exe
INFO:cmdstanpy:compiler options: stanc_options=None, cpp_options=None
ERROR:cmdstanpy:file D:\PeoplesFolders\Guo\cmdstan-2.28.2\cmdstan-2.28.2\examples\bernoulli\bernoulli.stan, exception Command: ['mingw32-make', 'D:/PeoplesFolders/Guo/cmdstan-2.28.2/cmdstan-2.28.2/examples/bernoulli/bernoulli.exe']
failed, returncode: 2, error: No such file or directory, stderr: 'cut' is not recognized as an internal or external command,
operable program or batch file.
'cut' is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, expr >= 8, ...) failed.
mingw32-make: makefile:114: pipe: Bad file descriptor
INFO: Could not find files for the given pattern(s).
The syntax of the command is incorrect.
mingw32-make: *** [stan/lib/stan_math/lib/sundials_5.7.0/src/nvector/serial/nvector_serial.o] Error 1 
ERROR:cmdstanpy:model compilation failed
ValueError                                Traceback (most recent call last)
<ipython-input-31-13ecf4144ff1> in <module>
      1 bernoulli_stan = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.stan')
----> 2 bernoulli_model = CmdStanModel(stan_file=bernoulli_stan)
~\anaconda3\lib\site-packages\cmdstanpy\model.py in __init__(self, model_name, stan_file, exe_file, compile, stanc_options, cpp_options, logger)
    179             self.compile()
    180             if self._exe_file is None:
--> 181                 raise ValueError(
    182                     'Unable to compile Stan model file: {}.'.format(
    183                         self._stan_file
ValueError: Unable to compile Stan model file
              

If you are using gcc from conda, install cmdstan from conda-forge

conda install cmdstan -c conda-forge

I’m not sure why is that cut line triggered and I still have not find a way to install it from conda. It comes with RTools.

To build cmdstan in conda we use 3 extra packages beyond just gcc and make:

- m2-filesystem   
- m2-sed             
- m2-coreutils     

I’m pretty sure cut is in m2-coreutils

update: the problem is coming from the lib TBB Makefile which references cut - looks like conda-forge install is the way to go for Windows.

as cut is definitely part of coreutils, assuming it’s in m2-coreutils - GNU Coreutils 9.0