17 November 2021 at 11:25 #20810Alex K.Blocked
I made a fresh install of the sofa binaries.
I can run python scenes with runSofa name_of_scene.py but I cannot start sofa from python (v3.8.12).
>>> import Sofa --------------------------------------- Checking SOFA_ROOT and SOFAPYTHON3_ROOT Using environment variable SOFA_ROOT: /home/alex/AppImages/SOFA_v21.06.02_Linux Warning: environment variable SOFAPYTHON3_ROOT is empty. Trying to guess it. Guessed SOFAPYTHON3_ROOT: /home/alex/AppImages/SOFA_v21.06.02_Linux/plugins/SofaPython3 --------------------------------------- Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/alex/AppImages/SOFA_v21.06.02_Linux/plugins/SofaPython3/lib/python3/site-packages/Sofa/__init__.py", line 104, in <module> import Sofa.Helper ModuleNotFoundError: No module named 'Sofa.Helper'
Here is the PYTHONPATH:
import sys for p in sys.path: ... print(p) ... /home/alex/AppImages/SOFA_v21.06.02_Linux/plugins/SofaPython3/lib/python3/site-packages /home/alex /usr/lib/python38.zip /usr/lib/python3.8 /usr/lib/python3.8/lib-dynload /home/alex/.local/lib/python3.8/site-packages /home/alex/.local/lib/python3.8/site-packages/gmsh-4.8.4-Linux64-sdk/lib /home/alex/.local/lib/python3.8/site-packages/gmsh-4.8.4-Linux64-sdk/bin /usr/local/lib/python3.8/dist-packages /usr/lib/python3/dist-packages3 December 2021 at 15:28 #210566 December 2021 at 10:38 #21058psomersBlocked
I believe the downloadable Sofa binaries are compiled for python 3.7. So if you just downloaded them, that could be the problem.6 December 2021 at 16:27 #210636 December 2021 at 18:23 #21067dlouisBlocked
Thanks for the answers,
Yes I noticed this was the problem. If I compile myself V21.06, it works with my python 3.8 installation and I get no errors. Unfortunately, to use the binaries (for instance I want to use the DEFROST binaries V19.06), it is not possible to install python 3.7 on ubuntu 20.04 LTS using
sudo apt install python3-dev. Ubuntu 20.04 allows only versions starting from python 3.8 as far as I know.
To solve this, I tried using anaconda, but then other problems arose. For instance, I get the errors “no module named numpy” even if numpy is installed in my envrionment, and others like “no module named SofaRuntime.SofaRuntime”. Such errors do not arise outside anaconda. Could you please help me to set up an anaconda env properly to use Sofa ? I feel it’s the easiest way to use different versions of the software.
Louis10 December 2021 at 19:56 #21117HugoKeymaster
Great to read that you solved the issue.
Your question is actually different than the topic title. Is this correct?
@damien-marchaluniv-lille1-fr I do not remember how compatible were the v19.06 binaries of Defrost (including SoftRobots etc) was compatible with python3. Was it?
Else @dlouis :
– you can compile the SoftRobots plugin aside SOFA
– the new release of SOFA is coming very soon and the associated SoftRobots, you can wait for it
- You must be logged in to reply to this topic.