Skip to content

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

Closed

Description

@adrian-sch

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

Activity

  1. RandomOakForest commented on Dec 6, 2024

    @RandomOakForest
    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.

  2. added
    question
    on Dec 6, 2024
  3. adrian-sch commented on Dec 6, 2024

    @adrian-sch
    Author

    Unfortunately still the same error.

  4. RandomOakForest commented on Dec 6, 2024

    @RandomOakForest
    Collaborator

    Ok, thanks, we will investigate.

  5. added
    bug
    and removed
    question
    on Dec 6, 2024
  6. godk1122 commented on Dec 9, 2024

    @godk1122

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

  7. balaprenithreddy commented on Dec 16, 2024

    @balaprenithreddy

    I face the same issue, even with the latest release

  8. adrian-sch commented on Dec 16, 2024

    @adrian-sch
    Author

    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

  9. RandomOakForest commented on Jan 2, 2025

    @RandomOakForest
    Collaborator

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

  10. RandomOakForest commented on Feb 6, 2025

    @RandomOakForest
    Collaborator

    Following up on this, we don't see this issue on our side. Have you tried Isaac Lab 2.0 and Isaac Sim 4.5? Let us know if you need further help. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions