Build Netgen on Linux (CentOS)

Hello,

I have been trying to install Netgen on my work computer - the OS is CentOS Linux 7.

The most recent version uses python 3.7 which is not available here - so I downloaded version 6.2.1807.
It does seem to install correctly and I can generate meshes, but I cannot do anything else. I think it might be a problem related to submodules (it seems like it doesn’t get the right ones?)

Another thing I noticed is that when I launch it, it doesn’t load the OCC module, or the ngsolve library (which happens when I run it on my windows laprop) - the process stops before this.

Is there anything different I should be doing?

Thanks!
Susana

Hi Susana,

I assume you compiled Netgen from source? If so, the Python version does not matter, this is only relevant for prebuilt binaries for Windows and MacOS.

Did you follow the instructions here?
https://ngsolve.org/docu/latest/install/installlinux.html

To update the submodules properly, execute the following:

git submodule update --init --recursive || true git submodule sync --recursive git submodule update --init --recursive

Best,
Matthias

Thanks Matthias, that worked!

It wasn’t completely clear from the documentation, but this solved the problem.

Best,
Susana

Hello,

I am trying to build ngsolve on CentOS 7 and keep running into problems. Does anyone have a working build for CentOS 7 they would be able to share (ngsolve-install) ? Better yet, does anyone have a working installation script for CentOS 7 similar to the standard one for Ubuntu on the ngsolve website Build on Linux — NGS-Py 6.2.2302 documentation ?

Appreciate any help

Thanks and regards,

Valery

Hi Valery,

Which version of python3 are your using on your system? (python3 --version)

We are currently working on pip-packages for netgen and ngsolve, a preliminary release will be available this week (at least for linux).

Best,
Matthias

Hi Matthias,

Thanks for the reply.

I have Python 3.6.8 installed and actually managed to get the build to work in the mean time. Most of the problems I had were related to looking up the appropriate package name and version for all the required libraries, so constructing the equivalent of the Ubuntu command below for CentOS. A bit non-trivial since many of the package names are different between Ubuntu and CentOS:

sudo apt-get update && sudo apt-get -y install python3 python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev liblapacke-dev

Anyway, I have a working build on CentOS 7 now and if anyone would like it I will be glad to post a link to download the directory ngsolve-install

Thanks and regards,

Valery

Hi Matthias,

How has the work on pip-packages been going? Is it possible to try it? I am still having problems on CentOS/Redhat and would like to see if pip might help

Thanks very much,

Valery

Hi Valery,

There is some progress on the pip packages, we will announce them, once there are no (known) issues on our side anymore.

In the meantime you may try the (preliminary) builds on test.pypi:

pip3 install mkl
pip3 install -i https://test.pypi.org/simple/ ngsolve==6.2.2105.dev126

Note, that this package may be removed at any time.

Best,
Matthias

Hi Matthias,

thanks, this worked well on one of my Kubuntu 20.04 machines. Didn’t work on another one with the same OS and same python3 version Python 3.8.10. The error messages are below in case it might be useful. Any idea why it worked on one but not the other machine?

In a similar way, I have been having inconsistent results running ngsolve/netgen that I built under either Kubuntu or CentOS. In general, it works on the machine I built it on, but when I copy ngsolve-install to other machines it works on some but doesn’t on others. When it doesn’t work, I get “Illegal instruction (core dumped)”. When I run it under gdb, the crash is reported in regexp (I can provide more specifics if you like). Any ideas what may be causing this and why it varies from machine to machine?

Thanks very much,

Valery

pip3 install -i https://test.pypi.org/simpl
e/ ngsolve==6.2.2105.dev126
Looking in indexes: Simple index
Collecting ngsolve==6.2.2105.dev126
Downloading https://test-files.pythonhosted.org/packages/44/19/e62144fdf71264dcf4b6adc
441a322efd1db4e6e7bce4f52fad407f7d759/ngsolve-6.2.2105.dev126-cp38-cp38-manylinux_2_17_x
86_64.manylinux2014_x86_64.whl (28.3 MB)
|████████████████████████████████| 28.3 MB 1.0 MB/s
Collecting netgen-mesher==6.2.2105.dev45
Downloading https://test-files.pythonhosted.org/packages/a3/b5/34821483e19639eb3b21e49
290499ba8610df8803517ef41ccb57dea3a0c/netgen_mesher-6.2.2105.dev45-cp38-cp38-manylinux_2
_17_x86_64.manylinux2014_x86_64.whl (37.9 MB)
|████████████████████████████████| 37.9 MB 350 kB/s
ERROR: Could not find a version that satisfies the requirement mkl==2021.* (from ngsolve
==6.2.2105.dev126) (from versions: none)
ERROR: No matching distribution found for mkl==2021.* (from ngsolve==6.2.2105.dev126)

