Using the fenics project with spyder

I have installed the fenics project using anaconda.

I followed the following commands and I believe that the installation was successful:

conda create -n fenicsproject -c conda-forge fenics

source activate fenicsproject

Now, I want to use fenics with my IDE spyder. Anaconda-navigator is complaining that I cannot install spyder in the fenicsproject environment.

Is there any way to resolve this issue?

Update: I ran conda install spyder in the fenicsproject environment and got this very long message from the terminal. I am not really sure how to go about fixing it.
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:


  • matplotlib-base → python[version=’>=2.7,<2.8.0a0|>=3.5,<3.6.0a0’]
  • olefile → python[version=’>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0’]
  • pyparsing → python[version=’>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0’]
  • python-dateutil → python[version=’>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0’]
  • wheel → python[version=’>=3.9,<3.10.0a0’]

Your python: python=3.8

If python is on the left-most side of the chain, that’s the version you’ve asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify

The following specifications were found to be incompatible with each other:

Output in format: Requested package → Available versions

Package libgfortran5 conflicts for:
petsc → libgfortran=5 → libgfortran5
slepc4py → mpich[version=’>=3.3.2,<4.0.0a0’] → libgfortran5[version=’>=9.3.0’]
hdf5 → libgfortran=5 → libgfortran5
superlu_dist → libgfortran=5 → libgfortran5
superlu → libgfortran5[version=’>=9.3.0’]
hdf5 → libgfortran5[version=’>=9.3.0’]
slepc → libgfortran5[version=’>=9.3.0’]
mpi4py → mpich[version=’>=3.4,<4.0.0a0’] → libgfortran5[version=’>=9.3.0’]
libopenblas → libgfortran=5 → libgfortran5
suitesparse → libopenblas[version=’>=0.3.3,<1.0a0’] → libgfortran5[version=’>=9.3.0’]
ptscotch → mpich[version=’>=3.3.2,<4.0.0a0’] → libgfortran5[version=’>=9.3.0’]
parmetis → mpich[version=’>=3.3,<4.0.0a0’] → libgfortran5[version=’>=9.3.0’]
mumps-mpi → libgfortran5[version=’>=9.3.0’]
mpich → libgfortran=5 → libgfortran5
mumps-mpi → libgfortran=5 → libgfortran5
superlu_dist → libgfortran5[version=’>=9.3.0’]
petsc → libgfortran5[version=’>=9.3.0’]
superlu → libgfortran=5 → libgfortran5
petsc4py → libgfortran5[version=’>=9.3.0’]
mpich → libgfortran5[version=’>=9.3.0’]
libgfortran → libgfortran5
hypre → mpich[version=’>=3.3,<4.0.0a0’] → libgfortran5[version=’>=9.3.0’]
slepc → libgfortran=5 → libgfortran5
scalapack → libgfortran5[version=’>=9.3.0’]
fenics-dolfin → hdf5[version=’>=1.10.6,<’,build=mpi_mpich_*] → libgfortran5[version=’>=9.3.0’]
libopenblas → libgfortran5[version=’>=9.3.0’]
libblas → libopenblas[version=’>=0.3.12,<’] → libgfortran5[version=’>=9.3.0’]
scalapack → libgfortran=5 → libgfortran5
numpy → libopenblas[version=’>=0.3.3,<1.0a0’] → libgfortran5[version=’>=9.3.0’]
petsc4py → libgfortran=5 → libgfortran5

