1

I'm trying to install a package called fenics in Google Colab.

I tried both:

!pip install fenics

>> fenics in /usr/local/lib/python3.6/dist-packages (2019.1.0)

and

!apt-get install fenics

Then a simple import fenics raises ModuleNotFoundError. Restarting the runtime doesn't solve the problem. Any clues?

Tarifazo
  • 4,118
  • 1
  • 9
  • 22

1 Answers1

1

Following the instruction

!apt-get install software-properties-common
!add-apt-repository ppa:fenics-packages/fenics
!apt-get update
!apt-get install --no-install-recommends fenics

Then you can import fenics. Here's the notebook I tested.

korakot
  • 37,818
  • 16
  • 123
  • 144
  • Thanks Korakot. Just a doubt, why doesn't plain `pip install` work? – Tarifazo Aug 12 '19 at 12:39
  • @Mstaino I don't know either. I have tried both methods, only apt-get works. – korakot Aug 12 '19 at 15:19
  • 2
    @Tarifazo `pip install` only works well for simple python packages. fenics (dolfin) is no simple package, it has a long chain of numerical library dependencies and requires a C++ compiler for JIT compiling. `pip install` does not work smoothly with python packages that build C binary extensions, requiring use of a C compiler and installed library dependencies. These binary dependencies are managed by package managers such as apt. – Rizzer Apr 23 '22 at 13:09