Typical symptoms

You run something like:

Step 1: Confirm you are using the right Conda environment

In Anaconda Prompt:

conda activate opensim_env
where python
python -c "import sys; print(sys.executable)"

Expected: the path points inside your environment, for example:

...\\anaconda3\\envs\\opensim_env\\python.exe or ...\\Users\\<you>\\.conda\\envs\\opensim_env\\python.exe

If it points to base, Windows Store Python, or some other Python, you are not in the right interpreter.

Step 2: Check whether CasADi is actually installed in that environment

With opensim_env activated:

conda list casadi
python -c "import casadi; print(casadi.__version__)"

If conda list casadi shows nothing or the import fails, install it:

conda install -c conda-forge casadi

Then test again: