No module named 'dolfin' on Jupyter notebook

I installed fenics using

conda create -n fenicsproject -c conda-forge fenics

and added the fenicsproject environment to Jupyter Notebook following ’ How to add your Conda environment to your jupyter notebook in just 4 steps’ by Cooper R K. It all went well. However when I try to run a simple code

from dolfin import *
from fenics import *

import numpy as np
import matplotlib.pyplot as plt

mesh = UnitSquareMesh(32,32)

I get the error

ModuleNotFoundError                       Traceback (most recent call last)
Input In [6], in <cell line: 1>()
----> 1 from dolfin import *
      2 from fenics import *
      3 from tabulate import tabulate

ModuleNotFoundError: No module named 'dolfin'

I have python version 3.9 installed and the output of pip3 list is

Package                       Version
----------------------------- --------------------
aiohttp                       3.8.3
aiosignal                     1.2.0
alabaster                     0.7.12
anaconda-client               1.11.0
anaconda-navigator            2.3.2
anaconda-project              0.11.1
anyio                         3.5.0
appdirs                       1.4.4
applaunchservices             0.3.0
appnope                       0.1.2
appscript                     1.1.2
argon2-cffi                   21.3.0
argon2-cffi-bindings          21.2.0
arrow                         1.2.3
astroid                       2.11.7
astropy                       5.1
asttokens                     2.0.5
async-timeout                 4.0.2
atomicwrites                  1.4.0
attrs                         22.1.0
Automat                       20.2.0
autopep8                      1.6.0
Babel                         2.11.0
backcall                      0.2.0
backports.functools-lru-cache 1.6.4
backports.tempfile            1.0
backports.weakref             1.0.post1
bcrypt                        3.2.0
beautifulsoup4                4.11.1
binaryornot                   0.4.4
bitarray                      2.5.1
bkcharts                      0.2
black                         22.6.0
bleach                        4.1.0
bokeh                         2.4.3
boto3                         1.24.28
botocore                      1.27.59
Bottleneck                    1.3.5
brotlipy                      0.7.0
cachetools                    4.2.2
certifi                       2022.6.15
cffi                          1.15.1
chardet                       4.0.0
charset-normalizer            2.0.4
click                         8.0.4
cloudpickle                   2.0.0
clyent                        1.2.2
colorama                      0.4.6
colorcet                      3.0.1
comm                          0.1.2
conda                         23.1.0
conda-build                   3.23.3
conda-content-trust           0.1.3
conda-pack                    0.6.0
conda-package-handling        2.0.2
conda_package_streaming       0.7.0
conda-repo-cli                1.0.27
conda-token                   0.4.0
conda-verify                  3.4.2
constantly                    15.1.0
contourpy                     1.0.5
cookiecutter                  1.7.3
cryptography                  38.0.4
cssselect                     1.1.0
cycler                        0.11.0
Cython                        0.29.32
cytoolz                       0.12.0
daal4py                       2021.6.0
dask                          2022.2.1
datashader                    0.14.3
datashape                     0.5.4
debugpy                       1.5.1
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.4
distributed                   2022.2.1
docutils                      0.18.1
entrypoints                   0.4
et-xmlfile                    1.1.0
executing                     0.8.3
fastjsonschema                2.16.2
filelock                      3.9.0
flake8                        4.0.1
Flask                         1.1.2
flit_core                     3.6.0
fonttools                     4.25.0
frozenlist                    1.3.3
fsspec                        2022.11.0
future                        0.18.2
gensim                        4.1.2
glob2                         0.7
gmpy2                         2.1.2
google-api-core               2.10.1
google-auth                   2.6.0
google-cloud-core             2.3.2
google-cloud-storage          2.6.0
google-crc32c                 1.5.0
google-resumable-media        2.4.0
googleapis-common-protos      1.56.4
greenlet                      2.0.1
grpcio                        1.42.0
h5py                          3.7.0
HeapDict                      1.0.1
holoviews                     1.15.3
hvplot                        0.8.2
hyperlink                     21.0.0
idna                          3.4
imagecodecs                   2021.8.26
imageio                       2.19.3
imagesize                     1.4.1
importlib-metadata            4.11.3
incremental                   21.3.0
inflection                    0.5.1
iniconfig                     1.1.1
intake                        0.6.6
intervaltree                  3.1.0
ipykernel                     6.19.2
ipython                       7.31.1
ipython-genutils              0.2.0
ipywidgets                    7.6.5
isort                         5.9.3
itemadapter                   0.3.0
itemloaders                   1.0.4
itsdangerous                  2.0.1
jdcal                         1.4.1
jedi                          0.18.1
jellyfish                     0.9.0
Jinja2                        2.11.3
jinja2-time                   0.2.0
jmespath                      0.10.0
joblib                        1.1.1
json5                         0.9.6
jsonschema                    4.16.0
jupyter                       1.0.0
jupyter_client                7.4.8
jupyter-console               6.4.4
jupyter_core                  5.1.1
jupyter-server                1.23.4
jupyterlab                    3.5.2
jupyterlab-pygments           0.1.2
jupyterlab-server             2.10.3
jupyterlab-widgets            1.0.0
keyring                       23.4.0
kiwisolver                    1.4.4
lazy-object-proxy             1.6.0
libarchive-c                  2.9
llvmlite                      0.39.1
locket                        1.0.0
lxml                          4.9.1
Markdown                      3.4.1
MarkupSafe                    2.0.1
matplotlib                    3.6.2
matplotlib-inline             0.1.6
mccabe                        0.7.0
mistune                       0.8.4
mkl-fft                       1.3.1
mkl-random                    1.2.2
mkl-service                   2.4.0
mock                          4.0.3
mpmath                        1.2.1
msgpack                       1.0.3
multidict                     6.0.2
multipledispatch              0.6.0
munkres                       1.1.4
mypy-extensions               0.4.3
navigator-updater             0.3.0
nbclassic                     0.4.8
nbclient                      0.5.13
nbconvert                     6.4.4
nbformat                      5.7.0
nest-asyncio                  1.5.6
networkx                      2.8.4
nltk                          3.7
nose                          1.3.7
notebook                      6.5.2
notebook_shim                 0.2.2
numba                         0.56.4
numexpr                       2.8.4
numpy                         1.21.5
numpydoc                      1.5.0
olefile                       0.46
openpyxl                      3.0.10
packaging                     22.0
pandas                        1.4.4
pandocfilters                 1.5.0
panel                         0.14.1
param                         1.12.3
parsel                        1.6.0
parso                         0.8.3
partd                         1.2.0
pathlib                       1.0.1
pathspec                      0.9.0
patsy                         0.5.2
pep8                          1.7.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.3.0
pip                           22.3.1
pkginfo                       1.8.3
platformdirs                  2.5.2
plotly                        5.9.0
pluggy                        1.0.0
ply                           3.11
poyo                          0.5.0
prometheus-client             0.14.1
prompt-toolkit                3.0.36
Protego                       0.1.16
protobuf                      3.20.1
psutil                        5.9.0
ptyprocess                    0.7.0
pure-eval                     0.2.2
py                            1.11.0
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pycodestyle                   2.8.0
pycosat                       0.6.4
pycparser                     2.21
pyct                          0.4.8
pycurl                        7.45.1
PyDispatcher                  2.0.5
pydocstyle                    6.1.1
pyerfa                        2.0.0
pyflakes                      2.4.0
Pygments                      2.11.2
PyHamcrest                    2.0.2
PyJWT                         2.4.0
pylint                        2.14.5
pyls-spyder                   0.4.0
pyobjc-core                   8.5
pyobjc-framework-Cocoa        8.5
pyobjc-framework-CoreServices 8.5
pyobjc-framework-FSEvents     8.5
pyodbc                        4.0.34
pyOpenSSL                     22.0.0
pyparsing                     3.0.9
PyQt5-sip                     12.11.0
pyrsistent                    0.18.0
PySocks                       1.7.1
pytest                        7.1.2
python-dateutil               2.8.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.5.0
python-slugify                5.0.2
python-snappy                 0.6.1
pytz                          2022.7
pyviz-comms                   2.0.2
PyWavelets                    1.4.1
PyYAML                        6.0
pyzmq                         23.2.0
QDarkStyle                    3.0.2
qstylizer                     0.1.10
QtAwesome                     1.0.3
qtconsole                     5.3.2
QtPy                          2.2.0
queuelib                      1.5.0
regex                         2022.7.9
requests                      2.28.1
requests-file                 1.5.1
rope                          0.22.0
rsa                           4.7.2
Rtree                         0.9.7
ruamel.yaml                   0.17.21
ruamel.yaml.clib              0.2.6
ruamel-yaml-conda             0.17.21
s3transfer                    0.6.0
scikit-image                  0.19.3
scikit-learn                  1.0.2
scikit-learn-intelex          2021.20221004.121333
scipy                         1.7.3
Scrapy                        2.6.2
seaborn                       0.12.2
Send2Trash                    1.8.0
service-identity              18.1.0
setuptools                    65.6.3
sip                           6.6.2
six                           1.16.0
smart-open                    5.2.1
sniffio                       1.2.0
snowballstemmer               2.2.0
sortedcollections             2.1.0
sortedcontainers              2.4.0
soupsieve                     2.3.2.post1
Sphinx                        5.0.2
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.3.3
spyder-kernels                2.3.3
SQLAlchemy                    1.4.39
stack-data                    0.2.0
statsmodels                   0.13.2
sympy                         1.11.1
tables                        3.6.1
tabulate                      0.8.10
TBB                           0.2
tblib                         1.7.0
tenacity                      8.0.1
terminado                     0.17.1
testpath                      0.6.0
text-unidecode                1.3
textdistance                  4.2.1
threadpoolctl                 2.2.0
three-merge                   0.1.1
tifffile                      2021.7.2
tinycss                       0.4
tldextract                    3.2.0
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.1
toolz                         0.12.0
tornado                       6.2
tqdm                          4.64.1
traitlets                     5.7.1
Twisted                       22.2.0
typed-ast                     1.4.3
typing_extensions             4.4.0
ujson                         5.4.0
Unidecode                     1.2.0
urllib3                       1.26.13
w3lib                         1.21.0
watchdog                      2.1.6
wcwidth                       0.2.5
webencodings                  0.5.1
websocket-client              0.58.0
Werkzeug                      2.0.3
whatthepatch                  1.0.2
wheel                         0.37.1
widgetsnbextension            3.5.2
wrapt                         1.14.1
wurlitzer                     3.0.2
xarray                        2022.11.0
xlrd                          2.0.1
XlsxWriter                    3.0.3
xlwings                       0.27.15
yapf                          0.31.0
yarl                          1.8.1
zict                          2.1.0
zipp                          3.11.0
zope.interface                5.4.0
zstandard                     0.18.0

