Is it possible to defaulty configure MPI with pip?

Dear developers,

I have to use ngsolve on a hpc cluster. However, due to their strict regulation, it is hard to make from source to turn on the MPI functions. Would it be possible for you to include -DUSE_MPI=ON as a default setting for pip install?

Many thanks for your attention.

Best,
Chuning

Can you modify the setup.py by changing line 67 to

_cmake_args = [
    f'-DNETGEN_DIR={netgen_dir}',
    '-DUSE_SUPERBUILD:BOOL=ON',
    '-DCMAKE_BUILD_TYPE=Release',
    '-DBUILD_FOR_CONDA=ON',
    '-DUSE_MPI=ON',
    '-DBUILD_STUB_FILES=OFF',
    f'-DUSE_UMFPACK={use_umfpack}',
    f'-DNGSOLVE_VERSION_PYTHON={version}',
]

and then run locally pip install .

I tried but it did not work. Thanks anyway!

What error are you getting ? Maybe we can figure this out :slight_smile:

I tried to install ngsolve with MPI support enabled on our new HPC with the above posted modifications to setup.py via pip install from local archives.

However I get the error message:

Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      fatal: Kein Git-Repository (oder irgendeines der Elternverzeichnisse): .git
      Traceback (most recent call last):
        File "/tmp/pip-req-build-0zffjx8q/tests/get_python_version_string_from_git.py", line 8, in <module>
          git_version = check_output(['git', 'describe', '--tags'], cwd=cwd).decode('utf-8').strip()
        File "/software/rapids/r23.10/Python/3.10.4-GCCcore-11.3.0/lib/python3.10/subprocess.py", line 420, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/software/rapids/r23.10/Python/3.10.4-GCCcore-11.3.0/lib/python3.10/subprocess.py", line 524, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['git', 'describe', '--tags']' returned non-zero exit status 128.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-0zffjx8q/setup.py", line 30, in <module>
          version = check_output([sys.executable,'tests/get_python_version_string_from_git.py'], cwd='.').decode('utf-8').strip()
        File "/software/rapids/r23.10/Python/3.10.4-GCCcore-11.3.0/lib/python3.10/subprocess.py", line 420, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/software/rapids/r23.10/Python/3.10.4-GCCcore-11.3.0/lib/python3.10/subprocess.py", line 524, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['/data/horse/ws/s0570488-Utility/bin/python3', 'tests/get_python_version_string_from_git.py']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Does anybody have dealt with this problem before and knows a simple solution to installing ngsolve with MPI support enabled via pip install?

Best

Philipp

the builder you are using assumes the source code is in a git repo and uses the version from git describe. Either use a git clone, fake the git repo or comment out that line in cmake to a hard coded version.