Skip to content

Commit

Permalink
Require python version 3.10 in isaaclab.sh
Browse files Browse the repository at this point in the history
3.10 is required. When running on Ubuntu 24, I ran into trouble
because Ubuntu 24 ships with 3.12. I was able to get isaaclab.sh
to work with the following steps:

* Install a version of 3.10 (be careful, 3.12 must remain the
default).
* Create a venv with 3.10, install isaac sim in the venv, then
proceed to install isaac lab.
* The following changes to the script:
** In `extract_python_exe`, check that we found the desired
version.
** Use the result of `extract_python_exe` everywhere to invoke
python (outside of `extract_python_exe` itself).

Disclaimer: Someone else please try this locally.
  • Loading branch information
steple committed Jan 2, 2025
1 parent 574abc4 commit 3f152e9
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions isaaclab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export ISAACLAB_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && p
# Helper functions
#==

# This is the python version we would like to use.
PYTHON_VERSION="3.10"

# extract isaac sim path
extract_isaacsim_path() {
# Use the sym-link path to Isaac Sim directory
Expand Down Expand Up @@ -65,7 +68,7 @@ extract_python_exe() {
# inside docker, if user installed into system python, we need to use that
# otherwise, use the python from the kit
if [ $(python -m pip list | grep -c 'isaacsim-rl') ]; then
local python_exe=$(which python)
local python_exe=$(which python${PYTHON_VERSION})
fi
fi
fi
Expand All @@ -78,6 +81,15 @@ extract_python_exe() {
echo -e "\t3. Python executable is not available at the default path: ${ISAACLAB_PATH}/_isaac_sim/python.sh" >&2
exit 1
fi

# Get the major.minor version of the python that we just found.
python_exe_version=$(${python_exe} -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))')
# Check if it is the desired version.
if [ "${PYTHON_VERSION}" != ${python_exe_version} ]; then
echo -e "[ERROR] Found python version ${python_exe_version}, but wanted ${PYTHON_VERSION}." >&2
exit 1
fi

# return the result
echo ${python_exe}
}
Expand All @@ -86,12 +98,14 @@ extract_python_exe() {
extract_isaacsim_exe() {
# obtain the isaac sim path
local isaac_path=$(extract_isaacsim_path)
# python executable to use
# isaacsim executable to use
local isaacsim_exe=${isaac_path}/isaac-sim.sh
# retrieve the python executable
python_exe=$(extract_python_exe)
# check if there is a python path available
if [ ! -f "${isaacsim_exe}" ]; then
# check for installation using Isaac Sim pip
if [ $(python -m pip list | grep -c 'isaacsim-rl') -gt 0 ]; then
if [ $(${python_exe} -m pip list | grep -c 'isaacsim-rl') -gt 0 ]; then
# Isaac Sim - Python packages entry point
local isaacsim_exe="isaacsim omni.isaac.sim"
else
Expand Down Expand Up @@ -130,7 +144,7 @@ setup_conda_env() {
echo -e "[INFO] Conda environment named '${env_name}' already exists."
else
echo -e "[INFO] Creating conda environment named '${env_name}'..."
conda create -y --name ${env_name} python=3.10
conda create -y --name ${env_name} python=${PYTHON_VERSION}
fi

# cache current paths for later
Expand Down

0 comments on commit 3f152e9

Please sign in to comment.