Installing fenics on Google Colab

Hi,

I tried installing fenics on Colab using the following code:

!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:fenics-packages/fenics
!apt-get update -qq
!apt install -y --no-install-recommends fenics

Unfortunately, the installation fails and I get the following message:

E: Package 'python-software-properties' has no installation candidate
Hit:1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease
Ign:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease
Ign:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease
Hit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  Release
Hit:5 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  Release
Hit:6 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease
Hit:8 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:9 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:11 http://ppa.launchpad.net/fenics-packages/fenics/ubuntu bionic InRelease
Hit:12 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:13 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:14 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 fenics : Depends: python3-dolfin (>= 2019.2) but it is not going to be installed
          Depends: dolfin-doc (>= 2019.2) but it is not going to be installed
          Depends: dolfin-bin (>= 2019.2) but it is not going to be installed
          Depends: python3-mshr (>= 2019.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Any help would be appreciated. Thanks.

Please encapsulate your terminal input/output with 3x` to format it properly
e.g.

apt-get update

My mistake, I have re-edited the post.

Have you considered this? https://colab.research.google.com/drive/1GzFkuAG8i3s0m6K9a6g-XkO_6FGusHWU#scrollTo=4jWzVxURFVLj

Yes, I did. I still get the same error message.

Have you tried installing from source ?

Since this morning I have the same exact problem.

No. I am not sure how to do that on Colab.

I tried the following code from fenics documentation but was unsuccessful.

!pip3 install fenics-ffc --upgrade

!FENICS_VERSION=$(python3 -c"import ffc; print(ffc.__version__)")
!git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
!git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/mshr
!mkdir dolfin/build && cd dolfin/build && cmake .. && make install && cd ../..
!mkdir mshr/build   && cd mshr/build   && cmake .. && make install && cd ../..
!cd dolfin/python && pip3 install . && cd ../..
!cd mshr/python   && pip3 install . && cd ../..

I get the following output:

Requirement already satisfied, skipping upgrade: sympy in /usr/local/lib/python3.6/dist-packages (from fenics-fiat<2019.2,>=2019.1.0->fenics-ffc) (1.1.1)
Requirement already satisfied, skipping upgrade: mpmath>=0.19 in /usr/local/lib/python3.6/dist-packages (from sympy->fenics-fiat<2019.2,>=2019.1.0->fenics-ffc) (1.1.0)
Installing collected packages: fenics-fiat, fenics-ufl, fenics-dijitso, fenics-ffc
Successfully installed fenics-dijitso-2019.1.0 fenics-ffc-2019.1.0.post0 fenics-fiat-2019.1.0 fenics-ufl-2019.1.0
Requirement already up-to-date: fenics-ffc in /usr/local/lib/python3.6/dist-packages (2019.1.0.post0)
Requirement already satisfied, skipping upgrade: fenics-dijitso<2019.2,>=2019.1.0 in /usr/local/lib/python3.6/dist-packages (from fenics-ffc) (2019.1.0)
Requirement already satisfied, skipping upgrade: numpy in /usr/local/lib/python3.6/dist-packages (from fenics-ffc) (1.18.5)
Requirement already satisfied, skipping upgrade: fenics-fiat<2019.2,>=2019.1.0 in /usr/local/lib/python3.6/dist-packages (from fenics-ffc) (2019.1.0)
Requirement already satisfied, skipping upgrade: fenics-ufl<2019.2,>=2019.1.0 in /usr/local/lib/python3.6/dist-packages (from fenics-ffc) (2019.1.0)
Requirement already satisfied, skipping upgrade: sympy in /usr/local/lib/python3.6/dist-packages (from fenics-fiat<2019.2,>=2019.1.0->fenics-ffc) (1.1.1)
Requirement already satisfied, skipping upgrade: mpmath>=0.19 in /usr/local/lib/python3.6/dist-packages (from sympy->fenics-fiat<2019.2,>=2019.1.0->fenics-ffc) (1.1.0)
Cloning into 'dolfin'...
fatal: Remote branch  not found in upstream origin
Cloning into 'mshr'...
fatal: Remote branch  not found in upstream origin
mkdir: cannot create directory ‘dolfin/build’: No such file or directory
mkdir: cannot create directory ‘mshr/build’: No such file or directory

I am afraid that I am not very familiar with the process of installing from source.

I am not able to build it from source, nor install from Ubuntu PPA on Colab. Are you able to install it locally from Ubuntu PPA ?

No, I am not able to do that either now, though I was able to install it a week back.

Could be related to a FEniCS PPA update. @dparsons can probably shed some light on this.

1 Like

Hmm. I just tried creating a conda environment, but that doesn’t work either. Maybe @dparsons could help identify the issue here?

I have just updated the FEniCS PPA to the latest 2019.2 snapshot. You might have inadvertently got caught in the middle of the upgrade. If so, it should be fine for upgrade now. You might want to perform

sudo apt-get dist-upgrade

after running sudo apt-get upgrade.

Your reference to pip install is a problem. You can not maintain a pip installation of fenics at the same time as an ubuntu installation. The libraries need to be self-consistent and you will break that if you try to run one on top of the other.

Installation from the FEniCS PPA should be fine now, so let me know if it continues to give problems (make sure you delete your pip installation first).

Incidentally, I do not recommend not installing the recommended packages. Use

apt install fenics

(the -y automatically proceeds with installation, add it if you like. Without it the installation will pause to give you a chance to review what packages will be installed)

It is still failing as of a few minutes ago here:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 fenics : Depends: python3-dolfin (>= 2019.2) but it is not going to be installed
          Depends: dolfin-doc (>= 2019.2) but it is not going to be installed
          Depends: dolfin-bin (>= 2019.2) but it is not going to be installed
          Depends: python3-mshr (>= 2019.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Yes, same case with me too.

Hi @bhaveshshrimali, your link isn’t publically accessible, is there an option for sharing it?

I presume at this point you’ve run apt-getupdate (you must have done or else fenics wouldn’t be requesting python3-dolfin (>= 2019.2)). Must be something tangled in the subdependencies. I’m firing up an ubuntu cloud installation to inspect.

What is reported if you install directly?

sudo apt-get install python3-dolfin

I get the following message.

!apt-get install python3-dolfin

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-dolfin : Depends: python3-dolfin-real but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
1 Like

I see the problem. It’s depending on -real packages, which are not available on bionic.
I’ll fix that.