As you have not stated what those steps are, or provided any resources pointing to them, its hard to tell whats gone wrong.

Clearly, as shown by the output or pip list, the packages are not listed. Have you checked the output of echo $PYTHONPATH or

import sys
print(sys.path)

Is your conda env listed here? If not you need to switch to the correct kernel in the notebook.

I ran

import sys
print(sys.path)

in jupyter under my fenics project environment and got this

['/Users/elizabethhawkins', '/Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject/lib/python39.zip', '/Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject/lib/python3.9', '/Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject/lib/python3.9/lib-dynload', '', '/Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject/lib/python3.9/site-packages']

also the steps I used to add fenics to jupyter is

conda activate fenicsproject
conda install -c anaconda ipykernel
python -m ipykernel install --user --name=fenicsproject

What does conda list -n fenicsproject show?

This at least seems to be sensible, as it points to your env.

it shows

# packages in environment at /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject:
#
# Name                    Version                   Build  Channel
appnope                   0.1.2           py39hecd8cb5_1001    anaconda
asttokens                 2.0.5              pyhd3eb1b0_0    anaconda
backcall                  0.2.0              pyhd3eb1b0_0    anaconda
ca-certificates           2022.4.26            hecd8cb5_0    anaconda
certifi                   2022.6.15        py39hecd8cb5_0    anaconda
debugpy                   1.5.1            py39he9d5cce_0    anaconda
decorator                 5.1.1              pyhd3eb1b0_0    anaconda
entrypoints               0.4              py39hecd8cb5_0    anaconda
executing                 0.8.3              pyhd3eb1b0_0    anaconda
ipykernel                 6.9.1            py39hecd8cb5_0    anaconda
ipython                   8.3.0            py39hecd8cb5_0    anaconda
jedi                      0.18.1           py39hecd8cb5_1    anaconda
jupyter_client            7.2.2            py39hecd8cb5_0    anaconda
jupyter_core              4.10.0           py39hecd8cb5_0    anaconda
libcxx                    14.0.6               h9765a3e_0  
libffi                    3.4.2                hecd8cb5_6  
libsodium                 1.0.18               h1de35cc_0    anaconda
matplotlib-inline         0.1.2              pyhd3eb1b0_2    anaconda
ncurses                   6.4                  hcec6c5f_0  
nest-asyncio              1.5.5            py39hecd8cb5_0    anaconda
openssl                   1.1.1s               hca72f7f_0  
parso                     0.8.3              pyhd3eb1b0_0    anaconda
pexpect                   4.8.0              pyhd3eb1b0_3    anaconda
pickleshare               0.7.5           pyhd3eb1b0_1003    anaconda
pip                       22.3.1           py39hecd8cb5_0  
prompt-toolkit            3.0.20             pyhd3eb1b0_0    anaconda
ptyprocess                0.7.0              pyhd3eb1b0_2    anaconda
pure_eval                 0.2.2              pyhd3eb1b0_0    anaconda
pygments                  2.11.2             pyhd3eb1b0_0    anaconda
python                    3.9.16               h218abb5_0  
python-dateutil           2.8.2              pyhd3eb1b0_0    anaconda
pyzmq                     22.3.0           py39he9d5cce_2    anaconda
readline                  8.2                  hca72f7f_0  
setuptools                65.6.3           py39hecd8cb5_0  
six                       1.16.0             pyhd3eb1b0_1    anaconda
sqlite                    3.40.1               h880c91c_0  
stack_data                0.2.0              pyhd3eb1b0_0    anaconda
tk                        8.6.12               h5d9f67b_0  
tornado                   6.1              py39h9ed2024_0    anaconda
traitlets                 5.1.1              pyhd3eb1b0_0    anaconda
tzdata                    2022g                h04d1e81_0  
wcwidth                   0.2.5              pyhd3eb1b0_0    anaconda
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.10               h6c40b1e_1  
zeromq                    4.3.4                h23ab428_0    anaconda
zlib                      1.2.13               h4dc903c_0  

