Help! No module named 'dolfin' on mac

Hi everyone. I have trouble using dolfin on my Macbook(Intel Core i7)

The trouble is
“Traceback (most recent call last):
File “/Users/yuanheng/Downloads/NematicInChannel/pythonModules/initializeSimulation.py”, line 2, in
from dolfin import *
ModuleNotFoundError: No module named ‘dolfin’”

And I use
“conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx mpich pyvista” to install

And the output for:

conda activate fenicsproject
pip3 list

are:
Package Version


fenics-dijitso 2019.1.0
fenics-dolfin 2019.1.0
fenics-ffc 2019.1.0
fenics-fiat 2019.1.0
fenics-ufl 2019.1.0
gmpy2 2.1.2
mpi4py 3.1.3
mpmath 1.2.1
numpy 1.23.3
petsc4py 3.17.4
pip 22.2.2
pkgconfig 1.5.5
pybind11 2.10.0
pybind11-global 2.10.0
setuptools 65.4.1
six 1.16.0
slepc4py 3.17.2
sympy 1.11.1
wheel 0.37.1

And for “which pip3” command
the output is /Users/yuanheng/opt/anaconda3/envs/fenicsproject/bin/pip3

If I call which pip3 outside the conda environment, the path I am getting is: /Users/yuanheng/opt/anaconda3/bin/pip3

Here you are installing DOLFINx, not DOLFIN.
Thus you would need to load the dolfinx module.
For demos see:

or
https://jorgensd.github.io/dolfinx-tutorial/

Thank you very much for your reply. However, I tried DOLFINx instead but the same issue occur.

I think this posting(Anaconda installation of FEniCS on MacOS) will be helpful. Why not try using docker or another platform other than conda?

P.S.) I also often use macOS, but there were no major errors in operation when using docker.

Thank you very much for your help. I just installed docker. However, the same issue occurred again.

If you have run vigilant_knuth among docker containers, you need to run the terminal program provided by macOS and entre the docker container through commands like

$ docker exec -ti vigilant_knuth /bin/bash -l

Then, the ubuntu environment where dolfinx is installed is loaded.
After that, you can check whether dolfinx is installed with the python3 -c command!