Package libcxx conflicts for:
numpy → python[version=’>=3.9,<3.10.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
olefile → python[version=’>=3.5,<3.6.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
petsc → hdf5[version=’>=1.10.6,<’,build=mpi_mpich_*] → libcxx[version=’>=11.0.0|>=9.0.1|>=4.0.1|>=11.0.1|>=9.0.0’]
sympy → python[version=’>=3.6,<3.7.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
lcms2 → libtiff[version=’>=4.1.0,<5.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1’]
readline → ncurses[version=’>=6.2,<7.0a0’] → libcxx[version=’>=4.0.1’]
python=3.8 → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
boost-cpp → libboost==1.73.0=hd4c2dcd_11 → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
kiwisolver → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=11.0.1’]
lz4-c → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.0’]
matplotlib-base → libcxx[version=’>=10.0.0|>=4.0.1’]
slepc → mpich[version=’>=3.3,<4.0.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1|>=9.0.0’]
matplotlib → libcxx[version=’>=4.0.1’]
libnghttp2 → libcxx[version=’>=10.0.0|>=11.0.1’]
gmp → libcxx[version=’>=10.0.0|>=4.0.1|>=10.0.1’]
hypre → libcxx[version=’>=9.0.1’]
kiwisolver → libcxx[version=’>=10.0.0|>=4.0.1’]
spyder → pyqt[version=’>=5.6,<5.13’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
pip → python[version=’>=3.6,<3.7.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
expat → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
matplotlib → matplotlib-base[version=’>=3.3.4,<’] → libcxx[version=’>=10.0.0|>=11.0.1’]
fenics-ffc → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
fenics-ufl → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
hdf5 → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.0’]
hdf5 → mpich[version=’>=3.3,<4.0.0a0’] → libcxx[version=’>=11.0.1’]
libtiff → libcxx[version=’>=10.0.0|>=4.0.1’]
cmake → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
sqlite → ncurses[version=’>=6.2,<7.0a0’] → libcxx[version=’>=4.0.1’]
fenics-dolfin → mpich[version=’>=3.3.2,<4.0.0a0’] → libcxx[version=’>=10.0.0|>=10.0.1|>=11.0.1|>=4.0.1’]
slepc → libcxx[version=’>=10.0.1’]
wheel → python → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
zstd → lz4-c[version=’>=1.9.2,<1.10.0a0’] → libcxx[version=’>=11.0.0’]
cycler → python[version=’>=3.9,<3.10.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
pkgconfig → python[version=’>=3.7,<3.8.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
matplotlib-base → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=11.0.1’]
libcurl → krb5[version=’>=1.17.1,<1.18.0a0’] → libcxx[version=’>=11.0.0|>=4.0.1|>=11.0.1’]
ptscotch → mpich[version=’>=3.3.2,<4.0.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1’]
metis → libcxx[version=’>=4.0.1’]
python=3.8 → libffi[version=’>=3.3,<3.4.0a0’] → libcxx[version=’>=11.0.0’]
libtiff → zstd[version=’>=1.4’] → libcxx[version=’>=11.0.1’]
icu → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.0’]
boost-cpp → libcxx[version=’>=11.0.0’]
fenics-dolfin → libcxx[version=’>=11.0.0’]
hypre → mpich[version=’>=3.3,<4.0.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1’]
suitesparse → libcxx[version=’>=4.0.1|>=9.0.0’]
mpc → gmp[version=’>=6.1.2’] → libcxx[version=’>=10.0.0|>=4.0.1|>=10.0.1’]
certifi → python[version=’>=3.7,<3.8.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
slepc4py → mpich[version=’>=3.3.2,<4.0.0a0’] → libcxx[version=’>=10.0.0|>=10.0.1|>=11.0.1|>=4.0.1’]
zstd → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
libedit → ncurses[version=’>=6.2,<7.0a0’] → libcxx[version=’>=4.0.1’]
pybind11 → libcxx[version=’>=10.0.0|>=4.0.1|>=10.0.1’]
six → python[version=’>=3.9,<3.10.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
mpmath → python[version=’>=3.9,<3.10.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
mpich → libcxx[version=’>=11.0.1|>=4.0.1’]
pybind11 → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=11.0.1’]
fenics-dijitso → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
fenics → fenics-dolfin==2019.1.0=py38hd7c8441_18 → libcxx[version=’>=10.0.0|>=11.0.0|>=4.0.1|>=11.0.1’]
suitesparse → tbb[version=’>=2019.1’] → libcxx[version=’>=10.0.0|>=11.0.1’]
mpi4py → mpich[version=’>=3.3,<3.4.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
libffi → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.0’]
ncurses → libcxx[version=’>=4.0.1’]
krb5 → libcxx[version=’>=11.0.0|>=4.0.1’]
pyparsing → python → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
superlu_dist → metis[version=’>=5.1.0,<5.2.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1|>=9.0.1’]
python_abi → python=3.8 → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
tbb → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
eigen → libcxx[version=’>=11.0.0|>=4.0.1’]
parmetis → mpich[version=’>=3.3,<4.0.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1’]
setuptools → python[version=’>=3.6,<3.7.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
tornado → python[version=’>=3.9,<3.10.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
python-dateutil → python → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
pillow → libtiff[version=’>=4.1.0,<5.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
mumps-mpi → metis[version=’>=5.1.0,<5.2.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1|>=9.0.1’]
petsc → libcxx[version=’>=10.0.1’]
petsc4py → mpich[version=’>=3.3.2,<4.0.0a0’] → libcxx[version=’>=10.0.0|>=10.0.1|>=11.0.1|>=4.0.1’]
mpfr → gmp[version=’>=6.1.2’] → libcxx[version=’>=10.0.0|>=4.0.1|>=10.0.1’]
fenics-fiat → python[version=’>=3.8,<3.9.0a0’] → libcxx[version=’>=10.0.0|>=4.0.1|>=11.0.1’]
parmetis → libcxx[version=’>=9.0.1’]
superlu_dist → libcxx[version=’>=10.0.1’]
scalapack → mpich[version=’>=3.3,<4.0.0a0’] → libcxx[version=’>=11.0.1|>=4.0.1’]
gmpy2 → gmp[version=’>=6.1.2’] → libcxx[version=’>=10.0.0|>=4.0.1|>=10.0.1|>=11.0.1’]

Package libopenblas conflicts for:
hypre → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
scalapack → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
superlu → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
petsc4py → numpy[version=’>=1.16.5,<2.0a0’] → libopenblas[version=’>=0.3.3,<1.0a0’]
superlu_dist → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
fenics-dijitso → numpy → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
fenics-dolfin → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0|>=0.3.3,<1.0a0’]
suitesparse → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
matplotlib → numpy[version=’>=1.14.6,<2.0a0’] → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
mumps-mpi → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
slepc → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
fenics-fiat → numpy → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
numpy → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
suitesparse → libopenblas[version=’>=0.2.20,<|>=0.3.3,<1.0a0’]
fenics-ffc → numpy → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
numpy → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
petsc → libblas[version=’>=3.8.0,<4.0a0’] → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
liblapack → libblas==3.9.0=8_openblas → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
fenics-ufl → numpy → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
libcblas → libblas==3.9.0=8_openblas → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
matplotlib-base → numpy[version=’>=1.16.6,<2.0a0’] → libopenblas[version=’>=0.2.20,<|>=0.3.2,<|>=0.3.3,<1.0a0’]
libblas → libopenblas[version=’>=0.3.12,<|>=0.3.12,<1.0a0’]
slepc4py → numpy[version=’>=1.16.5,<2.0a0’] → libopenblas[version=’>=0.3.3,<1.0a0’]

Package mpich conflicts for:
superlu_dist → parmetis[version=’>=4.0.3,<4.1.0a0’] → mpich[version=’>=3.3,<4.0.0a0’]
petsc → mpich[version=’>=3.3.2,<4.0.0a0’]
mpi4py → mpich[version=’>=3.3,<3.4.0a0|>=3.4,<4.0.0a0’]
petsc → hdf5[version=’>=1.10.6,<’,build=mpi_mpich_] → mpich[version=’>=3.3,<4.0.0a0’]
mumps-mpi → mpich[version=’>=3.3.2,<4.0.0a0’]
scalapack → mpich[version=’>=3.3,<4.0.0a0’]
slepc → mpich[version=’>=3.3,<4.0.0a0’]
parmetis → mpich[version=’>=3.3,<4.0.0a0’]
fenics-dolfin → hdf5[version=’>=1.10.6,<’,build=mpi_mpich_
] → mpich[version=’>=3.3,<3.4.0a0|>=3.3,<4.0.0a0|>=3.4,<4.0.0a0’]
hypre → mpich[version=’>=3.3,<4.0.0a0’]
superlu_dist → mpich[version=’>=3.3.2,<4.0.0a0’]
slepc4py → slepc[version=’>=3.13.4,<3.14.0a0’] → mpich[version=’>=3.3,<4.0.0a0’]
fenics-dolfin → mpich[version=’>=3.3.2,<4.0.0a0’]
slepc4py → mpich[version=’>=3.3.2,<4.0.0a0’]
mumps-mpi → parmetis[version=’>=4.0.3,<4.1.0a0’] → mpich[version=’>=3.3,<4.0.0a0’]
fenics → fenics-dolfin==2019.1.0=py38hd7c8441_18 → mpich[version=’>=3.3.2,<4.0.0a0’]
hdf5 → mpich[version=’>=3.3,<4.0.0a0’]
ptscotch → mpich[version=’>=3.3.2,<4.0.0a0’]
slepc → petsc[version=’>=3.13.6,<3.14.0a0’] → mpich[version=’>=3.3.2,<4.0.0a0’]
petsc4py → mpich[version=’>=3.3.2,<4.0.0a0’]

Package liblapack conflicts for:
fenics-dolfin → numpy[version=’>=1.16.6’] → liblapack[version=’>=3.8.0,<4.0a0’]
mumps-mpi → scalapack[version=’>=2.0.2,<2.1.0a0’] → liblapack[version=’>=3.8.0,<4.0.0a0’]

It’s a very long error message and wouldn’t fit here…

I do not know if I understood you correctly. You created the environment with FEniCS via

conda create -n fenicsproject -c conda-forge fenics

Then you opened anaconda and started spyder? I do not know which environment anaconda spyder is using, but I think it isn’t your fenicsproject. I also had troubles to get anaconda spyder running with fenics, thats why I switched to miniconda. Try this in your terminal:

conda -create fenicsproject -c conda-forge fenics=2019 spyder
conda activate fenicsproject

Then spyder should open (without the anaconda-dialogue) and you can import fenics

from fenics import *

This works for me. If you want to use jupyter notebook then you need nb_conda_kernels

conda install -c conda-forge nb_conda_kernels jupyter

1 Like

Hi Yannik,

Thanks for getting back.

I installed fenics using conda create -n fenicsproject -c conda-forge fenics. That’s what the instructions in the Fenics website says.

Then, I entered into the fenicsproject environment using the command conda install spyder. I got the error message above. I can’t install spyder in this environment.

I tried typing conda -create fenicsproject -c conda-forge fenics=2019 spyder as you said above in the terminal.

I got the error:

CommandNotFoundError: No command ‘conda fenicsproject’.
Did you mean ‘conda inspect’?

Is there a typo in the command?

Yes, sorry. My bad. It should be

onda create --name fenicsproject -c conda-forge fenics=2019 spyder

followed by

conda activate fenicsproject



1 Like

I am using fenics from terminal too, it wpuld be great to run it in vscode. So tried what Yannik wrotes get the following error:

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: failed

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

  - vscode

Current channels:


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

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

Does anyone know how to get around this? Here people says it’s solved when updated, here others says it should be downgraded. I am super confused.

First of all, why are you citing me wrong? I’ve never written

conda create --name fenicsproject -c conda-forge fenics=2019 vscode

However from reading your error messages it seems that there is no package vscode available to install via conda. You can’t simply type

conda create --name fenicsproject -c conda-forge fenics=2019 xxx

with xxx your IDE of choice. They have to be installable via conda. Also your two links won’t help you. What you should do:

  1. Install VS code
  2. Create an conda environment with fenics, e.g. via
    conda create --name fenicsproject -c conda-forge fenics=2019
  3. Activate this conda environment (fenicsproject) in VS code

I’m not using VS code so I can’t tell you how this works. But perhaps you can find a solution here.


It wasn’t my intention, I just wanted to wrote how I wrote it by copying what you wrote. Thank you so much for the answer.

Thank you very much for this solution. I finally got it to work!

I have Anaconda Navigator, and was trying to use the known Poisson demo with the preloaded Spyder IDE, but it wasn’t catching the newly installed FEniCS within the program. Essentially, it was a warning on the lines where FEniCS syntax is used (yellow triangle said ‘undefined names’).

I tried what @Yannik said since it seemed to jive with the idea that I needed Spyder to activate the FEniCS environment… First I closed out Spyder and Anaconda Navigator and opened a fresh Terminal.
in Terminal, I typed:

conda create --name fenicsproject -c conda-forge fenics=2019 spyder
conda activate fenicsproject

I have a conda environment existing at home/user/anaconda3/envs/fenicsproject
The Terminal showed a change from (base) user@system:~ to (fenicsproject) user@system:~
However, when I typed the last line, it said that

Command 'spyder' not found but can be installed with: 
sudo apt install spyder

So I reinstalled Spyder, and it warned me that it was Spyder 3.0 (now on 5.0), and the code still is giving me the warning.

I just need the program to load the FEniCS module, so I am unsure what is going wrong. Any ideas as to how I can activate the environment so that now and the next time I open Spyder it will recognize FEniCS syntax on this system?

Hi EngineerMama,

Does your code run? In my (working) conda-spyder setup, when I use

from fenics import *

I get the same yellow triangle warnings, but the code runs correctly.

What you’re seeing is part of the reason why wildcard imports are not recommended when programming in Python: you don’t know exactly what names you’re importing. (See the last bullet point on “wildcard imports”.) In this case, you’re getting warnings because your error-checker (it appears to be pyflakes) doesn’t know what names you’re importing either. Note that if you use the same syntax on a very standard python module (e.g. from os import *, you get the same warning (I do, anyway). Most FEniCS codes use the wildcard import because the resulting code reads more like the math that it represents.

You can verify that your setup is working by doing:

from fenics import *

This will tell you all the names that are defined in the global namespace. If the warnings bother you, you can instead use

import fenics as fe

but note that any fenics-defined names will now have to be addressed as fe.<name>, e.g.

u0 = fe.Constant(0.0)



@conpierce8 THANK YOU!

I forgot about the Pythonic way of doing things as I was so caught up in how hard it’s been to get FEniCS installed. I still think it’s quirky how the Anaconda app doesn’t recognize that Spyder is installed in the environment, but since the environment will launch Spyder from the Terminal, I can adapt.
My fear was that it had somehow not installed, but with the updated syntax the demo code now doesn’t have the yellow triangles! (as you can see, where I’ve added the fe. before the name, the triangles from my previous screenshot are now gone)

1 Like