Home › Forum › SofaPython3 › Getting Started › [SOLVED] Questions regarding the installation of SofaPython3 plugin
Tagged: GCC, Linux_ubuntu, SOFA_2012, SofaPython3
- This topic has 12 replies, 5 voices, and was last updated 3 years, 5 months ago by jnbrunet.
-
AuthorPosts
-
16 March 2021 at 15:34 #18862MathieuBlocked
Hello,
I managed to install sofa (v20.12, gcc7.5.0) on my Ubuntu 18.04 VM and it works properly. I want now to add the SofaPython3 plugin and I need some help. Here are questions that I have:
1) Should I use the in-tree build or the out-out-tree build ? Which method do you suggest for me as a beginner with unix system?
2) Following these instructions https://github.com/sofa-framework/SofaPython3/, I should clone the repo inCMAKE_EXTERNAL_DIRECTORIES
. What does it mean exactly ? Should I clone it in thesofa-plugins
($HOME/sofa-plugins
) directory (where I already have SoftRobots and STLIB)?
3) Do I need to build SOFA again after having added the SofaPython3 plugin? I setSOFA_EXTERNAL_DIRECTORIES
to$HOME/sofa-plugins/SoftRobots
when I built SOFA.Thank you for your precious help,
Best,
Mathieu17 March 2021 at 21:48 #18871HugoKeymasterHi @mdubied
Sorry I was away these last days!
When you say that you installed SOFA:
– which version did you install? v20.12.00 or v20.12.01? Make sure you use the latter
– is it the sources which you compiled? or the binaries?Best
Hugo
18 March 2021 at 08:01 #18872MathieuBlockedHi @Hugo
As I followed the instructions of this webpage https://www.sofa-framework.org/community/doc/getting-started/build/linux/ and used ninja to build SOFA, I compiled the sources (if I understand the difference between sources and binaries correctly – I am new to unix systems). For the version, I am not really sure, as I cannot find the exact information, but I cloned the v20.12 branch of the github repository (https://github.com/sofa-framework/sofa/tree/v20.12) in
$HOME/sofa/src
file.I hope I answered the questions. Please let me know if you need more precision.
Best,
Mathieu18 March 2021 at 08:08 #18907HugoKeymasterYes perfect @mdubied
In the sources of SOFA ($HOME/sofa/src), could you launch:git log
and share with us the output?Best
Hugo
18 March 2021 at 13:50 #18912MathieuBlockedHere is the output:
(base) srl@ubuntu:~/sofa/src$ git log commit c65c75e1cf1016138626f71f6938d62c6cf18726 (HEAD -> v20.12, tag: v20.12.01, origin/v20.12) Author: Guillaume Paran <guillaume.paran@sofa-framework.org> Date: Fri Feb 26 16:16:31 2021 +0100 [CMake] Bump version to v20.12.01 commit 44a50cee733a0a897dde4c0bc6017ede6a7ce470 Author: Guillaume Paran <guillaume.paran@sofa-framework.org> Date: Fri Feb 26 16:16:14 2021 +0100 [Changelog] Update for v20.12.01 commit 95403c300f9142bdb31bfa36a7a528a455326a8e Author: Damien Marchal <damien.marchal@univ-lille1.fr> Date: Tue Feb 23 23:30:33 2021 +0100 [all] Fix invalid Memory access in MechanicalObject and Compliant_test (#1849) * [Compliant_test] Add scope to WriteAccessor. A write accessor is holding a pointer to the data. If the pointed data is de:
18 March 2021 at 14:51 #18914HugoKeymasterHi @mdubied
Ok so you are well using the v20.12.01 (latest release) of SOFA. Great!1) both work well! it is really up to you!
2) Compilation guidance are available here: https://github.com/sofa-framework/SofaPython3/blob/2bbdb9b937be9926b74d4cbd88c2c93b6dfcc115/docs/sphinx/source/menu/Compilation.rst
(and this will soon be directly available in the SofaPython3 doc)Best wishes,
Hugo
19 March 2021 at 11:09 #18924MathieuBlockedThank you for the answers!
It seems that the export part (out-of-tree build as described in 2)) does not work for me.
I executed the installation with
cmake --install .
but the next steps give me the following:
(base) srl@ubuntu:~/sofa/build/v20.12$ export SOFA_ROOT="/home/srl/sofa/build/v20.12/install" (base) srl@ubuntu:~/sofa/build/v20.12$ SOFA_ROOT/lib/cmake/SofaFramework/SofaFrameworkTargets.cmake bash: SOFA_ROOT/lib/cmake/SofaFramework/SofaFrameworkTargets.cmake: No such file or directory
Do you have an idea of how I should process now ?
Best,
Mathieu24 March 2021 at 08:47 #18965MathieuBlockedEDIT:
After some iterations, I solved the problem by building SOFA (v20.12.01) again, and adding the SofaPython3 plugin path to the entry
CMAKE_EXTERNAL_DIRECTORIES
(just settingCMAKE_EXTERNAL_DIRECTORIES=/home/srl/sofa-plugins
, assofa-plugins
include all plugins I currently use: STLIB, SoftRobots, Sofa Python3 ), after cloning the plugin as described here : https://github.com/sofa-framework/SofaPython3Thank you for your help,
Best,
Mathieu26 March 2021 at 05:52 #18999vacBlockedHi Hugo,
I am also new to sofa, and thanks for your instruction for the compilation at here, i finished successfully the in-tree build but still can’t import SofaRuntime in python3.8, could you give a hint which part i have missed?
My Sofa Version is v20.12.01,
Python version is 3.8.5, the default python for ubuntu 20.04.02Best,
vac1 April 2021 at 14:29 #19064HugoKeymasterDear @kexinwei
Welcome to SOFA then!
To run SOFA from a Python environment you should have the following variable defined:export SOFA_ROOT=/path/to/SOFA-build export PYTHONPATH=/path/to/SOFA/SofaPython3-build/lib/python3/site-packages export QT_PLUGIN_PATH=$SOFA_ROOT/bin
I think it is what is missing in your case. Let me know if this helps.
Best wishes,
Hugo
21 June 2021 at 04:44 #19753xiaochaosuiBlockedHi Hugo,
I figured the environment.But,I hava a problem when I import SofaRuntime.>>> import SofaRuntime Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/root/my-sofa/build/plugins/SofaPython3/lib/python3/site-packages/SofaRuntime/__init__.py", line 7, in <module> from .SofaRuntime import * ModuleNotFoundError: No module named 'SofaRuntime.SofaRuntime'
Best,
xiaochaosui21 June 2021 at 04:46 #19754xiaochaosuiBlockedHi Hugo,
I figured the environment.But,I hava a problem when I import SofaRuntime.>>> import SofaRuntime Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/root/my-sofa/build/plugins/SofaPython3/lib/python3/site-packages/SofaRuntime/__init__.py", line 7, in <module> from .SofaRuntime import * ModuleNotFoundError: No module named 'SofaRuntime.SofaRuntime'
Best,
xiaochaosui29 June 2021 at 18:49 #19899 -
AuthorPosts
- You must be logged in to reply to this topic.