Closed atownse2 closed 2 weeks ago
Can you share the result of printenv | grep CMDSTAN
from inside your conda environment?
Oddly, the print_versions
script seems to locate your installation just fine. I'm not sure how many people have tried the exact combination of WSL/conda, let alone WSL/aarch64/conda
Sure!
(triphoton-env) atownse2@Surface:~/Code/RSTriPhoton$ printenv | grep CMDSTAN
CMDSTAN_OLD=
CMDSTAN=/home/atownse2/micromamba/envs/triphoton-env/bin/cmdstan
Yeah, sure looks correct to me.
In Python, can you run the following?
import os
print('CMDSTAN' in os.environ)
print(os.environ.get('CMDSTAN'))
>>> import os
>>> print('CMDSTAN' in os.environ)
True
>>> print(os.environ.get('CMDSTAN'))
/home/atownse2/micromamba/envs/triphoton-env/bin/cmdstan
>>>
Hm, can you try restarting your shell, re-activating the environment, and trying again? I can't spot anything wrong with your config
This is weird, the CmdStanModel
initialization works in the Python shell but not in the Jupyter notebook. The error in the Jupyter notebook also gives this message:
06:18:41 - cmdstanpy - INFO - No CmdStan installation found.
06:18:41 - cmdstanpy - INFO - Cannot determine whether version is before 2.27.
06:18:41 - cmdstanpy - INFO - No CmdStan installation found.
06:18:41 - cmdstanpy - INFO - Cannot determine whether version is before 2.27.
Hm - are you sure you're using the kernel you think you are inside of Jupyter? Especially when mixing with conda environments this can be tricky
Not sure - if I compare
import sys
print(sys.executable)
In the notebook I get:
/home/atownse2/micromamba/envs/triphoton-env/bin/python
and in the shell I get:
/home/atownse2/micromamba/envs/triphoton-env/bin/python
Also all the other Conda packages I installed are available in both the shell and the notebook.
Did you launch the jupyter instance from an activated environment? I think it inherits the environment variables of the shell
So I'm using VSCode's Jupyter extension to run my notebooks. If I instead launch a notebook from the command line (inside the conda environment) everything works. Not sure why this particular package is having issues while the others are working. We can close this issue if you want as it's looking like this is a VSCode/Jupter issue and not a cmdstanpy
issue. That being said, if you have any suggestions for fixes that would be very helpful. Thanks for your help so far!
Oh hmm, i assume you’re using the VSCode: Remote WSL extension to do so? I have no idea how that interacts with environment variables and Jupyter.
One thing you might want to try is - from a WSL terminal with the environment active - running code /path/to/your/workspace
and see if launching it in that manner makes a difference?
That gives the same result.
I use this same setup (Conda/WSL/VSCode) on my other Win 10 (x86) machine and it works fine.
This might be related to: https://discourse.mc-stan.org/t/cmdstan-not-being-set-when-running-cmdstanpy-on-jupyter-notebook-in-vs-code/34740/2 the workaround of manually setting the CMDSTAN
path mentioned by OP fixes the issue, however their solution of updating VSCode's Jupyter extension does not (neither does rolling back the extension version).
Either way, I can move forward with this workaround so I will close the issue, thanks again for your help.
Okay nevermind, there still seems to be issues which I assume are related to the C++ toolchain paths not being set. Either way this doesn't seem to be a cmdstanpy
issue so I will leave the issue closed.
Summary:
I am trying to setup my Conda environment (that contains cmdstanpy) on my Windows 11 machine (ARM64) in WSL (Ubuntu 22.04.4). Not sure if the architecture is the issue but this setup works on my Windows 10 machine (x86).
Description:
I install cmdstanpy with Conda, specifying the conda-forge channel. I can import cmdstanpy however whenever I try to initialize a
CMDStanModel
I get:I have tried reactivating my environment and shell, restarting the python kernel and several permutations of these things. When I try to run
install_cmdstan
I get:Additional Information:
Conda env file looks something like:
Current Version:
Please include the output of
import cmdstanpy; cmdstanpy.show_versions()
, or at least the cmdstan and cmdstanpy versions used.