G4 Python Environment Installation Problem on Mac

I tried to enable the “GEANT4_USE_PYTHON” variable in CMake (multithreaded on, so did the GEANT4_BUILD_TLS_MODEL = global-dynamic) and configure → generate was successful.

However, as I run the ‘make’ command, the compiler builds for some time, but then shows this error message:
“clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable”

Since the “make” was always unsuccessful (I’ve tried a couple of times), later I decided to uncheck the …_USE_PYTHON option, and then a successful build happened.
But, I was actually eagerly interested to use GEANT4 in python since I’m comfortable in it and my other projects are also in Python.

I don’t think this is anything specific to the Python build being enabled (at least, we’ve never seen this type of error before). All I can see is that you’re running with make -j and this might be overloading the system - perhaps try explicitly setting the argument to the number of cores the system has or lower. A few results on the error message pop up in Google/StackOverflow etc, so may also be worth browsing these to see if there’s anything there that could help resolve things.

I think I’ve done the process by running “make -j8” too, as my processor is 8 core, but the same error appears.

However, now I have successfully installed G4, but without the …_USE_PYTHON option.
If I now run these commands:

$ cd /my G4 source directory/geant4.10.3-build
$ cmake -DGEANT4_BUILD_TLS_MODEL=global-dynamic

On executing the CMake command, it will run to configure the build and generate Unix Makefiles to perform the actual build automatically, right?

and then
$ make
$ make install

Is it gonna take a lot of time as before during the make command?

However, I decided to
$ make uninstall
in the build directory and then manually delete the build folder as well as some folder in the /usr/lib location.
And then I follow the usual procedure (with GEANT4_USE_PYTHON = ON) but this time, changing the

And then,

$ make
The terminal took approximately 30 minites. But as I run
$ make install
a new error appears
“make: *** [install] Error 1”
(see the attached image)

What should I do?

@radwanparvez Have you tried installing geant4 with conda? To install with conda run,

conda install -c conda-forge geant4 -y

FYI, Python support has been added to geant4 since v10.7.0 (conda install)

As an alternative, You can also look into the geant4_pybind package.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.