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
(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.
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'
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.