I would like to import a few python modules in my Salome scripts that do not come with the Salome distribution.
How could I install pandas or meshio in Salome, for instance? Any established procedure to make sure everything is properly installed?
depending on which platform you are (Windows, Linux, etc) what you have to do is load the python environment of the SALOME distribution. This way you obtain access to the SALOME Python installation and can use the PIP command to install any additional packages that you need.
Additionally, I think SALOME-9.8.0 has Pandas? At least I see that from the configuration files (and in Linux).
could you please clarify how you can load the python enviroment of salome?
do you know if this could also be used to run python scripts generated by salome (a way to avoid "salome -t script.py)
loading the python environment of salome means that you modify the environment of a terminal or console by using the SALOME environment scripts:
source env_launch.sh (generated by ./sat environ SALOME)
env_launch.bat (shipped with SALOME).
You run these command from where you unpacked SALOME. This way you can get SALOME python and all the libraries that are present in the distribution.
Regarding running python scripts. Yes, but only for Non-GUI related things. See Using python salome libraries from a python IDE - #5 by gregor.simic for more info.
thank you for your advice, I am trying to install other modules besides Pandas.
I am working on Windows and I have a C:\SALOME-9.8.0 installation.
env_launch.bat but I’m not sure if it worked well. There isn’t any feedback from the script execution. I don’t get any python environment activated either. If I run python in the cmd line after that, I get the default python environment installed in my machine.
I looked into the W64 folder and found python/ and python/Scripts/pip. However, if I run
I get an this error:
Fatal error in launcher: Unable to create process using '"e:\s\salome-9.8.0\w64\python\python.exe" "C:\SALOME-9.8.0\W64\Python\Scripts\pip.exe"
It seems that there are hardcoded paths in the sat files.
Did I forget any configuration step? How can I proceed to install the modules with pip3 in SALOME-9.8.0? Do I need to run sat in Windows?
Many thanks and kind regards,
I just found the answer in Using SALOME - Use pip in SALOME
Although I still can’t use pip directly after running
./salome context I can use it with as module as suggested with
python -m pip install.
Thank you for your help @gregor.simic and @franco.ota
forgot to say that pip has to be run as
python -m pip <command>.
To my knowledge, sat isn’t used on Microsoft Windows. Or at least it is not bundled with the distributions.
Glad I could help!