Failed to run standalone Python app from inside docker

Hi,

I set up a docker container following the tutorial and get into the container by running this command:

sudo docker run --name isaac-sim --entrypoint bash -it --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
-v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \
-v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \
-v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \
-v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \
-v ~/docker/isaac-sim/config:/root/.nvidia-omniverse/config:rw \
-v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
-v ~/docker/isaac-sim/documents:/root/Documents:rw \
nvcr.io/nvidia/isaac-sim:2021.2.1

I made sure Cache and Nucleus are running. When I tried to run the stable_baseline example located in
/isaac-sim/standalone_examples/api/omni.isaac.jetbot/stable_baselines_example

/isaac-sim/python.sh train.py

The following error occurred:

running as root
Omniverse System Monitor already running.

Traceback (most recent call last):
  File "train.py", line 11, in <module>
    from stable_baselines3 import PPO
   ModuleNotFoundError: No module named 'stable_baselines3'
   There was an error running python

There must be something wrong with how the python environment is set up inside the container. Another evidence is that when I run execute python inside python.sh, I would get the following error:

Omniverse System Monitor already running.
Python 3.7.12 (default, Sep 17 2021, 23:13:24) 
[GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from omni.isaac.kit import SimulationApp # this import is okay
>>> simulation_app = SimulationApp({"headless": True})       
Passing the following args to the base kit application:  []
Omniverse Kit cannot be run as the root user without the --allow-root flag.
Running as root should not be necessary under most circumstances.
Doing this may cause kit to encounter errors when running as a normal user again.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/isaac-sim/exts/omni.isaac.kit/omni/isaac/kit/simulation_app.py", line 169, in __init__
    self._carb_settings = carb.settings.get_settings()
  File "/isaac-sim/kit/plugins/bindings-python/carb/settings/__init__.py", line 27, in get_settings
    return get_settings_interface()
  File "/isaac-sim/kit/plugins/bindings-python/carb/settings/__init__.py", line 22, in get_settings_interface
    return acquire_settings_interface()
RuntimeError: Failed to acquire interface: carb::settings::ISettings (pluginName: nullptr)
>>> from omni.isaac.core import World
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/isaac-sim/exts/omni.isaac.core/omni/isaac/core/__init__.py", line 9, in <module>
    from omni.isaac.core.physics_context.physics_context import PhysicsContext
  File "/isaac-sim/exts/omni.isaac.core/omni/isaac/core/physics_context/__init__.py", line 9, in <module>
    from omni.isaac.core.physics_context.physics_context import PhysicsContext
  File "/isaac-sim/exts/omni.isaac.core/omni/isaac/core/physics_context/physics_context.py", line 12, in <module>
    from pxr import Usd, UsdGeom, Gf, Sdf, UsdPhysics, PhysxSchema
ImportError: cannot import name 'PhysxSchema' from 'pxr' (unknown location)

Hi @lemon.1999

First

Refer to [Fix for Tutorial 3.8] Running Jupyter Server as root in Docker - #2 by Sheikh_Dawood

Add the patch to /isaac-sim/exts/omni.isaac.kit/omni/isaac/kit/simulation_app.py (after line 250)

Second

For this, install stable_baselines3 by directly calling Isaac Sim’s python. Running /isaac-sim/python.sh -m pip install stable_baselines3 will raise a pip error (in docker containers) due to the automatic inclusion of --allow-root flag: no such option: --allow-root

/isaac-sim/kit/python/bin/python3 -m pip install stable_baselines3

After those changes you will be able to run the example

Thank you @toni.sm so much for helping! The patch worked for my original problem.

Now just one last follow-up question before I’m able to run the train.py successfully…

2022-02-24 10:21:04 [185,580ms] [Warning] [omni.usd] Warning: in _ReportErrors at line 2830 of /buildAgent
/work/ca6c508eae419cf8/USD/pxr/usd/usd/stage.cpp -- Could not open asset @omniverse://localhost/Isaac
/Environments/Grid/default_environment.usd@ for reference on prim 
@anon:0x7f29daa6fb40:World0.usd@,@anon:0x7f29da6ba310:World0-session.usda@</World
/defaultGroundPlane>. (recomposing stage on stage @anon:0x7f29daa6fb40:World0.usd@ <0x7f29da650c20>)

this probably means the cache/nucleus is not serving the assets as expected. Can you provide any insights on how to debug this, or how to start the cache/nucleus successfully? According to the manual, docker image comes with the assets so I don’t need to mount anything.

This is the result of running ps -aux

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.0  18600  3524 pts/0    Ss+  07:30   0:00 bash
root        2959  0.0  0.0   8912   952 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/System Monitor/omni-system-monitor
root        2961  0.1  0.0 877920 31152 ?        Sl   09:58   0:02 /isaac-sim/installers/nucleus/System Monitor/omni-system-monitor
root        2963  0.0  0.0   8896  1016 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Auth/omni-auth-service
root        2967  0.3  0.0 225328 38488 ?        Sl   09:58   0:05 /isaac-sim/installers/nucleus/Auth/omni-auth-service
root        2968  0.0  0.0  11108  1132 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Thumbnail/omni-thumbnails-service
root        2970  0.0  0.0  54912 13564 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Thumbnail/omni-thumbnails-service
root        2971  0.0  0.0   8896   956 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Search Service/omni-search-service
root        2973  1.0  0.0 139008 39188 ?        S    09:58   0:18 /isaac-sim/installers/nucleus/Search Service/omni-search-service
root        2974  0.0  0.0  11116  1004 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Discovery Service/omni-discovery-service
root        2976  0.1  0.0 131872 27776 ?        S    09:58   0:03 /isaac-sim/installers/nucleus/Discovery Service/omni-discovery-service
root        2977  0.0  0.0  11108  1084 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Tagging Service/omni-tagging-service
root        2979  0.0  0.0  54924 13608 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Tagging Service/omni-tagging-service
root        2980  0.0  0.0  11116   988 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Web/omni-web-service
root        2982  0.0  0.0 136352 30336 ?        S    09:58   0:00 /isaac-sim/installers/nucleus/Web/omni-web-service
root        2983  0.7  0.1 848708 50072 ?        Rl   09:58   0:13 /isaac-sim/installers/nucleus/Thumbnail/omni-thumbnails-service
root        2995  0.6  0.0 288516 33988 ?        Sl   09:58   0:11 /isaac-sim/installers/nucleus/Tagging Service/omni-tagging-service
root        2996  0.0  0.0  11116  1080 ?        S    09:58   0:00 /isaac-sim/installers/cache/Cache/omni-cache-service
root        3001  0.0  0.1 164520 54800 ?        S    09:58   0:01 /isaac-sim/installers/cache/Cache/omni-cache-service
root        3019  2.3  0.1 1917916 66200 ?       Sl   09:58   0:42 /isaac-sim/installers/nucleus/Nucleus/omni.server.app
root        3033  0.0  0.0  11108   984 ?        S    09:58   0:00 ./omni-lft-service/omni-lft-service -lft-data "/root/.local/share/ov/data/server"
root        3044  0.2  0.0 418440 33444 ?        Sl   09:58   0:05 ./omni-lft-service/omni-lft-service -lft-data "/root/.local/share/ov/data/server"
root        3061  0.0  0.1 1315700 53500 ?       Sl   09:58   0:01 ./omni.delta-applier.app
root        3515  0.0  0.0  18632  3496 pts/2    Ss   10:15   0:00 /bin/bash
root        3828  0.0  0.0  34408  2852 pts/2    R+   10:28   0:00 ps -aux

This is my first time using Omniverse and Isaac Sim. I really appreciate the support this community provides :)

Hi @lemon.1999

This error is related to the change of server as mentioned by @Sheikh_Dawood in this post

If you are working in a docker container you may not be able to make the changes from Nucleus Web UI. In this case, you can modify the ``/isaac-sim/installers/nucleus/Nucleus/omni.server.app.config.json` file and replace line 292 with:

"options": "{\"timeout\": 600, \"host\":\"d28dzv1nop4bat.cloudfront.net\",\"service\":\"s3\",\"secure\":false,\"redirection\":\"https://d28dzv1nop4bat.cloudfront.net\"}",

…and then, if necessary, stop and restart the Nucleus service (step 8 in 3. Advanced Installation — Omniverse Robotics documentation)

1 Like

Thank you! This really helped

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.