RuntimeError: Could not find DOLFIN pkg-config file

I am using jupyter notebook with anaconda 1.9.7 on mac os 10.14.5 (Mojave)
I have just installed fenics for anaconda with
conda create -n fenicsproject -c conda-forge fenics
source activate fenicsproject. No problem occured during installation.

When I launch a jupyter notebook with only one line

from dolfin import *

I get a runtime error (see below). Seems to be a problem with dolfin pkg-config file…
I tried to fix that by running ‘source dolfin.conf’ in the DOLFIN folder:
/anaconda3/envs/fenicsproject/share/dolfin
I don’t know what else to do. Help appreciated.


RuntimeError Traceback (most recent call last)
in
----> 1 from dolfin import *

/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/dolfin/init.py in
140 from .common.plotting import plot
141
–> 142 from .fem.assembling import (assemble, assemble_system, assemble_multimesh,
143 SystemAssembler, assemble_local)
144 from .fem.form import Form

/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/dolfin/fem/assembling.py in
32 import ufl
33 import dolfin.cpp as cpp
—> 34 from dolfin.fem.form import Form
35 from dolfin import MPI
36 from dolfin.function.multimeshfunction import MultiMeshFunction

/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/dolfin/fem/form.py in
10 import ufl
11 import dolfin.cpp as cpp
—> 12 from dolfin.jit.jit import dolfin_pc, ffc_jit
13
14

/anaconda3/envs/fenicsproject/lib/python3.7/site-packages/dolfin/jit/jit.py in
16 dolfin_pc = pkgconfig.parse(“dolfin”)
17 else:
—> 18 raise RuntimeError(“Could not find DOLFIN pkg-config file. Please make sure appropriate paths are set.”)
19
20

RuntimeError: Could not find DOLFIN pkg-config file. Please make sure appropriate paths are set.

SOLVED:
it is a bug in anaconda navigator. If you launch a jupyter notebook from within Anaconda navigator it does not load the fenicsproject environment variables, even if you launch the jupyter notebook from the fenicsproject environment.

Whereas if you launch the jupyter notebook from a terminal where you activate the fenicsproject, the problem disappears and everything works fine:
in a terminal simply type
(base) MacBook-Pro-de-Pascal:~ pascalazerad$ conda activate fenicsproject
(fenicsproject) MacBook-Pro-de-Pascal:~ pascalazerad$ jupyter notebook

you can check the environment is loaded by typing in the jupyter notebook

#test if environment fenics is activated
import os
print(os.environ[‘PATH’])

executing the line yields:
/anaconda3/envs/fenicsproject/bin:/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
fenicsproject path is there

If you had launched the jupyter notebook from anaconda navigator by mouse click you would have gotten
/anaconda3/bin:/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
no mention of fenicsproject!