A.Be.
A.Be.

Reputation: 1

Error while installing petsc4py "Could not build wheels for petsc"

I'm trying to install petsc4py for python. I'm currently using WSL (Ubuntu) but I've tried in Windows as well and the result is always the same. The installation of e.g. numpy or pandas worked as expected.

I've tried all types of commands as explained in the installation guide or the PyPi page but I always get the following error (I assume only the last few lines are relevant, but here is the whole thing):

Me:~$ python3 -m pip install mpi4py petsc petsc4py
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: mpi4py in /usr/local/lib/python3.10/dist-packages (3.1.6)
Collecting petsc
  Using cached petsc-3.21.1.tar.gz (17.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting petsc4py
  Using cached petsc4py-3.21.1.tar.gz (419 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [101 lines of output]
      Collecting petsc<3.22,>=3.21
        Using cached petsc-3.21.1.tar.gz (17.3 MB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting wheel
        Using cached wheel-0.43.0-py3-none-any.whl (65 kB)
      Collecting mpi4py>=1.2.2
        Using cached mpi4py-3.1.6-cp310-cp310-linux_x86_64.whl
      Building wheels for collected packages: petsc
        Building wheel for petsc (pyproject.toml): started
        Building wheel for petsc (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        × Building wheel for petsc (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [75 lines of output]
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib
            creating build/lib/petsc
            copying config/pypi/__init__.py -> build/lib/petsc
            copying config/pypi/__main__.py -> build/lib/petsc
            running install
            =============================================================================================
                                     Configuring PETSc to compile on your system
            =============================================================================================
            =============================================================================================
                                                 ***** WARNING *****
              Using default C optimization flags "-g -O". You might consider manually setting optimal
              optimization flags for your system with COPTFLAGS="optimization flags" see
              config/examples/arch-*-opt.py for examples
            =============================================================================================
            =============================================================================================
                                                 ***** WARNING *****
              Using default Cxx optimization flags "-g -O". You might consider manually setting optimal
              optimization flags for your system with CXXOPTFLAGS="optimization flags" see
              config/examples/arch-*-opt.py for examples
            =============================================================================================
            =============================================================================================
                                                 ***** WARNING *****
              Using default FC optimization flags "-g -O". You might consider manually setting optimal
              optimization flags for your system with FOPTFLAGS="optimization flags" see
              config/examples/arch-*-opt.py for examples
            =============================================================================================

            *********************************************************************************************
                       UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
            ---------------------------------------------------------------------------------------------
              Could not find a functional BLAS. Run with --with-blas-lib=<lib> to indicate the library
              containing BLAS.
              Or --download-fblaslapack=1 to have one automatically downloaded and installed
            *********************************************************************************************

            Traceback (most recent call last):
              File "/tmp/tmpi9pta6w4_in_process.py", line 363, in <module>
                main()
              File "/tmp/tmpi9pta6w4_in_process.py", line 345, in main
                json_out['return_val'] = hook(**hook_input['kwargs'])
              File "/tmp/tmpi9pta6w4_in_process.py", line 261, in build_wheel
                return _build_backend().build_wheel(wheel_directory, config_settings,
              File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 230, in build_wheel
                return self._build_with_temp_dir(['bdist_wheel'], '.whl',
              File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
                self.run_setup()
              File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
                exec(compile(code, __file__, 'exec'), locals())
              File "setup.py", line 359, in <module>
                setup(
              File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
                return distutils.core.setup(**attrs)
              File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
                return run_commands(dist)
              File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 163, in run_commands
                dist.run_commands()
              File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
                self.run_command(cmd)
              File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
                cmd_obj.run()
              File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 335, in run
                self.run_command('install')
              File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
                cmd_obj.run()
              File "setup.py", line 282, in run
                config(prefix, self.dry_run)
              File "setup.py", line 189, in config
                raise RuntimeError(status)
            RuntimeError: 256
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for petsc
      Failed to build petsc
      ERROR: Could not build wheels for petsc, which is required to install pyproject.toml-based projects
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Any idea how to solve this?

Upvotes: 0

Views: 513

Answers (0)

Related Questions