As you can see, fenics is not installed in this environment. What is the output of

conda install -c anaconda fenics-dolfin

as shown on conda forge: Fenics Dolfin :: Anaconda.org

(base) elizabethhawkins@Elizabeths-Air ~ % conda install -c anaconda fenics-dolfin
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - fenics-dolfin

Current channels:

  - https://conda.anaconda.org/anaconda/osx-64
  - https://conda.anaconda.org/anaconda/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Sorry, i meant

conda install -c conda-forge fenics-dolfin

I ran this under the fenicsproject environment by mistake. Will that change anything?

(fenicsproject) elizabethhawkins@Elizabeths-Air ~ % conda install -c conda-forge fenics-dolfin
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject

  added / updated specs:
    - fenics-dolfin


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    boost-cpp-1.74.0           |       hf3dc895_5        15.6 MB  conda-forge
    certifi-2022.12.7          |     pyhd8ed1ab_0         147 KB  conda-forge
    cmake-3.21.3               |       hdbd2f3e_0        14.2 MB  conda-forge
    eigen-3.3.9                |       h926bf3e_1         970 KB  conda-forge
    fenics-dijitso-2019.1.0    |  py39h6e9494a_35          66 KB  conda-forge
    fenics-dolfin-2019.1.0     |  py39h087ae1b_21         1.2 MB  conda-forge
    fenics-ffc-2019.1.0        |  py39h6e9494a_35         451 KB  conda-forge
    fenics-fiat-2019.1.0       |  py39h6e9494a_35         146 KB  conda-forge
    fenics-libdolfin-2019.1.0  |      ha6bb12c_21         2.3 MB  conda-forge
    fenics-ufl-2019.1.0        |  py39h6e9494a_35         349 KB  conda-forge
    gmpy2-2.1.2                |   py39h2da61ea_1         166 KB  conda-forge
    hdf5-1.10.6                |mpi_mpich_h8c5dddf_1013         3.3 MB  conda-forge
    hypre-2.18.2               |       hc9ba2bc_1         1.6 MB  conda-forge
    icu-69.1                   |       he49afe7_0        12.9 MB  conda-forge
    krb5-1.19.3                |       hb49756b_0         1.2 MB  conda-forge
    libcurl-7.79.1             |       hf45b732_1         317 KB  conda-forge
    libnghttp2-1.43.0          |       h6f36284_1         867 KB  conda-forge
    libssh2-1.10.0             |       h52ee1ee_2         221 KB  conda-forge
    lz4-c-1.9.3                |       he49afe7_1         155 KB  conda-forge
    mpi4py-3.1.4               |   py39h98ffc4c_0         521 KB  conda-forge
    mumps-include-5.2.1        |      h694c41f_10          23 KB  conda-forge
    mumps-mpi-5.2.1            |      hdbd7e29_10         3.3 MB  conda-forge
    numpy-1.24.2               |   py39h6ee2318_0         5.9 MB  conda-forge
    openssl-1.1.1s             |       hfd90126_1         1.6 MB  conda-forge
    petsc-3.14.5               |       hbc334a2_0         9.5 MB  conda-forge
    petsc4py-3.14.1            |   py39haa87a53_1         1.1 MB  conda-forge
    ptscotch-6.0.9             |       h5077668_1         1.5 MB  conda-forge
    pybind11-2.6.2             |   py39hf018cea_0         148 KB  conda-forge
    pybind11-global-2.6.2      |   py39hf018cea_0         180 KB  conda-forge
    python_abi-3.9             |           2_cp39           4 KB  conda-forge
    scalapack-2.0.2            |    h3774d7d_1009         2.1 MB  conda-forge
    scotch-6.0.9               |       h9f43b6f_1         1.3 MB  conda-forge
    slepc-3.14.2               |       h939d6db_0         3.8 MB  conda-forge
    slepc4py-3.14.0            |   py39hcfc6728_1         250 KB  conda-forge
    suitesparse-5.6.0          |       h0e59142_0         2.6 MB  conda-forge
    sympy-1.11.1               |   py39h6e9494a_2        11.8 MB  conda-forge
    tbb-2020.2                 |       h940c156_4         132 KB  conda-forge
    zstd-1.5.0                 |       h582d3a0_0         583 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       102.2 MB

The following NEW packages will be INSTALLED:

  boost-cpp          conda-forge/osx-64::boost-cpp-1.74.0-hf3dc895_5 
  bzip2              conda-forge/osx-64::bzip2-1.0.8-h0d85af4_4 
  c-ares             conda-forge/osx-64::c-ares-1.18.1-h0d85af4_0 
  cmake              conda-forge/osx-64::cmake-3.21.3-hdbd2f3e_0 
  eigen              conda-forge/osx-64::eigen-3.3.9-h926bf3e_1 
  expat              conda-forge/osx-64::expat-2.5.0-hf0c8a7f_0 
  fenics-dijitso     conda-forge/osx-64::fenics-dijitso-2019.1.0-py39h6e9494a_35 
  fenics-dolfin      conda-forge/osx-64::fenics-dolfin-2019.1.0-py39h087ae1b_21 
  fenics-ffc         conda-forge/osx-64::fenics-ffc-2019.1.0-py39h6e9494a_35 
  fenics-fiat        conda-forge/osx-64::fenics-fiat-2019.1.0-py39h6e9494a_35 
  fenics-libdolfin   conda-forge/osx-64::fenics-libdolfin-2019.1.0-ha6bb12c_21 
  fenics-ufl         conda-forge/osx-64::fenics-ufl-2019.1.0-py39h6e9494a_35 
  gmp                conda-forge/osx-64::gmp-6.2.1-h2e338ed_0 
  gmpy2              conda-forge/osx-64::gmpy2-2.1.2-py39h2da61ea_1 
  hdf5               conda-forge/osx-64::hdf5-1.10.6-mpi_mpich_h8c5dddf_1013 
  hypre              conda-forge/osx-64::hypre-2.18.2-hc9ba2bc_1 
  icu                conda-forge/osx-64::icu-69.1-he49afe7_0 
  krb5               conda-forge/osx-64::krb5-1.19.3-hb49756b_0 
  libblas            conda-forge/osx-64::libblas-3.9.0-16_osx64_openblas 
  libcblas           conda-forge/osx-64::libcblas-3.9.0-16_osx64_openblas 
  libcurl            conda-forge/osx-64::libcurl-7.79.1-hf45b732_1 
  libedit            conda-forge/osx-64::libedit-3.1.20191231-h0678c8f_2 
  libev              conda-forge/osx-64::libev-4.33-haf1e3a3_1 
  libgfortran        conda-forge/osx-64::libgfortran-5.0.0-11_3_0_h97931a8_27 
  libgfortran5       conda-forge/osx-64::libgfortran5-11.3.0-h082f757_27 
  libiconv           conda-forge/osx-64::libiconv-1.17-hac89ed1_0 
  liblapack          conda-forge/osx-64::liblapack-3.9.0-16_osx64_openblas 
  libnghttp2         conda-forge/osx-64::libnghttp2-1.43.0-h6f36284_1 
  libopenblas        conda-forge/osx-64::libopenblas-0.3.21-openmp_h429af6e_3 
  libssh2            conda-forge/osx-64::libssh2-1.10.0-h52ee1ee_2 
  libuv              conda-forge/osx-64::libuv-1.44.2-hac89ed1_0 
  llvm-openmp        conda-forge/osx-64::llvm-openmp-15.0.7-h61d9ccf_0 
  lz4-c              conda-forge/osx-64::lz4-c-1.9.3-he49afe7_1 
  metis              conda-forge/osx-64::metis-5.1.0-h2e338ed_1006 
  mpc                conda-forge/osx-64::mpc-1.3.1-h81bd1dd_0 
  mpfr               conda-forge/osx-64::mpfr-4.1.0-h0f52abe_1 
  mpi                conda-forge/osx-64::mpi-1.0-mpich 
  mpi4py             conda-forge/osx-64::mpi4py-3.1.4-py39h98ffc4c_0 
  mpich              conda-forge/osx-64::mpich-4.0.3-hd33e60e_100 
  mpmath             conda-forge/noarch::mpmath-1.2.1-pyhd8ed1ab_0 
  mumps-include      conda-forge/osx-64::mumps-include-5.2.1-h694c41f_10 
  mumps-mpi          conda-forge/osx-64::mumps-mpi-5.2.1-hdbd7e29_10 
  numpy              conda-forge/osx-64::numpy-1.24.2-py39h6ee2318_0 
  parmetis           conda-forge/osx-64::parmetis-4.0.3-hb7fa8f8_1005 
  petsc              conda-forge/osx-64::petsc-3.14.5-hbc334a2_0 
  petsc4py           conda-forge/osx-64::petsc4py-3.14.1-py39haa87a53_1 
  pkg-config         conda-forge/osx-64::pkg-config-0.29.2-ha3d46e9_1008 
  pkgconfig          conda-forge/noarch::pkgconfig-1.5.5-pyhd8ed1ab_4 
  ptscotch           conda-forge/osx-64::ptscotch-6.0.9-h5077668_1 
  pybind11           conda-forge/osx-64::pybind11-2.6.2-py39hf018cea_0 
  pybind11-global    conda-forge/osx-64::pybind11-global-2.6.2-py39hf018cea_0 
  python_abi         conda-forge/osx-64::python_abi-3.9-2_cp39 
  rhash              conda-forge/osx-64::rhash-1.4.3-hac89ed1_0 
  scalapack          conda-forge/osx-64::scalapack-2.0.2-h3774d7d_1009 
  scotch             conda-forge/osx-64::scotch-6.0.9-h9f43b6f_1 
  slepc              conda-forge/osx-64::slepc-3.14.2-h939d6db_0 
  slepc4py           conda-forge/osx-64::slepc4py-3.14.0-py39hcfc6728_1 
  suitesparse        conda-forge/osx-64::suitesparse-5.6.0-h0e59142_0 
  superlu            conda-forge/osx-64::superlu-5.2.2-h1f0f902_0 
  superlu_dist       conda-forge/osx-64::superlu_dist-7.2.0-h4bb6bf2_0 
  sympy              conda-forge/osx-64::sympy-1.11.1-py39h6e9494a_2 
  tbb                conda-forge/osx-64::tbb-2020.2-h940c156_4 
  zstd               conda-forge/osx-64::zstd-1.5.0-h582d3a0_0 

