python installation

This commit is contained in:
Frank Yang 2024-07-11 13:03:20 -07:00
parent fd82eede17
commit 88f5a1cdcf
2 changed files with 202 additions and 27 deletions

View File

@ -129,8 +129,12 @@ def _launch_app():
launch_context = nullcontext if gm.DEBUG else suppress_omni_log
from isaacsim import SimulationApp
# Do not attempt to lazy load the SimulationApp class, as it prevents the app from importing correctly
with launch_context(None):
app = lazy.omni.isaac.kit.SimulationApp(config_kwargs, experience=str(kit_file_target.resolve(strict=True)))
app = SimulationApp(config_kwargs)
# app = lazy.omni.isaac.kit.SimulationApp(config_kwargs, experience=str(kit_file_target.resolve(strict=True)))
# Close the stage so that we can create a new one when a Simulator Instance is created
assert lazy.omni.isaac.core.utils.stage.close_stage()

View File

@ -1,35 +1,68 @@
#!/usr/bin/env bash
set -eo &> /dev/null
# Make sure that the ISAAC_SIM_PATH variable is set correctly
if [[ -d ~/.local/share/ov/pkg ]] && [[ $(ls ~/.local/share/ov/pkg | grep isaac_sim) ]];
then
FOUND_ISAAC_SIM_PATH=$(ls -d ~/.local/share/ov/pkg/* | grep isaac_sim | tail -n 1)
echo "We found Isaac Sim installed at $FOUND_ISAAC_SIM_PATH. OmniGibson will use it by default."
read -p "If you want to use a different one, please type in the path containing isaac-sim.sh here (press enter to skip) >>> " ISAAC_SIM_PATH
ISAAC_SIM_PATH=${ISAAC_SIM_PATH:-$FOUND_ISAAC_SIM_PATH}
else
echo "We did not find Isaac Sim under ~/.local/share/ov/pkg."
echo "If you haven't installed Isaac Sim yet, please do so before running this setup script."
read -p "If you have already installed it in a custom location, please type in the path containing isaac-sim.sh here >>> " ISAAC_SIM_PATH
fi
while [[ ! -f "${ISAAC_SIM_PATH}/isaac-sim.sh" ]]; do
read -p "isaac-sim.sh not found in $ISAAC_SIM_PATH! Make sure you have entered the correct path >>> " ISAAC_SIM_PATH
done
echo -e "\nUsing Isaac Sim at $ISAAC_SIM_PATH\n"
# Choose venv name
echo "The new conda environment will be named omnigibson by default."
read -p "If you want to use a different name, please type in here (press enter to skip) >>> " conda_name
conda_name=${conda_name:-omnigibson}
echo -e "\nUsing $conda_name as the conda environment name\n"
# Get Python version from Isaac Sim
ISAAC_PYTHON_VERSION=$(${ISAAC_SIM_PATH}/python.sh -c "import platform; print(platform.python_version())")
ISAAC_PYTHON_VERSION="${ISAAC_PYTHON_VERSION##*$'\n'}" # get rid of conda activation warnings
echo Using Python version $ISAAC_PYTHON_VERSION matching your current Isaac Sim version
# Ask the user for Omniverse installation method
echo "Please choose your installation method for Isaac-Sim:"
echo "1. Install Isaac-Sim from Python pip install (default, recommended)"
echo "2. Install Isaac-Sim from the Omniverse Launcher"
while true; do
read -p "Please enter your choice (1 or 2) >>> " isaac_sim_installation_method
# Set default to 1 if no input is provided
isaac_sim_installation_method=${isaac_sim_installation_method:-1}
# Validate input
if [[ "$isaac_sim_installation_method" == "1" || "$isaac_sim_installation_method" == "2" ]]; then
break
else
echo "Invalid input. Please enter 1 or 2."
fi
done
# If the user chooses to install Isaac-Sim from pip
if [ $isaac_sim_installation_method -eq 1 ]; then
# Get Python version from Isaac Sim (currently supporting Python 3.10 only)
echo Installing Isaac Sim from pip install...
ISAAC_PYTHON_VERSION=3.10
echo Using Python version $ISAAC_PYTHON_VERSION matching your current Isaac Sim version
fi
# If the user chooses to install Isaac-Sim from the Omniverse Launcher
if [ $isaac_sim_installation_method -eq 2 ]; then
# Make sure that the ISAAC_SIM_PATH variable is set correctly
if [[ -d ~/.local/share/ov/pkg ]] && [[ $(ls ~/.local/share/ov/pkg | grep isaac_sim) ]];
then
FOUND_ISAAC_SIM_PATH=$(ls -d ~/.local/share/ov/pkg/* | grep isaac_sim | tail -n 1)
echo "We found Isaac Sim installed at $FOUND_ISAAC_SIM_PATH. OmniGibson will use it by default."
read -p "If you want to use a different one, please type in the path containing isaac-sim.sh here (press enter to skip) >>> " ISAAC_SIM_PATH
ISAAC_SIM_PATH=${ISAAC_SIM_PATH:-$FOUND_ISAAC_SIM_PATH}
else
echo "We did not find Isaac Sim under ~/.local/share/ov/pkg."
echo "If you haven't installed Isaac Sim yet, please do so before running this setup script."
read -p "If you have already installed it in a custom location, please type in the path containing isaac-sim.sh here >>> " ISAAC_SIM_PATH
fi
while [[ ! -f "${ISAAC_SIM_PATH}/isaac-sim.sh" ]]; do
read -p "isaac-sim.sh not found in $ISAAC_SIM_PATH! Make sure you have entered the correct path >>> " ISAAC_SIM_PATH
done
echo -e "\nUsing Isaac Sim at $ISAAC_SIM_PATH\n"
# Get Python version from Isaac Sim
ISAAC_PYTHON_VERSION=$(${ISAAC_SIM_PATH}/python.sh -c "import platform; print(platform.python_version())")
ISAAC_PYTHON_VERSION="${ISAAC_PYTHON_VERSION##*$'\n'}" # get rid of conda activation warnings
echo Using Python version $ISAAC_PYTHON_VERSION matching your current Isaac Sim version
fi
# Create a conda environment with the appropriate python version
source $(conda info --base)/etc/profile.d/conda.sh
@ -38,6 +71,103 @@ conda create -y -n $conda_name python=${ISAAC_PYTHON_VERSION}
# Now activate the omnigibson environment
conda activate $conda_name
# Install omnigibson!
pip install -e .
# Install Isaac Sim using pip if the user chooses to install it from pip
if [ $isaac_sim_installation_method -eq 1 ]; then
echo -e "\nInstalling Isaac Sim using pip...\n"
# Get the Isaac Sim whl file from the NVIDIA Omniverse website
wget https://pypi.nvidia.com/omniverse-kit/omniverse_kit-106.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-kernel/isaacsim_kernel-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-app/isaacsim_app-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-core/isaacsim_core-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-gui/isaacsim_gui-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-utils/isaacsim_utils-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-storage/isaacsim_storage-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-asset/isaacsim_asset-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-sensor/isaacsim_sensor-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-robot-motion/isaacsim_robot_motion-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-robot/isaacsim_robot-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-benchmark/isaacsim_benchmark-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-code-editor/isaacsim_code_editor-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-ros1/isaacsim_ros1-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-cortex/isaacsim_cortex-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-example/isaacsim_example-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-replicator/isaacsim_replicator-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-rl/isaacsim_rl-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-robot-setup/isaacsim_robot_setup-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-ros2/isaacsim_ros2-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-template/isaacsim_template-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-test/isaacsim_test-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim/isaacsim-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-extscache-physics/isaacsim_extscache_physics-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-extscache-kit/isaacsim_extscache_kit-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
wget https://pypi.nvidia.com/isaacsim-extscache-kit-sdk/isaacsim_extscache_kit_sdk-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl
# Rename the whl file, as the pip install version only support GLIBC 2.34
# https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_python.html
mv omniverse_kit-106.0.0-cp310-none-manylinux_2_34_x86_64.whl omniverse_kit-106.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_kernel-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_kernel-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_app-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_app-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_core-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_core-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_gui-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_gui-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_utils-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_utils-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_storage-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_storage-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_asset-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_asset-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_sensor-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_sensor-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_robot_motion-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_robot_motion-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_robot-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_robot-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_benchmark-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_benchmark-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_code_editor-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_code_editor-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_ros1-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_ros1-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_cortex-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_cortex-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_example-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_example-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_replicator-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_replicator-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_rl-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_rl-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_robot_setup-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_robot_setup-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_ros2-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_ros2-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_template-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_template-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_test-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_test-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_extscache_physics-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_extscache_physics-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_extscache_kit-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_extscache_kit-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
mv isaacsim_extscache_kit_sdk-4.0.0.0-cp310-none-manylinux_2_34_x86_64.whl isaacsim_extscache_kit_sdk-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
# Install Isaac Sim using pip
pip install omniverse_kit-106.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_kernel-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_app-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_core-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_gui-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_utils-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_storage-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_asset-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_sensor-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_robot_motion-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_robot-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_benchmark-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_code_editor-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_ros1-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_cortex-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_example-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_replicator-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_rl-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_robot_setup-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_ros2-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_template-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_test-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_extscache_physics-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_extscache_kit-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install isaacsim_extscache_kit_sdk-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
pip install numba
pip install telemoma
fi
mkdir -p ${CONDA_PREFIX}/etc/conda/activate.d
mkdir -p ${CONDA_PREFIX}/etc/conda/deactivate.d
touch ${CONDA_PREFIX}/etc/conda/activate.d/env_vars.sh
@ -48,7 +178,6 @@ CONDA_ACT_FILE="${CONDA_PREFIX}/etc/conda/activate.d/env_vars.sh"
echo '#!/bin/sh' > ${CONDA_ACT_FILE}
echo "export LD_LIBRARY_PATH_OLD=\$LD_LIBRARY_PATH" >> ${CONDA_ACT_FILE}
echo "export PYTHONPATH_OLD=\$PYTHONPATH" >> ${CONDA_ACT_FILE}
echo "source ${ISAAC_SIM_PATH}/setup_conda_env.sh" >> ${CONDA_ACT_FILE}
CONDA_DEACT_FILE="${CONDA_PREFIX}/etc/conda/deactivate.d/env_vars.sh"
echo '#!/bin/sh' > ${CONDA_DEACT_FILE}
@ -58,11 +187,53 @@ echo "unset ISAAC_PATH" >> ${CONDA_DEACT_FILE}
echo "unset CARB_APP_PATH" >> ${CONDA_DEACT_FILE}
echo "unset LD_LIBRARY_PATH_OLD" >> ${CONDA_DEACT_FILE}
echo "unset PYTHONPATH_OLD" >> ${CONDA_DEACT_FILE}
echo "unset EXP_PATH" >> ${CONDA_DEACT_FILE}
# Install omnigibson!
pip install -e .
# Add the Isaac Sim paths to the conda environment for pip install
if [ $isaac_sim_installation_method -eq 1 ]; then
echo "export ISAAC_PATH=$(python -c 'import site; print(site.getsitepackages()[0] + "/isaacsim")')" >> ${CONDA_ACT_FILE}
echo "export EXP_PATH=\$ISAAC_PATH/apps" >> ${CONDA_ACT_FILE}
fi
# Add the Isaac Sim paths to the conda environment for Omniverse Launcher install
if [ $isaac_sim_installation_method -eq 2 ]; then
echo "source ${ISAAC_SIM_PATH}/setup_conda_env.sh" >> ${CONDA_ACT_FILE}
fi
echo -e "\nPerforming clean up...\n"
# Cycle conda environment so that all dependencies are propagated
conda deactivate
# If using pip install, remove the downloaded whl files
if [ $isaac_sim_installation_method -eq 1 ]; then
rm omniverse_kit-106.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_kernel-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_app-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_core-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_gui-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_utils-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_storage-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_asset-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_sensor-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_robot_motion-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_robot-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_benchmark-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_code_editor-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_ros1-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_cortex-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_example-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_replicator-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_rl-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_robot_setup-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_ros2-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_template-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_test-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_extscache_physics-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_extscache_kit-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
rm isaacsim_extscache_kit_sdk-4.0.0.0-cp310-none-manylinux_2_31_x86_64.whl
fi
echo -e "\nOmniGibson successfully installed! Please run conda activate $conda_name to activate the environment.\n"