Skip to content

Commit 1d45b6a

Browse files
committed
Add debug output to extract_python_exe()
1 parent 7c91af9 commit 1d45b6a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

source/isaaclab/isaaclab/cli/utils.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,45 +104,71 @@ def extract_python_exe():
104104
# Try conda python.
105105
conda_prefix = os.environ.get("CONDA_PREFIX")
106106
if conda_prefix:
107+
print_debug(f"extract_python_exe(): Found CONDA_PREFIX: {conda_prefix}")
107108
# Use conda python.
108109
if is_windows():
109110
python_exe = Path(conda_prefix) / "python.exe"
110111
else:
111112
python_exe = Path(conda_prefix) / "bin" / "python"
112113
if not python_exe.exists():
113114
python_exe = Path(conda_prefix) / "bin" / "python3"
115+
else:
116+
print_debug("extract_python_exe(): No CONDA_PREFIX found.")
114117

115118
# Try uv virtual environment python.
116119
if not python_exe or not Path(python_exe).exists():
120+
if python_exe:
121+
print_debug(
122+
f'extract_python_exe(): Conda python "{python_exe}" not found, '
123+
"trying to find virtual environment python."
124+
)
125+
117126
venv_prefix = os.environ.get("VIRTUAL_ENV")
118127
if venv_prefix:
128+
print_debug(f"extract_python_exe(): Found VIRTUAL_ENV: {venv_prefix}")
119129
if is_windows():
120130
python_exe = Path(venv_prefix) / "Scripts" / "python.exe"
121131
else:
122132
python_exe = Path(venv_prefix) / "bin" / "python"
123133
if not python_exe.exists():
124134
python_exe = Path(venv_prefix) / "bin" / "python3"
135+
else:
136+
print_debug("extract_python_exe(): No VIRTUAL_ENV found.")
125137

126138
# Try kit python.
127139
if not python_exe or not Path(python_exe).exists():
140+
if python_exe:
141+
print_debug(
142+
f'extract_python_exe(): Virtual env python "{python_exe}" does not exist, trying to find Kit python...'
143+
)
144+
128145
if is_windows():
129146
python_exe = DEFAULT_ISAAC_SIM_PATH / "python.bat"
130147
else:
131148
python_exe = DEFAULT_ISAAC_SIM_PATH / "python.sh"
132149

150+
print_debug(f'extract_python_exe(): Checking for Kit python at: "{python_exe}"')
151+
133152
# Try system python.
134153
if not python_exe or not Path(python_exe).exists():
154+
print_debug(f'extract_python_exe(): Kit python "{python_exe}" does not exist. Checking system python.')
135155
python_exe = shutil.which("python") or shutil.which("python3")
136156
python_exe = Path(python_exe) if python_exe else None
157+
print_debug(f"extract_python_exe(): System python candidate: {python_exe}")
137158

138159
# See if we found it.
139160
if not python_exe or not Path(python_exe).exists():
161+
print_debug(
162+
f'extract_python_exe(): System python "{python_exe}" does not exist. '
163+
"Checking sys.executable (current Python interpreter)."
164+
)
140165
# Check if we can use python that is running us.
141166
# This handles docker or system installs.
142167
try:
143168
result = subprocess.run([sys.executable, "-m", "pip", "list"], capture_output=True, text=True, check=False)
144169
if "isaacsim-rl" in result.stdout:
145170
python_exe = sys.executable
171+
print_debug(f'extract_python_exe(): Found "isaacsim-rl" module in sys.executable: "{python_exe}"')
146172
except Exception:
147173
pass
148174

0 commit comments

Comments
 (0)