The following packages will be UPDATED:

  ca-certificates    anaconda::ca-certificates-2022.4.26-h~ --> conda-forge::ca-certificates-2022.12.7-h033912b_0 
  certifi            anaconda/osx-64::certifi-2022.6.15-py~ --> conda-forge/noarch::certifi-2022.12.7-pyhd8ed1ab_0 
  openssl              pkgs/main::openssl-1.1.1s-hca72f7f_0 --> conda-forge::openssl-1.1.1s-hfd90126_1 


Proceed ([y]/n)? y


Downloading and Extracting Packages
                                                                                
Preparing transaction: done                                                     
Verifying transaction: done                                                     
Executing transaction: done  

Yes, that is installing dolfin in your environment.

As seen here, you are now installing the correct package. I.e.

Should have been
conda create -n fenicsproject -c conda-forge fenics-dolfin

so I reinstalled fenics using

conda create -n fenicsproject -c conda-forge fenics-dolfin

which replaced other. This returned

(base) elizabethhawkins@Elizabeths-Air ~ % conda create -n fenicsproject -c conda-forge fenics-dolfin
WARNING: A conda environment already exists at '/Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject'
Remove existing environment (y/[n])? y

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject

  added / updated specs:
    - fenics-dolfin


The following NEW packages will be INSTALLED:

  boost-cpp          conda-forge/osx-64::boost-cpp-1.78.0-h8b082ac_1 
  bzip2              conda-forge/osx-64::bzip2-1.0.8-h0d85af4_4 
  c-ares             conda-forge/osx-64::c-ares-1.18.1-h0d85af4_0 
  ca-certificates    conda-forge/osx-64::ca-certificates-2022.12.7-h033912b_0 
  cmake              conda-forge/osx-64::cmake-3.25.2-h4032537_0 
  eigen              conda-forge/osx-64::eigen-3.4.0-h940c156_0 
  expat              conda-forge/osx-64::expat-2.5.0-hf0c8a7f_0 
  fenics-dijitso     conda-forge/osx-64::fenics-dijitso-2019.1.0-py311h6eed73b_35 
  fenics-dolfin      conda-forge/osx-64::fenics-dolfin-2019.1.0-py311h46d4075_35 
  fenics-ffc         conda-forge/osx-64::fenics-ffc-2019.1.0-py311h6eed73b_35 
  fenics-fiat        conda-forge/osx-64::fenics-fiat-2019.1.0-py311h6eed73b_35 
  fenics-libdolfin   conda-forge/osx-64::fenics-libdolfin-2019.1.0-h2bb9e8c_35 
  fenics-ufl         conda-forge/osx-64::fenics-ufl-2019.1.0-py311h6eed73b_35 
  fftw               conda-forge/osx-64::fftw-3.3.10-mpi_openmpi_h7f3849b_6 
  gmp                conda-forge/osx-64::gmp-6.2.1-h2e338ed_0 
  gmpy2              conda-forge/osx-64::gmpy2-2.1.2-py311hc5b4402_1 
  hdf5               conda-forge/osx-64::hdf5-1.12.2-mpi_openmpi_hf8ec552_1 
  hypre              conda-forge/osx-64::hypre-2.25.0-mpi_openmpi_ha398ffd_0 
  icu                conda-forge/osx-64::icu-70.1-h96cf925_0 
  krb5               conda-forge/osx-64::krb5-1.20.1-h049b76e_0 
  libaec             conda-forge/osx-64::libaec-1.0.6-hf0c8a7f_1 
  libblas            conda-forge/osx-64::libblas-3.9.0-16_osx64_openblas 
  libcblas           conda-forge/osx-64::libcblas-3.9.0-16_osx64_openblas 
  libcurl            conda-forge/osx-64::libcurl-7.87.0-h6df9250_0 
  libcxx             conda-forge/osx-64::libcxx-14.0.6-hccf4f1f_0 
  libedit            conda-forge/osx-64::libedit-3.1.20191231-h0678c8f_2 
  libev              conda-forge/osx-64::libev-4.33-haf1e3a3_1 
  libffi             conda-forge/osx-64::libffi-3.4.2-h0d85af4_5 
  libgfortran        conda-forge/osx-64::libgfortran-5.0.0-11_3_0_h97931a8_27 
  libgfortran5       conda-forge/osx-64::libgfortran5-11.3.0-h082f757_27 
  libiconv           conda-forge/osx-64::libiconv-1.17-hac89ed1_0 
  liblapack          conda-forge/osx-64::liblapack-3.9.0-16_osx64_openblas 
  libnghttp2         conda-forge/osx-64::libnghttp2-1.51.0-he2ab024_0 
  libopenblas        conda-forge/osx-64::libopenblas-0.3.21-openmp_h429af6e_3 
  libsqlite          conda-forge/osx-64::libsqlite-3.40.0-ha978bb4_0 
  libssh2            conda-forge/osx-64::libssh2-1.10.0-h47af595_3 
  libuv              conda-forge/osx-64::libuv-1.44.2-hac89ed1_0 
  libzlib            conda-forge/osx-64::libzlib-1.2.13-hfd90126_4 
  llvm-openmp        conda-forge/osx-64::llvm-openmp-15.0.7-h61d9ccf_0 
  metis              conda-forge/osx-64::metis-5.1.0-h2e338ed_1006 
  mpc                conda-forge/osx-64::mpc-1.3.1-h81bd1dd_0 
  mpfr               conda-forge/osx-64::mpfr-4.1.0-h0f52abe_1 
  mpi                conda-forge/osx-64::mpi-1.0-openmpi 
  mpi4py             conda-forge/osx-64::mpi4py-3.1.4-py311h0cff672_0 
  mpmath             conda-forge/noarch::mpmath-1.2.1-pyhd8ed1ab_0 
  mumps-include      conda-forge/osx-64::mumps-include-5.2.1-h694c41f_11 
  mumps-mpi          conda-forge/osx-64::mumps-mpi-5.2.1-had0ebf5_11 
  ncurses            conda-forge/osx-64::ncurses-6.3-h96cf925_1 
  numpy              conda-forge/osx-64::numpy-1.24.2-py311ha9d2c9f_0 
  openmpi            conda-forge/osx-64::openmpi-4.1.4-h4fe9131_102 
  openssl            conda-forge/osx-64::openssl-3.0.8-hfd90126_0 
  parmetis           conda-forge/osx-64::parmetis-4.0.3-h7eda126_1005 
  petsc              conda-forge/osx-64::petsc-3.17.4-real_h7f1bf32_101 
  petsc4py           conda-forge/osx-64::petsc4py-3.17.4-real_h17f71e9_101 
  pip                conda-forge/noarch::pip-23.0-pyhd8ed1ab_0 
  pkg-config         conda-forge/osx-64::pkg-config-0.29.2-ha3d46e9_1008 
  pkgconfig          conda-forge/noarch::pkgconfig-1.5.5-pyhd8ed1ab_4 
  ptscotch           conda-forge/osx-64::ptscotch-6.0.9-h6295d7f_2 
  pybind11           conda-forge/osx-64::pybind11-2.10.3-py311hd2070f0_0 
  pybind11-global    conda-forge/osx-64::pybind11-global-2.10.3-py311hd2070f0_0 
  python             conda-forge/osx-64::python-3.11.0-he7542f4_1_cpython 
  python_abi         conda-forge/osx-64::python_abi-3.11-3_cp311 
  readline           conda-forge/osx-64::readline-8.1.2-h3899abd_0 
  rhash              conda-forge/osx-64::rhash-1.4.3-hac89ed1_0 
  scalapack          conda-forge/osx-64::scalapack-2.2.0-h208a4c8_1 
  scotch             conda-forge/osx-64::scotch-6.0.9-h3da7401_2 
  setuptools         conda-forge/noarch::setuptools-67.1.0-pyhd8ed1ab_0 
  six                conda-forge/noarch::six-1.16.0-pyh6c4a22f_0 
  slepc              conda-forge/osx-64::slepc-3.17.2-real_h6fa9d90_100 
  slepc4py           conda-forge/osx-64::slepc4py-3.17.2-real_hb0b1125_101 
  suitesparse        conda-forge/osx-64::suitesparse-5.10.1-h7aff33d_1 
  superlu            conda-forge/osx-64::superlu-5.2.2-h1f0f902_0 
  superlu_dist       conda-forge/osx-64::superlu_dist-7.2.0-hcde7739_0 
  sympy              conda-forge/osx-64::sympy-1.11.1-py311h6eed73b_2 
  tbb                conda-forge/osx-64::tbb-2021.7.0-hb8565cd_1 
  tk                 conda-forge/osx-64::tk-8.6.12-h5dbffcc_0 
  tzdata             conda-forge/noarch::tzdata-2022g-h191b570_0 
  wheel              conda-forge/noarch::wheel-0.38.4-pyhd8ed1ab_0 
  xz                 conda-forge/osx-64::xz-5.2.6-h775f41a_0 
  yaml               conda-forge/osx-64::yaml-0.2.5-h0d85af4_2 
  zlib               conda-forge/osx-64::zlib-1.2.13-hfd90126_4 
  zstd               conda-forge/osx-64::zstd-1.5.2-hbc0c0cd_6 


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate fenicsproject
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Then I installed python version 3.9 onto the fenics environment

