ScheiklP / sofa_env

Reinforcement learning environments for robot-assisted laparoscopic surgery
MIT License
47 stars 14 forks source link

[ERROR] [SofaPython3] Missing createScene function #28

Closed zhilengqilaiya closed 4 months ago

zhilengqilaiya commented 4 months ago

Hello author, your work is really great, I would like to learn more about it. But when I run the sofa_env example, I get this error: [ERROR] [SofaPython3] Missing createScene function. Please help me. My system is Ubuntu 20.04, the sofa version is v23.06, and the python version is 3.8. I have no problem running some of the sofa python tutorials. Do you know why this is happening? The information output by the terminal is as follows:


[INFO]    [GUIManager] Registered qglviewer as a GUI.
[INFO]    [GUIManager] Registered qt as a GUI.
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/lib/libSofa.GUI.Qt.so
[DEPRECATED] [SofaValidation] SofaValidation is deprecated. It will be removed at v23.06. For CompareState and CompareTopology, use Sofa.Component.Playback instead.
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/SofaValidation/lib/libSofaValidation.so
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/SceneCreator/lib/libSceneCreator.so
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/CImgPlugin/lib/libCImgPlugin.so
[ERROR]   [PluginManager] Plugin not found: "MeshSTEPLoader"
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/SofaMatrix/lib/libSofaMatrix.so
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/BeamAdapter/lib/libBeamAdapter.so
[INFO]    [PluginManager] 72 plugins have been loaded from /home/znfs4090/SOFA/v23.06.00/lib/plugin_list.conf
[INFO]    [SofaPluginManager] Loading automatically plugin list in /home/znfs4090/SOFA/v23.06.00/config/loadedPlugins.ini
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/STLIB/lib/libSTLIB.so
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/CosseratPlugin/lib/libCosseratPlugin.so
[INFO]    [SofaPython3] Initializing with python version 3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0]
[INFO]    [SofaPython3] Registering a scene loader for [.py, .py3, .pyscn, .py3scn] files.
[INFO]    [SofaPython3] Shared library name is 'libpython3.8m.so'
[INFO]    [SofaPython3] Initializing python
[INFO]    [SofaPython3] Added '/home/znfs4090/SOFA/v23.06.00/plugins/SofaPython3/lib/python3/site-packages' to sys.path
---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: /home/znfs4090/SOFA/v23.06.00
---------------------------------------
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/SofaPython3/lib/libSofaPython3.so
[INFO]    [PluginManager] Loaded plugin: /home/znfs4090/SOFA/v23.06.00/plugins/SoftRobots/lib/libSoftRobots.so
[INFO]    [SofaPython3] Added '/home/znfs4090/SOFA/v23.06.00/plugins/SoftRobots/lib/python3/site-packages' to sys.path
[INFO]    [PluginManager] 3 plugins have been loaded from /home/znfs4090/SOFA/v23.06.00/config/loadedPlugins.ini

gymnasium successfully imported
[ERROR]   [SofaPython3] Missing createScene function
[INFO]    [SceneCheckerVisitor] Validating node "root" with checks: [SceneCheckCollisionResponse, SceneCheckDeprecatedComponents, SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin, SceneCheckUsingAlias]
[INFO]    [SceneCheckerVisitor] Finished validating node "root".
[WARNING] [Node(root)] An animation loop is required, but has not been found. Add an animation loop in the root of your scene to fix this warning. The list of available animation loop components is: [ConstraintAnimationLoop, DefaultAnimationLoop, FreeMotionAnimationLoop, MultiStepAnimationLoop, MultiTagAnimationLoop]. A component of type DefaultAnimationLoop will be automatically added for you.
[WARNING] [RealGUI] Global Bounding Box seems very small; Your viewer settings (based on the bbox) are likely invalid, switching to default value of [-1,-1,-1,1,1,1].This is caused by using component which does not implement properly the computeBBox function.You can remove this warning by manually forcing a value in the parameter bbox="minX minY minZ maxX maxY maxZ" in your root node 
ScheiklP commented 4 months ago

Hi @zhilengqilaiya , you are using a pretty old version of python (I would recommend 3.10) and I have personally never tested the SOFA version 23.06 under Ubuntu 20.04.

Would it be possible for you to either upgrade your system to python 3.10 and Ubuntu 22.04 or even 24.04? Otherwise you could also try to downgrade SOFA to version 22.06 or 22.12.

On the other hand, I am not sure what the output that you posted tells us. Did you run python3 sofa_env/scenes/controllable_object_example/controllable_env.py Is that the full output of the command?

zhilengqilaiya commented 4 months ago

Hi @ScheiklP , thank you very much for your reply. I will try to use the new version of sofa and python.

And the command I use to run sofa was ./runSofa /home/znfs4090/SOFA/sofa_env-main/sofa_env/scenes/controllable_object_example/controllable_env.py

The preceding output is some info, and I captured the following parts that may be useful.

ScheiklP commented 4 months ago

Hi @zhilengqilaiya , ah, I see, then everything should actually work. runSofa only takes the creatScene function (which is not defined in the *_env.py scripts). Please run the example with python3 sofa_env/scenes/controllable_object_example/controllable_env.py

zhilengqilaiya commented 4 months ago

Hi @ScheiklP , thank you very much, it works fine now! :+1: