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?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật