# Module petsc4py not found on Anaconda

**URL:** <https://fenicsproject.discourse.group/t/module-petsc4py-not-found-on-anaconda/17315>\
**Category:** dolfinx\
**Tags:** dolfinx, petsc, variational-form\
**Created:** [March 26, 2025, 10:33am UTC](https://fenicsproject.discourse.group/t/module-petsc4py-not-found-on-anaconda/17315 "2025-03-26T10:33:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Inuwashi](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@Inuwashi](https://fenicsproject.discourse.group/u/Inuwashi)\
**Post date:** [March 26, 2025, 10:33am UTC](https://fenicsproject.discourse.group/t/module-petsc4py-not-found-on-anaconda/17315/1 "2025-03-26T10:33:50Z")

</div>

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.

```auto
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'

```

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [March 26, 2025, 4:08pm UTC](https://fenicsproject.discourse.group/t/module-petsc4py-not-found-on-anaconda/17315/2 "2025-03-26T16:08:56Z")

</div>

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

> **[GitHub - FEniCS/dolfinx: Next generation FEniCS problem solving environment](https://github.com/FEniCS/dolfinx/?tab=readme-ov-file#conda)**
>
> Next generation FEniCS problem solving environment

> _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](https://visualstudio.microsoft.com/downloads/).

There are several demos at: [FEniCS workshop — FEniCS Workshop](https://jsdokken.com/FEniCS-workshop/README.html)  
that doesn’t rely on PETSc, and you also have: [Solve the Poisson and linearised elasticity equations using pyamg — DOLFINx 0.9.0 documentation](https://docs.fenicsproject.org/dolfinx/v0.9.0/python/demos/demo_pyamg.html)
