Problem Identification:
If the system crashes during the python setup.py install process, it is likely due to a memory overload. To confirm, monitor the system’s memory usage in a separate terminal with the following command:
watch -n 1 free -h
If you observe a rapid and sustained spike in memory consumption (boom-up) leading to a system freeze or crash, the issue is likely caused by parallel compilation using too many threads.
Solution:
Limit the number of parallel compilation threads to reduce memory pressure. This can be done by modifying the setup.py file:
Open setup.py in a text editor.
Locate line 145, which defines MAX_COMPILATION_THREADS=12.
Reduce this value to a smaller number. For a minimal resource footprint, set it to 1:
# Before
MAX_COMPILATION_THREADS=12
# After
MAX_COMPILATION_THREADS=1
Save the file and re-run the installation:
Others:
If you encounter this situation when using "pip install", please download the compressed file and install it by modifying the "setup.py" file as described above.