When we call source activate ...
it starts a Python virtual environment. The purpose of a virtual environment is to created an isolated Python set-up. So it is by intention that the Python packages you have installed at other places outside that virtual environment are not accessible from within it. I would except fenics
to install matplotlib
as a dependency but in any case you try to explicitly install it.
Your error message says that matplotlib
is already installed in /usr/local/lib/python3.6/site-packages
which means you are calling pip3 install matplotlib
from a terminal where fenicsproject
environment is not yet activated.
If you are trying to install matplotlib
in the same environment as fenics
try
conda install -n fenicsproject matplotlib