Pystan windows error in conda

When I run the trial code mentioned here
PyStan on Windows — PyStan 2.19.1.1 documentation

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)

I get this error-
“”"
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
WARNING:pystan:MSVC compiler is not supported
Traceback (most recent call last):
File “”, line 1, in
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\pystan\model.py”, line 378, in init
build_extension.run()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 339, in run
self.build_extensions()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 448, in build_extensions
self._build_extensions_serial()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 473, in _build_extensions_serial
self.build_extension(ext)
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 528, in build_extension
objects = self.compiler.compile(sources,
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils_msvccompiler.py”, line 327, in compile
self.initialize()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils_msvccompiler.py”, line 224, in initialize
vc_env = _get_vc_env(plat_spec)
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools\msvc.py”, line 316, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools\msvc.py”, line 270, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build Tools - Visual Studio

model = pystan.StanModel(model_code=model_code)
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\unixccompiler.py”, line 249, in link
self.spawn(linker + ld_args)
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\ccompiler.py”, line 917, in spawn
spawn(cmd, dry_run=self.dry_run, **kwargs)
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\spawn.py”, line 68, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command ‘C:\ProgramData\Anaconda3\envs\stan_env\Library\mingw-w64\bin\g++.exe’ failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\pystan\model.py”, line 378, in init
build_extension.run()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 339, in run
self.build_extensions()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 448, in build_extensions
self._build_extensions_serial()
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 473, in _build_extensions_serial
self.build_extension(ext)
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\command\build_ext.py”, line 550, in build_extension
self.compiler.link_shared_object(
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\ccompiler.py”, line 713, in link_shared_object
self.link(CCompiler.SHARED_OBJECT, objects,
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\cygwinccompiler.py”, line 232, in link
UnixCCompiler.link(self, target_desc, objects, output_filename,
File “C:\ProgramData\Anaconda3\envs\stan_env\lib\site-packages\setuptools_distutils\unixccompiler.py”, line 251, in link
raise LinkError(msg)
distutils.errors.LinkError: command ‘C:\ProgramData\Anaconda3\envs\stan_env\Library\mingw-w64\bin\g++.exe’ failed with exit code 1
“”"

*** Operating System = Windows (using condas)**
*** Python Version = Python 3.9.12**
*** PyStan Version = 2.19.1.1**

Please help me out.
Thanks

PyStan doesn’t always work on Windows - Frequently Asked Questions — pystan 3.4.0 documentation

since you’re using conda, I recommend installing CmdStanPy from conda-forge - Installation — CmdStanPy 1.0.4 documentation

Your installation can not find gcc (mingw-w64).

Why do you use pystan 2?