nextfoam / baram

CFD for Everyone
https://baramcfd.org/
GNU General Public License v3.0
100 stars 17 forks source link

Can't run the latest version on macOS #80

Closed lukaville closed 5 months ago

lukaville commented 5 months ago

Version: the latest main branch

To Reproduce Steps to reproduce the behavior: run baramFlow or baramMesh on macOS

Stacktrace:

(venv) ➜  baram git:(main) ✗ python -m baramMesh.main

[2024-05-26 13:28:57,593][root] ==> Uncaught exception
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/nickolay/Downloads/baram/baramMesh/main.py", line 85, in <module>
    main()
  File "/Users/nickolay/Downloads/baram/baramMesh/main.py", line 57, in main
    numCores = min(len(psutil.Process().cpu_affinity()), psutil.cpu_count(logical=False)) - 1
AttributeError: 'Process' object has no attribute 'cpu_affinity'
(venv) ➜  baram git:(main) ✗ python3.9 -m baramMesh.main

[2024-05-26 13:29:09,474][root] ==> Uncaught exception
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/nickolay/Downloads/baram/baramMesh/main.py", line 85, in <module>
    main()
  File "/Users/nickolay/Downloads/baram/baramMesh/main.py", line 57, in main
    numCores = min(len(psutil.Process().cpu_affinity()), psutil.cpu_count(logical=False)) - 1
AttributeError: 'Process' object has no attribute 'cpu_affinity'

Seems like cpu_affinity is not available on macOS: https://github.com/giampaolo/psutil/issues/1826, likely we need some fallback option

jiban commented 5 months ago

Hi Nick, Thank you for letting me know the error and the link. I confirmed the error, and the fix will be included in the next release.

Best regards, Jake

jiban commented 5 months ago

In the meantime, I'm releasing v24.2.0 binary for macOS with this fix in a few days.

jiban commented 5 months ago

Hi Nick, You can download v24.2.0 from baramcfd. This version has the fallback you said. Thank you.

lukaville commented 5 months ago

It works now, thank you!