(fenicsproject) elizabethhawkins@Elizabeths-Air ~ % conda uninstall python  
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject

  removed specs:
    - python


The following packages will be REMOVED:

  boost-cpp-1.78.0-h8b082ac_1
  bzip2-1.0.8-h0d85af4_4
  c-ares-1.18.1-h0d85af4_0
  cmake-3.25.2-h4032537_0
  eigen-3.4.0-h940c156_0
  expat-2.5.0-hf0c8a7f_0
  fenics-dijitso-2019.1.0-py311h6eed73b_35
  fenics-dolfin-2019.1.0-py311h46d4075_35
  fenics-ffc-2019.1.0-py311h6eed73b_35
  fenics-fiat-2019.1.0-py311h6eed73b_35
  fenics-libdolfin-2019.1.0-h2bb9e8c_35
  fenics-ufl-2019.1.0-py311h6eed73b_35
  fftw-3.3.10-mpi_openmpi_h7f3849b_6
  gmp-6.2.1-h2e338ed_0
  gmpy2-2.1.2-py311hc5b4402_1
  hdf5-1.12.2-mpi_openmpi_hf8ec552_1
  hypre-2.25.0-mpi_openmpi_ha398ffd_0
  icu-70.1-h96cf925_0
  krb5-1.20.1-h049b76e_0
  libaec-1.0.6-hf0c8a7f_1
  libblas-3.9.0-16_osx64_openblas
  libcblas-3.9.0-16_osx64_openblas
  libcurl-7.87.0-h6df9250_0
  libcxx-14.0.6-hccf4f1f_0
  libedit-3.1.20191231-h0678c8f_2
  libev-4.33-haf1e3a3_1
  libffi-3.4.2-h0d85af4_5
  libgfortran-5.0.0-11_3_0_h97931a8_27
  libgfortran5-11.3.0-h082f757_27
  libiconv-1.17-hac89ed1_0
  liblapack-3.9.0-16_osx64_openblas
  libnghttp2-1.51.0-he2ab024_0
  libopenblas-0.3.21-openmp_h429af6e_3
  libsqlite-3.40.0-ha978bb4_0
  libssh2-1.10.0-h47af595_3
  libuv-1.44.2-hac89ed1_0
  libzlib-1.2.13-hfd90126_4
  llvm-openmp-15.0.7-h61d9ccf_0
  metis-5.1.0-h2e338ed_1006
  mpc-1.3.1-h81bd1dd_0
  mpfr-4.1.0-h0f52abe_1
  mpi-1.0-openmpi
  mpi4py-3.1.4-py311h0cff672_0
  mpmath-1.2.1-pyhd8ed1ab_0
  mumps-include-5.2.1-h694c41f_11
  mumps-mpi-5.2.1-had0ebf5_11
  ncurses-6.3-h96cf925_1
  numpy-1.24.2-py311ha9d2c9f_0
  openmpi-4.1.4-h4fe9131_102
  parmetis-4.0.3-h7eda126_1005
  petsc-3.17.4-real_h7f1bf32_101
  petsc4py-3.17.4-real_h17f71e9_101
  pip-23.0-pyhd8ed1ab_0
  pkg-config-0.29.2-ha3d46e9_1008
  pkgconfig-1.5.5-pyhd8ed1ab_4
  ptscotch-6.0.9-h6295d7f_2
  pybind11-2.10.3-py311hd2070f0_0
  pybind11-global-2.10.3-py311hd2070f0_0
  python-3.11.0-he7542f4_1_cpython
  python_abi-3.11-3_cp311
  readline-8.1.2-h3899abd_0
  rhash-1.4.3-hac89ed1_0
  scalapack-2.2.0-h208a4c8_1
  scotch-6.0.9-h3da7401_2
  setuptools-67.1.0-pyhd8ed1ab_0
  six-1.16.0-pyh6c4a22f_0
  slepc-3.17.2-real_h6fa9d90_100
  slepc4py-3.17.2-real_hb0b1125_101
  suitesparse-5.10.1-h7aff33d_1
  superlu-5.2.2-h1f0f902_0
  superlu_dist-7.2.0-hcde7739_0
  sympy-1.11.1-py311h6eed73b_2
  tbb-2021.7.0-hb8565cd_1
  tk-8.6.12-h5dbffcc_0
  tzdata-2022g-h191b570_0
  wheel-0.38.4-pyhd8ed1ab_0
  xz-5.2.6-h775f41a_0
  yaml-0.2.5-h0d85af4_2
  zlib-1.2.13-hfd90126_4
  zstd-1.5.2-hbc0c0cd_6

The following packages will be UPDATED:

  ca-certificates    conda-forge::ca-certificates-2022.12.~ --> pkgs/main::ca-certificates-2023.01.10-hecd8cb5_0 

The following packages will be SUPERSEDED by a higher-priority channel:

  openssl             conda-forge::openssl-3.0.8-hfd90126_0 --> pkgs/main::openssl-1.1.1s-hca72f7f_0 


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(fenicsproject) elizabethhawkins@Elizabeths-Air ~ % conda install python=3.9
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject

  added / updated specs:
    - python=3.9


The following NEW packages will be INSTALLED:

  certifi            pkgs/main/osx-64::certifi-2022.12.7-py39hecd8cb5_0 
  libcxx             pkgs/main/osx-64::libcxx-14.0.6-h9765a3e_0 
  libffi             pkgs/main/osx-64::libffi-3.4.2-hecd8cb5_6 
  ncurses            pkgs/main/osx-64::ncurses-6.4-hcec6c5f_0 
  pip                pkgs/main/osx-64::pip-22.3.1-py39hecd8cb5_0 
  python             pkgs/main/osx-64::python-3.9.16-h218abb5_0 
  readline           pkgs/main/osx-64::readline-8.2-hca72f7f_0 
  setuptools         pkgs/main/osx-64::setuptools-65.6.3-py39hecd8cb5_0 
  sqlite             pkgs/main/osx-64::sqlite-3.40.1-h880c91c_0 
  tk                 pkgs/main/osx-64::tk-8.6.12-h5d9f67b_0 
  tzdata             pkgs/main/noarch::tzdata-2022g-h04d1e81_0 
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 
  xz                 pkgs/main/osx-64::xz-5.2.10-h6c40b1e_1 
  zlib               pkgs/main/osx-64::zlib-1.2.13-h4dc903c_0 


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

installed ipykernel and included the environment in jupyter notebook

(fenicsproject) elizabethhawkins@Elizabeths-Air ~ % conda install -c anaconda ipykernel
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject

  added / updated specs:
    - ipykernel


