Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] VSCode Debugger not setting up correct Python environment #1500

Open
adrian-sch opened this issue Dec 5, 2024 · 7 comments
Open
Labels
bug Something isn't working

Comments

@adrian-sch
Copy link

Describe the bug

I dont know if this error even is Isaac Lab related or if it is related to Isaac Sim or even VSCode, but since yesterday the VSCode debugger doesnt work anymore with the Isaac Lab Workspace. The error started to happen after I updated the Omniverse Cache to 2023.2.7, I tried to revert the update, but it did not change anything. I also tired to set up Isaac Lab and Isaac Sim again on two different machines, but i always get the same error. When executing the same script with the isaaclab.sh script everything works normally. It seems to me that the _isaac_lab/python.py script is not run with the debugger and the isaac interpreter is used directly, because of the console output i get (see down below). When i try to run my python script with that interpreter directly i get the same errors . I also tried adding an echo to the _isaac_lab/python.py, but it never got displayed in the console.

Steps to reproduce

  • Setup Isaac Sim and Isaac Lab without Conda
  • Open VSCode
  • Run Debugger (for example with Python: Train Environment config)

Console log:

/usr/bin/env /home/adrian/Projects/IsaacLab/_isaac_sim/kit/python/bin/python3 /home/adrian/.vscode-server/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 36415 -- /home/adrian/Projects/IsaacLab/source/standalone/workflows/rsl_rl/train.py --task Isaac-Reach-Franka-v0 --headless 

Error message:

Exception has occurred: ModuleNotFoundError
No module named 'toml'
  File "/home/adrian/Projects/IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/__init__.py", line 9, in <module>
    import toml
  File "/home/adrian/Projects/IsaacLab/source/standalone/workflows/rl_games/train.py", line 13, in <module>
    from omni.isaac.lab.app import AppLauncher
ModuleNotFoundError: No module named 'toml'

VSCode defaultInterpreterPath:

    "python.defaultInterpreterPath": "${workspaceFolder}/_isaac_sim/python.sh",

System Info

Describe the characteristic of your environment:

  • Commit: 97c7362
  • Isaac Sim Version: 4.2.0-rc.17+release.15988.c99988b1.gl
  • OS: Ubuntu 22.04
  • GPU: RTX 4090
  • CUDA: 12.2
  • GPU Driver: 535.183.01
@RandomOakForest
Copy link
Collaborator

Thanks for posting this. Something may have changed with that commit of Isaac Lab. Could you please try the release v1.3.0 (d603b67) commit? Thank you.

@RandomOakForest RandomOakForest added the question Further information is requested label Dec 6, 2024
@adrian-sch
Copy link
Author

Unfortunately still the same error.

@RandomOakForest
Copy link
Collaborator

Ok, thanks, we will investigate.

@RandomOakForest RandomOakForest added bug Something isn't working and removed question Further information is requested labels Dec 6, 2024
@godk1122
Copy link

godk1122 commented Dec 9, 2024

I have the same problem, looking forward to your reply, thanks!

@balaprenithreddy
Copy link

I face the same issue, even with the latest release

@adrian-sch
Copy link
Author

adrian-sch commented Dec 16, 2024

Still having the same issue, but I found a workaround for now.

I copied the part that sets up the python environmnet and exports other env variables from the _isaac_sim/python.sh script and added a new setup_python.sh script in the root isaaclab folder. Then I source this script in my .bashrc, you could probably also source it from a preLauchTask in vscode, but i couldnt figure out how to run the task in the same terminal as the lauch config.

setup_python.sh:

#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/_isaac_sim"
# MY_DIR="$(realpath -s "$SCRIPT_DIR")"

# Setup python env from generated file (generated by tools/repoman/build.py)
export CARB_APP_PATH=$SCRIPT_DIR/kit
export ISAAC_PATH=$SCRIPT_DIR
export EXP_PATH=$SCRIPT_DIR/apps
source ${SCRIPT_DIR}/setup_python_env.sh

# By default use our python, but allow overriding it by checking if PYTHONEXE env var is defined:
python_exe=${PYTHONEXE:-"${SCRIPT_DIR}/kit/python/bin/python3"}


if ! [[ -z "${CONDA_PREFIX}" ]]; then
  echo "Warning: running in conda env, please deactivate before executing this script"
  echo "If conda is desired please source setup_conda_env.sh in your python 3.10 conda env and run python normally"
fi

# Check if we are running in a docker container
if [ -f /.dockerenv ]; then
  # Check for vulkan in docker container
  if [[ -f "${SCRIPT_DIR}/vulkan_check.sh" ]]; then
    ${SCRIPT_DIR}/vulkan_check.sh
  fi
fi

# Show icon if not running headless
export RESOURCE_NAME="IsaacSim"
# WAR for missing libcarb.so
export LD_PRELOAD=$SCRIPT_DIR/kit/libcarb.so

Add to .bashrc:

source <path/to/isaaclab>/setup_python.sh

edit: added /_isaac_sim to SCRIPT_DIR variable

@RandomOakForest
Copy link
Collaborator

Thanks for posting this. We are looking into this issue and if we can provide a workaround soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants