Home › Forum › SOFA › Programming with SOFA › Error In Running SofaPython3 in Conda Environemtn with Python3.83
Tagged: 64_bits, Linux_ubuntu, Plugin_SoftRobots, SOFA_2006, SofaPython
- This topic has 1 reply, 2 voices, and was last updated 4 years ago by
Damien Marchal.
-
AuthorPosts
-
4 September 2020 at 12:53 #17084
Cai
BlockedHi, Sofa Forum,
In recent days, I use SofaPython3 to
some error occurs.
my sofa root is :/home/cmx/sofa, SofaPython3 root is /home/cmx/SofaPython3.
I use the out-of-tree-build following the guidance in the forum. All files are compiled successfully in Cmake-gui. Because SofaPython3 needs python3, so i establish conda environ with python3.8 to compile and succeed.
When run the following in virtual environ:
./$SOFA_BLD/bin/runSofa -l $SP3_BLD/lib/libSofaPython3.so
,
errors:(base) cmx@cmx-Lenovo-IdeaPad-Y510P:~/sofa/build/bin$ ./runSofa -l /home/cmx/SofaPython3/build/lib/libSofaPython3.so [INFO] [runSofa] PluginRepository paths = /home/cmx/sofa/build/plugins:/home/cmx/sofa/build/lib [INFO] [runSofa] DataRepository paths = /home/cmx/sofa/src/share:/home/cmx/sofa/src/examples [INFO] [runSofa] GuiDataRepository paths = /home/cmx/sofa/src/applications/projects/runSofa/resources:/home/cmx/sofa/src/modules/SofaGuiQt/src/sofa/gui/qt/resources [INFO] [SofaPython3] Initializing with python version 3.8.3 (default, Jul 2 2020, 16:23:49) [GCC 7.3.0] [INFO] [SofaPython3] Registering a scene loader for [.py, .py3, .pyscn, .py3scn] files. [INFO] [SofaPython3] Shared library name is 'libpython3.8m.so' [INFO] [SofaPython3] Intializing python [INFO] [SofaPython3] Added '/home/cmx/SofaPython3/build/lib/site-packages' to sys.path [INFO] [PluginManager] Loaded plugin: /home/cmx/SofaPython3/build/lib/libSofaPython3.so [INFO] [runSofa] Loading automatically plugin list in /home/cmx/sofa/build/lib/plugin_list.conf.default [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaSparseSolver.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaPreconditioner.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaHaptics.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaValidation.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaDenseSolver.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaNonUniformFem.so [INFO] [PluginManager] Loaded plugin: /home/cmx/sofa/build/lib/libSofaOpenglVisual.so Fatal Python error: PyEval_SaveThread: NULL tstate Python runtime state: initialized Current thread 0x00007f04c57d47c0 (most recent call first): <no Python frame> ########## SIG 6 - SIGABRT: usually caused by an abort() or assert() ########## -> /home/cmx/sofa/build/lib/libSofaHelper.so.20.06.99(sofa::helper::BackTrace::dump()+0x20) [0x7f04ccedbf10] -> /home/cmx/sofa/build/lib/libSofaHelper.so.20.06.99(sofa::helper::BackTrace::sig(int)+0x358) [0x7f04ccedc4a8] -> /lib/x86_64-linux-gnu/libc.so.6(+0x3efd0) [0x7f04caf56fd0] -> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f04caf56f47] -> /lib/x86_64-linux-gnu/libc.so.6(abort+0x141) [0x7f04caf588b1] -> /home/cmx/anaconda3/lib/libpython3.8.so.1.0(+0xbf587) [0x7f04c4a5a587] -> /home/cmx/anaconda3/lib/libpython3.8.so.1.0(+0xbf963) [0x7f04c4a5a963] -> /home/cmx/anaconda3/lib/libpython3.8.so.1.0(+0xff67a) [0x7f04c4a9a67a] -> /home/cmx/sofa/build/lib/libSofaPython.so(sofa::simulation::PythonEnvironment::Init()+0xe4e) [0x7f04b30fd17e] -> /home/cmx/sofa/build/lib/libSofaPython.so(initExternalModule+0x10) [0x7f04b311a780] -> /home/cmx/sofa/build/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::loadPluginByPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::ostream*)+0xdcf) [0x7f04ccf9313f] -> /home/cmx/sofa/build/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::loadPluginByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, std::ostream*)+0x60) [0x7f04ccf94d60] -> /home/cmx/sofa/build/lib/libSofaHelper.so.20.06.99(sofa::helper::system::PluginManager::readFromIniFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x4e0) [0x7f04ccf91740] -> ./runSofa() [0x412c1f] -> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f04caf39b97] -> ./runSofa() [0x40eb8a] Aborted (core dumped)
In my /home/cmx/SofaPython3/build/lib, including :libSofaPython3.so site-packages,
however, no libSofaPython3.so.1.0 file compared with sofa forum.
Another question, before using SofaPython3, I use SofaPython, however, when runcmx@cmx-Lenovo-IdeaPad-Y510P:~/sofa/build/bin$ python Python 2.7.17 (default, Jul 20 2020, 15:37:01) [GCC 7.5.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import Sofa Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Sofa >>>
I dont know how to import Sofa in Python environment.
Please give me some help. I was hoping someone could clear up the confusion.8 September 2020 at 10:23 #17095Damien Marchal
BlockedHi Cai,
About SofaPython3 and Conda the problem seems to be at the initialization of the plugin (where we initialize the python3 interpreter). Maybe, but it is only a guess, there is a mismatch between the version you use for compilation and the one shipped with Conda. On my computer I tend to only use apt and pip3 to install python packages. Each time I tried to use conda it generate a lot of mess so I just gave up. But If you success please tell us.
SofaPython3 is now an official plugin from the sofa-consortium…the new official (and updated) repository is now https://github.com/sofa-framework/SofaPython3
About the question related to old SofaPython. It is not possible to use it in a python environment because the python Sofa modules and the python interpreter are compiled together. So the only way is to use it is to load a Sofa scene with runSofa and do the code there using the python interpreter included in the plugin SofaPython.
-
AuthorPosts
- You must be logged in to reply to this topic.