Module petsc4py not found on Anaconda

Hello,

I’m posting here because I’m having an issue with the petsc4py module. I’m trying to solve the heat equation, and to create the variational form, I need to use dolfinx.fem.petsc.LinearProblem. However, the petsc module is not found and does not exist on Anaconda (Windows).

How can I install it? Or is there another way to solve this problem using different modules?

Thank you for your response.

from dolfinx.fem.petsc import LinearProblem
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[11], line 1
----> 1 from dolfinx.fem.petsc import LinearProblem

File ~\anaconda3\envs\fenicsx-env\Lib\site-packages\dolfinx\fem\petsc.py:20
     17 import functools
     18 import typing
---> 20 from petsc4py import PETSc
     22 # ruff: noqa: E402
     23 import dolfinx

ModuleNotFoundError: No module named 'petsc4py'

PETSc is not supported on windows (unfortunately), as stated in

Windows only: Windows conda packages are currently in beta testing. PETSc and petsc4py are not available on Windows; as an alternative we recommend using pyamg following python/demo/demo_pyamg.py. Because FEniCS uses just-in-time compilation it necessary to install Microsoft Visual Studio.

There are several demos at: FEniCS workshop — FEniCS Workshop
that doesn’t rely on PETSc, and you also have: Solve the Poisson and linearised elasticity equations using pyamg — DOLFINx 0.9.0 documentation