I’m trying to install python modules, but I get this error while configuring:
$ cd /home/user/geant4/geant4.10.06.p03/environments/g4py
$ export GEANT4_INSTALL=/home/user/geant4/geant4.10.06.p03-install/
$ mkdir build && cd build
$ cmake ..
CMake Error at G4PythonHelpers.cmake:15 (file):
file RELATIVE_PATH must be passed a full path to the file:
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
CMake Error at CMakeLists.txt:23 (geant4_add_feature):
Unknown CMake command “geant4_add_feature”.
I follow this steps to install Geant4:
$ mkdir geant4 && cd geant4
$ wget -nc http://geant4-data.web.cern.ch/geant4-data/releases/geant4.10.06.p03.tar.gz
$ tar -xvf geant4.10.06.p03.tar.gz
$ cd ..
$ mkdir geant4.10.06.p03-build && cd geant4.10.06.p03-build
$ cmake -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_BUILD_TLS_MODEL=global-dynamic -DGEANT4_USE_PYTHON=ON -DGEANT4_USE_SYSTEM_EXPAT=OFF -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_INSTALL_DATA=ON -DCMAKE_INSTALL_PREFIX=/home/user/geant4/geant4.10.06.p03-install /home/user/geant4/geant4.10.06.p03
$ make -j4
$ make install
There’s no longer a need to build Geant4Py separately, the install you made with:
$ cmake -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_BUILD_TLS_MODEL=global-dynamic -DGEANT4_USE_PYTHON=ON -DGEANT4_USE_SYSTEM_EXPAT=OFF -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_INSTALL_DATA=ON -DCMAKE_INSTALL_PREFIX=/home/user/geant4/geant4.10.06.p03-install /home/user/geant4/geant4.10.06.p03
$ make -j4
$ make install
should have built and installed the modules under /home/user/geant4/geant4.10.06.p03-install/lib64/python3.X/site-packages. The lib64 might be lib depending on your exact platform, and X be be for the minor version of python on your system, but the modules should be present!
As you mentioned, the module Geant4 is present in “/home/user/geant4/geant4.10.06.p03-install/lib/python3.8/site-packages/Geant4”
If I understood correctly, I don’t need to compile g4py again in a build directory like in older versions. But how can I compile and install g4py modules such as NISTmaterials, MedicalBeam …
These modules are now only built as part of the testing procedure. Adding first class examples for Geant4Py as for the C++ libraries is on the todo lost, but other requirements, features and testing for 10.7 is taking all the time at the moment.
Also, a higher priority item for Geant4Py maintenance and support will be migration to pybind11 (which will also significantly change both these tests and the new examples).
With the new version (10.07) I still cannot compile any Geant4Py example due to the g4py modules which are not available, is there a solution to fix this problem ?
I wanted to bring this topic up again. I was able to install most of Geant4Py correctly, but not all of it. For example, using the answer given here, I am missing the following gdml package. Everything else appears to have installed correctly.