Install fenics and other required packages into a conda environment; for example,
$ conda create -c conda-forge -n <name_of_environment> fenics=2018 scipy sympy numpy matplotlib ipython

After you activate your environment
$ source activate <name_of_environment>

Run a program as a module; for example, run it from an ipython interpreter like this
$ run -m main