Hello Susana, Mathias, and Valery,
I am also getting the “Illegal instruction (core dumped)”, in my case when importing netgen or ngsolve from python 3.10.6. Any advice is appreciated.


To put it in context, I updated form Ubuntu 20.04 focal to 22.04 jammy. Before I could run netgen and ngsolve without any trouble. My laptop has some years now (Intel(R) Core™ i5-3210M CPU @ 2.50GHz, RAM 8GB; in case it is relevant, avx2 does not appear on the flags in /proc/cpuinfo). I copy below the information of cpu and memory, plus the error message. Thank you.


~$ python3
Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux

import netgen
Illegal instruction (core dumped)


~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core™ i5-3210M CPU @ 2.50GHz
stepping : 9
microcode : 0x21
cpu MHz : 2628.683
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts md_clear flush_l1d
vmx flags : vnmi preemption_timer invvpid ept_x_only flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds mmio_unknown
bogomips : 4988.29
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

###[plus something similar for the other three cores]###


~$ sudo lshw -c memory
*-cache:0
description: L1 cache
physical id: 2
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:1
description: L2 cache
physical id: 3
slot: Unknown
size: 256KiB
capacity: 256KiB
capabilities: asynchronous internal write-back instruction
configuration: level=2
*-cache:2
description: L3 cache
physical id: 4
slot: Unknown
size: 3KiB
capacity: 3KiB
capabilities: asynchronous internal write-back instruction
configuration: level=3
*-cache:0
description: L1 cache
physical id: 1
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:0
description: L1 cache
physical id: 7
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:1
description: L2 cache
physical id: 8
slot: Unknown
size: 256KiB
capacity: 256KiB
capabilities: asynchronous internal write-back instruction
configuration: level=2
*-cache:2
description: L3 cache
physical id: 9
slot: Unknown
size: 3KiB
capacity: 3KiB
capabilities: asynchronous internal write-back instruction
configuration: level=3
*-cache:1
description: L1 cache
physical id: 6
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:0
description: L1 cache
physical id: c
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:1
description: L2 cache
physical id: d
slot: Unknown
size: 256KiB
capacity: 256KiB
capabilities: asynchronous internal write-back instruction
configuration: level=2
*-cache:2
description: L3 cache
physical id: e
slot: Unknown
size: 3KiB
capacity: 3KiB
capabilities: asynchronous internal write-back instruction
configuration: level=3
*-cache:2
description: L1 cache
physical id: b
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:0
description: L1 cache
physical id: 11
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-cache:1
description: L2 cache
physical id: 12
slot: Unknown
size: 256KiB
capacity: 256KiB
capabilities: asynchronous internal write-back instruction
configuration: level=2
*-cache:2
description: L3 cache
physical id: 13
slot: Unknown
size: 3KiB
capacity: 3KiB
capabilities: asynchronous internal write-back instruction
configuration: level=3
*-cache:3
description: L1 cache
physical id: 10
slot: Unknown
size: 32KiB
capacity: 32KiB
capabilities: asynchronous internal write-back
configuration: level=1
*-memory
description: System Memory
physical id: 14
slot: System board or motherboard
size: 8GiB
*-bank:0
description: SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
product: M471B5173QH0-YK0
vendor: Samsung
physical id: 0
serial: 0x19BEAA49
slot: DIMM0
size: 4GiB
clock: 1600MHz (0.6ns)
*-bank:1
description: SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
product: HMT351S6CFR8C-PB
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 1
serial: 0x0F6480AA
slot: DIMM0
size: 4GiB
clock: 1600MHz (0.6ns)
*-firmware
description: BIOS
vendor: Apple Inc.
physical id: 1a
version: 421.0.0.0.0
date: 12/17/2020
size: 1MiB
capacity: 8MiB
capabilities: pci upgrade shadowing cdboot bootselect acpi ieee1394boot smartbattery netboot

Hi Henao,

Welcome to the forum!

Unfortunately, machines that old are not supported by the pip installer. However, you can compile Netgen and NGSolve yourself following the instructions here:
https://docu.ngsolve.org/latest/install/installlinux.html

Best,
Matthias