Create a functionnal package of SOFA Framework to a Conda environnement #3661
Replies: 8 comments 9 replies
-
Thanks for sharing your experiments |
Beta Was this translation helpful? Give feedback.
-
Hi guys, I also did some testing on the packaging via conda. This would allow to have the runSofa and the python interface directly accessible for users (for developers it is necessary to have access to the source code). I managed to get a version of runSofa to run, even though I'm currently having problems with Qt. Here is my configuration:
and my build:
To improve the installation it would be necessary to do:
Cheers, Etienne |
Beta Was this translation helpful? Give feedback.
-
Thanks everyone for feedbacks, I'll try these this week 👍 |
Beta Was this translation helpful? Give feedback.
-
Hi guys, I've made some progress on this subject during these few days but I'm now stuck with a question that is outside my knowledge. Maybe someone will have an idea to solve it. The idea is to create two tools:
For point 1, I propose something like this:
I tested this script on my computer (MacOs). It allows to compile Sofa with the different plugins by searching the different libraries (qt, Eigen, python, ...) in the conda environment. It also allows to create an alias to the executable and to update the environment variables automatically. After running this script, runSofa runs perfectly and it is possible to load any scene written in python. However there is a problem when I run the python interpreter: The PYTHONPATH is correctly set to the installed sofapython3 site-packages, and the files are well found. But when the init.py of Sofa calls the "import Sofa.Helper", we get a segmentation error (from the .so file handling this import). I don't know how to fix this problem. For point 2, I want to use what I did for point 1 to generate Sofa+Sofapython3. However for the moment, the $Python_EXECUTABLE variable I use in my script does not point to a recognized python executable during the conda build. Maybe here someone will have a solution too. Cheers, Etienne |
Beta Was this translation helpful? Give feedback.
-
As an update, the PR #23085 opened on the conda forge! 🔥 🔥 🔥 👏 @olivier-roussel 👏 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Create a functionnal package of SOFA Framework to a Conda environnement
Overview
@hugtalbot gave me a mission : I have 2 weeks to purpose a PoC of a Sofa packaging to a Conda environment.
There are some difficulties for some people to implement Sofa in a Python ecosystem (Anaconda) and there is no functionnal package at the moment. My goal is to determine what it is possible to achieve, to understand the needs of the end-users, and with which tools.
Solutions & tools
After some discussions, there are several tools that can be used to make the packaging :
Some differences against thses two tools :
Pypi
Pip is a package manager to install python packages from Pypi. Generally, you download source code that is installed according to instructions in setup.py, using setuptools.
Most appropriate for pure Python packages, and Pip depends on a python interpreter.
Conda
Packages are downloaded from Anaconda Cloud. With conda, we download and install a pre-compiled platform dependent binaries. Conda is a package manager that handles not only Python packages but also packages in other languages, and can create virtual environments, that do not need to contain Python.
In this case, Conda seems to be more appropriate, because of pre-compilated environments.
PoC
Here all ressources i used to build the solution :
At first I was on a Windows system but after several builds attempts (which I will come back to) I decided to go on an Archlinux system, which solved many of my problems.
To create a Conda package, you have to install the whole Anaconda ecosystem. To use GUI packages with Linux, you will need to install the following extended dependencies for Qt:
Arch :
Debian / Ubuntu :
Download and launch the .sh installation (follow the Installation Guide if got a problem).
Then, install conda build :
To Build a conda package from scratch you have to create a file a root directory named
meta.yaml
. It is with this file that all the configuration of the package is done. Setup a directory like this :Create a folder that will contain the
meta.yaml
file (recipe is a good practice name) :mkdir recipe cd recipe/ touch meta.yaml
The template by default looks like this :
Here is the meta.yaml file I used after long trials and iterations (with commentary):
To launch build :
sudo conda build .
Errors
If you get this far, normally the build will break around 860/1970, with this error :
Possible Solutions
We tried to skip the script in meta.yaml and create a file named build.sh (in the same folder recipe). This script looks like this :
We need you ! If you have any ideas, do not hesitate 👍
Beta Was this translation helpful? Give feedback.
All reactions