The following NEW packages will be INSTALLED:

  appnope            anaconda/osx-64::appnope-0.1.2-py39hecd8cb5_1001 
  asttokens          anaconda/noarch::asttokens-2.0.5-pyhd3eb1b0_0 
  backcall           anaconda/noarch::backcall-0.2.0-pyhd3eb1b0_0 
  debugpy            anaconda/osx-64::debugpy-1.5.1-py39he9d5cce_0 
  decorator          anaconda/noarch::decorator-5.1.1-pyhd3eb1b0_0 
  entrypoints        anaconda/osx-64::entrypoints-0.4-py39hecd8cb5_0 
  executing          anaconda/noarch::executing-0.8.3-pyhd3eb1b0_0 
  ipykernel          anaconda/osx-64::ipykernel-6.9.1-py39hecd8cb5_0 
  ipython            anaconda/osx-64::ipython-8.3.0-py39hecd8cb5_0 
  jedi               anaconda/osx-64::jedi-0.18.1-py39hecd8cb5_1 
  jupyter_client     anaconda/osx-64::jupyter_client-7.2.2-py39hecd8cb5_0 
  jupyter_core       anaconda/osx-64::jupyter_core-4.10.0-py39hecd8cb5_0 
  libsodium          anaconda/osx-64::libsodium-1.0.18-h1de35cc_0 
  matplotlib-inline  anaconda/noarch::matplotlib-inline-0.1.2-pyhd3eb1b0_2 
  nest-asyncio       anaconda/osx-64::nest-asyncio-1.5.5-py39hecd8cb5_0 
  parso              anaconda/noarch::parso-0.8.3-pyhd3eb1b0_0 
  pexpect            anaconda/noarch::pexpect-4.8.0-pyhd3eb1b0_3 
  pickleshare        anaconda/noarch::pickleshare-0.7.5-pyhd3eb1b0_1003 
  prompt-toolkit     anaconda/noarch::prompt-toolkit-3.0.20-pyhd3eb1b0_0 
  ptyprocess         anaconda/noarch::ptyprocess-0.7.0-pyhd3eb1b0_2 
  pure_eval          anaconda/noarch::pure_eval-0.2.2-pyhd3eb1b0_0 
  pygments           anaconda/noarch::pygments-2.11.2-pyhd3eb1b0_0 
  python-dateutil    anaconda/noarch::python-dateutil-2.8.2-pyhd3eb1b0_0 
  pyzmq              anaconda/osx-64::pyzmq-22.3.0-py39he9d5cce_2 
  six                anaconda/noarch::six-1.16.0-pyhd3eb1b0_1 
  stack_data         anaconda/noarch::stack_data-0.2.0-pyhd3eb1b0_0 
  tornado            anaconda/osx-64::tornado-6.1-py39h9ed2024_0 
  traitlets          anaconda/noarch::traitlets-5.1.1-pyhd3eb1b0_0 
  wcwidth            anaconda/noarch::wcwidth-0.2.5-pyhd3eb1b0_0 
  zeromq             anaconda/osx-64::zeromq-4.3.4-h23ab428_0 

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates    pkgs/main::ca-certificates-2023.01.10~ --> anaconda::ca-certificates-2022.4.26-hecd8cb5_0 
  certifi            pkgs/main::certifi-2022.12.7-py39hecd~ --> anaconda::certifi-2022.6.15-py39hecd8cb5_0 


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(fenicsproject) elizabethhawkins@Elizabeths-Air ~ % python -m ipykernel install --user --name=fenics2
Installed kernelspec fenics2 in /Users/elizabethhawkins/Library/Jupyter/kernels/fenics2

Then I ran

from dolfin import*

and got the same error

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 from dolfin import*

ModuleNotFoundError: No module named 'dolfin'

here is my output for

conda list -n fenicsproject
# packages in environment at /Users/elizabethhawkins/opt/anaconda3/envs/fenicsproject:
#
# Name                    Version                   Build  Channel
appnope                   0.1.2           py39hecd8cb5_1001    anaconda
asttokens                 2.0.5              pyhd3eb1b0_0    anaconda
backcall                  0.2.0              pyhd3eb1b0_0    anaconda
ca-certificates           2022.4.26            hecd8cb5_0    anaconda
certifi                   2022.6.15        py39hecd8cb5_0    anaconda
debugpy                   1.5.1            py39he9d5cce_0    anaconda
decorator                 5.1.1              pyhd3eb1b0_0    anaconda
entrypoints               0.4              py39hecd8cb5_0    anaconda
executing                 0.8.3              pyhd3eb1b0_0    anaconda
ipykernel                 6.9.1            py39hecd8cb5_0    anaconda
ipython                   8.3.0            py39hecd8cb5_0    anaconda
jedi                      0.18.1           py39hecd8cb5_1    anaconda
jupyter_client            7.2.2            py39hecd8cb5_0    anaconda
jupyter_core              4.10.0           py39hecd8cb5_0    anaconda
libcxx                    14.0.6               h9765a3e_0  
libffi                    3.4.2                hecd8cb5_6  
libsodium                 1.0.18               h1de35cc_0    anaconda
matplotlib-inline         0.1.2              pyhd3eb1b0_2    anaconda
ncurses                   6.4                  hcec6c5f_0  
nest-asyncio              1.5.5            py39hecd8cb5_0    anaconda
openssl                   1.1.1s               hca72f7f_0  
parso                     0.8.3              pyhd3eb1b0_0    anaconda
pexpect                   4.8.0              pyhd3eb1b0_3    anaconda
pickleshare               0.7.5           pyhd3eb1b0_1003    anaconda
pip                       22.3.1           py39hecd8cb5_0  
prompt-toolkit            3.0.20             pyhd3eb1b0_0    anaconda
ptyprocess                0.7.0              pyhd3eb1b0_2    anaconda
pure_eval                 0.2.2              pyhd3eb1b0_0    anaconda
pygments                  2.11.2             pyhd3eb1b0_0    anaconda
python                    3.9.16               h218abb5_0  
python-dateutil           2.8.2              pyhd3eb1b0_0    anaconda
pyzmq                     22.3.0           py39he9d5cce_2    anaconda
readline                  8.2                  hca72f7f_0  
setuptools                65.6.3           py39hecd8cb5_0  
six                       1.16.0             pyhd3eb1b0_1    anaconda
sqlite                    3.40.1               h880c91c_0  
stack_data                0.2.0              pyhd3eb1b0_0    anaconda
tk                        8.6.12               h5d9f67b_0  
tornado                   6.1              py39h9ed2024_0    anaconda
traitlets                 5.1.1              pyhd3eb1b0_0    anaconda
tzdata                    2022g                h04d1e81_0  
wcwidth                   0.2.5              pyhd3eb1b0_0    anaconda
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.10               h6c40b1e_1  
zeromq                    4.3.4                h23ab428_0    anaconda
zlib                      1.2.13               h4dc903c_0  

Please read the output before posting. By changing the Python version, you remove the fenics installation. You need to install the Python version of choice prior to installing fenics.

I installed python version 3.9 in the base environment

(base) elizabethhawkins@Elizabeths-Air ~ % python --version
Python 3.9.15

Then downloaded fenics and activated the environment but the python version in this environment is still python 3.11

(fenicsproject) elizabethhawkins@Elizabeths-Air ~ % python --version
Python 3.11.0

How do I change it without doing

conda uninstall python
conda install python=3.9

in the fenics environment?

After you have called conda install python=3.9 call
conda install -c conda-forge fenics-dolfin