Skip to content

[Bug Report] Conda environment not being setup correctly for ZSH #703

Closed

Description

@j3soon

Describe the bug

Conda environment setup script reports file not found error when using ZSH.

Steps to reproduce

Following the conda environment setup docs:

$ git clone [email protected]:isaac-sim/IsaacLab.git
$ cd IsaacLab
$ ln -s path_to_isaac_sim _isaac_sim
$ ./isaaclab.sh --conda
[INFO] Using default conda environment name: isaaclab
[INFO] Creating conda environment named 'isaaclab'...
...
$ conda activate isaaclab
/home/johnson/IsaacLab/_isaac_sim/setup_conda_env.sh:.:20: no such file or directory: /home/johnson/IsaacLab/setup_python_env.sh

System Info

Describe the characteristic of your environment:

  • Commit: 05a2f3f
  • Isaac Sim Version: 4.0.0-rc.21+4.0.13872.3e3cb0c9.gl
  • OS: Ubuntu 22.04
  • GPU: Quadro RTX 6000
  • CUDA: 12.2
  • GPU Driver: 535.183.01

Additional context

I'll open a PR for this.

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

Activity

  1. changed the title [-][Bug Report] Conda environment not being setup correctly[/-] [+][Bug Report] Conda environment not being setup correctly for ZSH[/+] on Jul 20, 2024
  2. added
    bug
    isaac-sim
    verify
    and removed
    isaac-sim
    on Jul 29, 2024
  3. j3soon commented on Feb 28, 2025

    @j3soon
    ContributorAuthor

    Checking with the latest Isaac Lab v2.0.1 release (with Isaac Sim 4.5.0), the ./isaaclab.sh --conda can run without error. However, another immediate error occurs:

    $ git clone [email protected]:isaac-sim/IsaacLab.git
    $ cd IsaacLab
    $ ln -s path_to_isaac_sim _isaac_sim
    $ ./isaaclab.sh --conda
    [INFO] Using default conda environment name: env_isaaclab
    [INFO] Creating conda environment named 'env_isaaclab'...
    ...
    $ conda activate env_isaaclab
    $ ./isaaclab.sh --install
    [INFO] Installing extensions inside the Isaac Lab repository...
    find: ‘/home/johnson/IsaacLab/_isaac_sim/source’: No such file or directory
    

    This is due to the ${BASH_SOURCE[0]} used in the ./isaaclab.sh script to determine $ISAACLAB_PATH has been incorrectly changed after activating the conda environment:

    $ env | grep BASH_SOURCE
    $ conda activate env_isaaclab
    $ env | grep BASH_SOURCE
    /home/johnson/IsaacLab/_isaac_sim/setup_python_env.sh
    

    causing the $ISAACLAB_PATH to incorrectly point to $HOME/IsaacLab/_isaac_sim (instead of the correct $HOME/IsaacLab)

    The BASH_SOURCE environment variable is incorrectly modified by Isaac Sim 4.5.0 upstream script ~/isaacsim/setup_conda_env.sh. Removing the export line in setup_conda_env.sh fixes the issue:

    #!/bin/bash
    SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    if [ -n "$ZSH_VERSION" ]; then
        SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
    -   export BASH_SOURCE=$SCRIPT_DIR/setup_python_env.sh
    fi
    MY_DIR="$(realpath -s "$SCRIPT_DIR")"

    On further investigation, the reason of introducing the export line above is a non-ideal fix for ~/isaacsim/setup_python_env.sh to determine its filepath when using ZSH. To fix this issue, Isaac Sim v4.0.0 -> v4.1.0 introduces this export hack.

    As Isaac Sim v4.1.0 -> v4.2.0 includes a correct patch that fixed setup_python_env.sh, this hack is no longer needed after v4.2.0. This patch looks something like:

    - SCRIPT_DIR="$(dirname "${BASH_SOURCE}")"
    + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

    I'll keep this issue open for now, and will file a upstream issue to request removal of the export line in Isaac Sim.


    Potentially related issues:

  4. j3soon commented on Feb 28, 2025

    @j3soon
    ContributorAuthor

    Aside from applying the fix for ~/isaacsim/setup_conda_env.sh:

    #!/bin/bash
    SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    if [ -n "$ZSH_VERSION" ]; then
        SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
    -   export BASH_SOURCE=$SCRIPT_DIR/setup_python_env.sh
    fi
    MY_DIR="$(realpath -s "$SCRIPT_DIR")"

    The isaaclab.sh script should also be patched too (according to #707):

            printf '%s\n' \
                '# for Isaac Sim' \
    -           'source '${isaacsim_setup_conda_env_script}'' \
    +           'cd '${ISAACLAB_PATH}'/_isaac_sim' \
    +           'source setup_conda_env.sh' \
    +           'cd $OLDPWD' \
                '' >> ${CONDA_PREFIX}/etc/conda/activate.d/setenv.sh
        fi

    I wonder if we should re-open PR #707? (or submit the same PR again?)

  5. Xunmenggod commented on Apr 22, 2025

    @Xunmenggod

    Aside from applying the fix for ~/isaacsim/setup_conda_env.sh:

    #!/bin/bash
    SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    if [ -n "$ZSH_VERSION" ]; then
    SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"

    • export BASH_SOURCE=$SCRIPT_DIR/setup_python_env.sh
      fi
      MY_DIR="$(realpath -s "$SCRIPT_DIR")"
      The isaaclab.sh script should also be patched too (according to #707):

      printf '%s\n' \
          '# for Isaac Sim' \
      
    •       'source '${isaacsim_setup_conda_env_script}'' \
      
    •       'cd '${ISAACLAB_PATH}'/_isaac_sim' \
      
    •       'source setup_conda_env.sh' \
      
    •       'cd $OLDPWD' \
            '' >> ${CONDA_PREFIX}/etc/conda/activate.d/setenv.sh
      
      fi
      I wonder if we should re-open PR #707? (or submit the same PR again?)

    Hi, I met the same problem when I tried to install the Isaac lab with isaacsim4.5 using zsh. The error says could not find the source file under _isaac_sim folder. And I tried to follow your instructions to modify the isaaclab.sh and ~/isaacsim/setup_conda_env.sh. The problem occurs again. Could you help with fixing this installing issue?

  6. Xunmenggod commented on Apr 22, 2025

    @Xunmenggod

    Hi @Xunmenggod, did you linked the isaacsim folder as mentioned here? https://isaac-sim.github.io/IsaacLab/main/source/setup/installation/binaries_installation.html#creating-the-isaac-sim-symbolic-link

    Thanks for your reply. I did the step of soft link for isaac sim folder. But the same problem that could not find the source folder occurs again.

  7. Xunmenggod commented on Apr 27, 2025

    @Xunmenggod

    Hi, I found out that the Isaac lab path env is correctly fixed after re-opening a terminal to install the Isaac lab. But there is a warning to set up the VS Code settings. [WARN] Could not find Isaac Sim VSCode settings: /home/xm-laptop/Code/issac/IsaacLab/_isaac_sim/.vscode/settings.json.
    This will result in missing 'python.analysis.extraPaths' in the VSCode
    settings, which limits the functionality of the Python language server.
    However, it does not affect the functionality of the Isaac Lab project.
    We are working on a fix for this issue with the Isaac Sim team.

    And I try to look for the .vscode folder in my isaacsim folder, I found that there is no .vscode folder under my isaacsim. My Isaacsim is installed by pre-built binaries.

  8. csirois14 commented on Apr 30, 2025

    @csirois14

    I have the same problem. It think it's because the scrip's directory is not found correctly with zsh.
    I fixed it by replacing line 19 of isaaclab.sh

    export ISAACLAB_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
    

    to

    if [ -n "$ZSH_VERSION" ]; then
        export ISAACLAB_PATH="$( cd "$( dirname "$0" )" &> /dev/null && pwd )"
    else
        export ISAACLAB_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
    fi
    

    And replacing the line

    SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    

    in _isaac_sim/setup_conda_env.sh and _isaac_sim/setup_python_env.sh to

    # Determine the script directory
    if [ -n "$ZSH_VERSION" ]; then
        SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
    else
        SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    fi
    

    You then need to deactivate and reactivate your conda env. Hope this helps!

  9. Leex1 commented on May 15, 2025

    @Leex1

    I resolved this issue by modifying both setup_conda_env.sh and setup_python_env.sh.
    The key point is that the original logic uses SCRIPT_DIR based on the runtime working directory rather than the actual script location, which causes incorrect path resolution when sourced from another shell or directory.

    Here’s the fix I applied:

    if [ -n "$ZSH_VERSION" ]; then
        SCRIPT_PATH="${(%):-%x}"
    else
        SCRIPT_PATH="${BASH_SOURCE[0]}"
    fi
    
    SCRIPT_DIR="$( cd "$( dirname "$SCRIPT_PATH" )" && pwd )"

    This ensures that SCRIPT_DIR always correctly refers to the directory where the script is located, regardless of the current terminal working directory or whether it's being sourced from bash or zsh.

  10. Leex1 commented on May 15, 2025

    @Leex1
    • my setup_conda_env.sh (you can copy and replace yours):
    #!/bin/bash
    if [ -n "$ZSH_VERSION" ]; then
        SCRIPT_PATH="${(%):-%x}"
    else
        SCRIPT_PATH="${BASH_SOURCE[0]}"
    fi
    
    SCRIPT_DIR="$( cd "$( dirname "$SCRIPT_PATH" )" && pwd )"
    MY_DIR="$(realpath -s "$SCRIPT_DIR")"
    
    echo ">>> Isaac Lab environment setup"
    echo "SCRIPT_DIR=$SCRIPT_DIR"
    
    export CARB_APP_PATH="$SCRIPT_DIR/kit"
    export LD_PRELOAD="$SCRIPT_DIR/kit/libcarb.so"
    export EXP_PATH="$MY_DIR/apps"
    export ISAAC_PATH="$MY_DIR"
    
    SETUP_PY_ENV="$MY_DIR/setup_python_env.sh"
    if [ -f "$SETUP_PY_ENV" ]; then
        source "$SETUP_PY_ENV"
    else
        echo "ERROR: setup_python_env.sh not found at $SETUP_PY_ENV"
    fi
    • setup_python_env.sh:
    #!/bin/bash
    if [ -n "$ZSH_VERSION" ]; then
        SCRIPT_PATH="${(%):-%x}"
    else
        SCRIPT_PATH="${BASH_SOURCE[0]}"
    fi
    
    SCRIPT_DIR="$( cd "$( dirname "$SCRIPT_PATH" )" && pwd )"
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCRIPT_DIR/../../../$LD_LIBRARY_PATH:$SCRIPT_DIR/.:$SCRIPT_DIR/exts/omni.usd.schema.isaac/plugins/IsaacSensorSchema/lib:$SCRIPT_DIR/exts/omni.usd.schema.isaac/plugins/RangeSensorSchema/lib:$SCRIPT_DIR/exts/omni.isaac.lula/pip_prebundle:$SCRIPT_DIR/exts/omni.exporter.urdf/pip_prebundle:$SCRIPT_DIR/kit:$SCRIPT_DIR/kit/kernel/plugins:$SCRIPT_DIR/kit/libs/iray:$SCRIPT_DIR/kit/plugins:$SCRIPT_DIR/kit/plugins/bindings-python:$SCRIPT_DIR/kit/plugins/carb_gfx:$SCRIPT_DIR/kit/plugins/rtx:$SCRIPT_DIR/kit/plugins/gpu.foundation
    export PYTHONPATH=$PYTHONPATH:$SCRIPT_DIR/../../../$PYTHONPATH:$SCRIPT_DIR/kit/python/lib/python3.10/site-packages:$SCRIPT_DIR/python_packages:$SCRIPT_DIR/exts/omni.isaac.kit:$SCRIPT_DIR/kit/kernel/py:$SCRIPT_DIR/kit/plugins/bindings-python:$SCRIPT_DIR/exts/omni.isaac.lula/pip_prebundle:$SCRIPT_DIR/exts/omni.exporter.urdf/pip_prebundle:$SCRIPT_DIR/extscache/omni.kit.pip_archive-0.0.0+10a4b5c0.lx64.cp310/pip_prebundle:$SCRIPT_DIR/exts/omni.isaac.core_archive/pip_prebundle:$SCRIPT_DIR/exts/omni.isaac.ml_archive/pip_prebundle:$SCRIPT_DIR/exts/omni.pip.compute/pip_prebundle:$SCRIPT_DIR/exts/omni.pip.cloud/pip_prebundle
  11. StafaH commented on Sep 24, 2026

    @StafaH
    Collaborator

    Hi, we have now migrated to a uv workflow and recommend all users to migrate as of IsaacLab 3.0. Please try out uv and let us know if there are any issues.

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

Metadata

Metadata

Assignees

Labels

bugverify

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions