OpenGATE / opengate

Gate 10
http://www.opengatecollaboration.org
GNU Lesser General Public License v3.0
53 stars 43 forks source link

Wheel needed to be installed inside Slicer #146

Open BishopWolf opened 1 year ago

BishopWolf commented 1 year ago

I need Gate inside Slicer, therefore I run a simple pip installation there, and it failed as it required a whl (python wheel): see this thread. Slicer has a bundled python 3.9, so the version is OK.

tbaudier commented 1 year ago

According to your thread, your are using windows system. For the moment, the wheel is only available for Mac and Linux. For Windows, it's on going (see https://github.com/OpenGATE/opengate/pull/115)

BishopWolf commented 1 year ago

I am trying now in Linux. The wheels install, but they do not work :

>>> import opengate as gate
opengate_core is not detected. Be sure to execute these lines before to run python:
export LD_LIBRARY_PATH=/home/alex/Programas/Slicer-5.3.0-2023-03-16-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs:${LD_LIBRARY_PATH}
export LD_PRELOAD=/home/alex/Programas/Slicer-5.3.0-2023-03-16-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs/libG4processes-9232ba54.so:/home/alex/Programas/Slicer-5.3.0-2023-03-16-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs/libG4geometry-fbd76286.so:${LD_PRELOAD}

Is there a workaround?

nkrah commented 1 year ago

Hey @BishopWolf, since your post is from April, could you be so kind and check if opengate now installs and works correctly for you? The code has evolved quite a lot since then ... Thanks

BishopWolf commented 1 year ago

Hey @BishopWolf, since your post is from April, could you be so kind and check if opengate now installs and works correctly for you? The code has evolved quite a lot since then ... Thanks

>>> from opengate import gate
opengate_core is not detected. Be sure to execute these lines before to run python:
export LD_LIBRARY_PATH=/Data/Programas/Slicer-5.3.0-2023-07-05-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs:${LD_LIBRARY_PATH}
export LD_PRELOAD=/Data/Programas/Slicer-5.3.0-2023-07-05-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs/libG4processes-92d9f07e.so:/Data/Programas/Slicer-5.3.0-2023-07-05-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs/libG4geometry-0c687114.so:${LD_PRELOAD}
>>> 

It's the same error, there is no way to start gate from within slicer. Adding the suggested lines before launching Slicer yields

$ export LD_LIBRARY_PATH=/Data/Programas/Slicer-5.3.0-2023-07-05-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs:${LD_LIBRARY_PATH}
export LD_PRELOAD=/Data/Programas/Slicer-5.3.0-2023-07-05-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs/libG4processes-92d9f07e.so:/Data/Programas/Slicer-5.3.0-2023-07-05-linux-amd64/bin/../lib/Python/lib/python3.9/site-packages/opengate_core.libs/libG4geometry-0c687114.so:${LD_PRELOAD}

-------- EEEE ------- G4Exception-START -------- EEEE -------

*** ExceptionHandler is not defined ***
*** G4Exception : HadDevPara_004
      issued by : G4HadronicDeveloperParameters
Parameter BERT_FERMI_SCALE is already defined.
*** Fatal Exception ***
-------- EEEE ------- G4Exception-END -------- EEEE -------

*** G4Exception: Aborting execution ***
bash: --------: command not found
bash: 14.6: command not found
bash: 14.6: command not found
bash: eval: line 11: syntax error near unexpected token `('
bash: eval: line 11: `      issued by : G4CrossSectionFactoryRegistry::Register(...)'

-------- EEEE ------- G4Exception-START -------- EEEE -------

*** ExceptionHandler is not defined ***
*** G4Exception : HadDevPara_004
      issued by : G4HadronicDeveloperParameters
Parameter BERT_FERMI_SCALE is already defined.
*** Fatal Exception ***
-------- EEEE ------- G4Exception-END -------- EEEE -------

*** G4Exception: Aborting execution ***
nkrah commented 1 year ago

Thanks for reporting back. I quickly looked at the thread on the Slicer discourse. From what I understand, slicer provides a proper wrapper of pip install, correct? Thus, the issue is probably related to where and how Slicer installs the python modules, so that opengate does not find them when executed within Slicer.

Personally, I do not use Slicer, but it seems a good idea to be able to run gate from Slicer, for dose calculation in your case, correct? The possibility to interface GATE with other software was one of the motivations to develop a new python-based version of GATE.

If you are interested, we could schedule a video meeting and look at the issue a bit more in detail together. What do you think?

BishopWolf commented 1 year ago

Dear @nkrah, it would be nice to have this meeting. I will be available next Tuesday, Paris Time zone.

Send me your emails to include you in a zoom/teams meeting (add also thomas @tbaudier )

BishopWolf commented 1 year ago

@nkrah @tbaudier , any news on this?

dsarrut commented 1 year ago

yes sure, please could you wait for few weeks, we are still working on this and this is not consolidated yet. We can plan something around end of Octobre, thanks ;)