You should find the FEniCS PPA is now working again for bionic.
Thanks for reporting the issue.
The path to the python modules doesnât square up with the bionic PETSC_DIR. I need to fix that.
âŚ
Paths are fixed, tests are passing.
The PPA should be providing FEniCS 2019.2 (snapshot) correctly now.
@dparsons, thanks for fixing that.
I just tried to installing fenics on colab a few minutes back, it did successfully install. However, it is unable to import dolfin.
import dolfin as df
print ('dolfin version:', df.__version__)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
[<ipython-input-12-cb5c2d090ebf>](https://localhost:8080/#) in <module>() ----> 1 import fenics as df 2 print ('dolfin version:', df.__version__)
[/usr/lib/python3/dist-packages/fenics/__init__.py](https://localhost:8080/#) in <module>() 5 """ 6 ----> 7 from dolfin import *
ModuleNotFoundError: No module named 'dolfin'
--------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below. ---------------------------------------------------------------------------
When, I tried installing python3-dolfin, it says that itâs already installed.
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-dolfin is already the newest version (2019.2.0~git20200629.946dbd3-2~ppa1~bionic4).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
Can you locate where it is installed? What is the output of !dpkg -L fenics
?
Most likely not in /usr/local/lib/python3.6/dist-packages
⌠If itâs not then simply add that path to sys
, using import sys;sys.path.append(<your path>)
This what I get when I try !dpkg -L fenics
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/fenics
/usr/share/doc/fenics/changelog.gz
/usr/share/doc/fenics/copyright
@dparsons, this is what I get
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii dolfin-bin 2019.2.0~git all Executable scripts for DOLFIN
ii dolfin-doc 2019.2.0~git all Documentation and demo programs f
ii libdolfin-dev: 2019.2.0~git amd64 Shared links and development file
ii libdolfin-dev- 2019.2.0~git all Common header files for DOLFIN
un libdolfin0-dev <none> <none> (no description available)
un libdolfin1.0-d <none> <none> (no description available)
un libdolfin1.1-d <none> <none> (no description available)
un libdolfin1.2-d <none> <none> (no description available)
un libdolfin1.3-d <none> <none> (no description available)
un libdolfin1.4-d <none> <none> (no description available)
ii libdolfin2019. 2019.2.0~git amd64 Shared libraries for DOLFIN
ii python3-dolfin 2019.2.0~git amd64 Base Python interface for DOLFIN
ii python3-dolfin 2019.2.0~git amd64 Python interface for DOLFIN
I had no issues installing in my local system. There is only this problem with import dolfin as df
in Google Colab.
Please run dpkg -l *dolfin* | cat
to get the full information.
Can you confirm you have deleted the local installation files from pip install
?
@dparsons, yes, I did (factory)reset the runtime on Colab, so that should have removed any previous installations including pip install.
Hereâs the output for dpkg -l *dolfin* | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-===========================================-============-=============================================
ii dolfin-bin 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 all Executable scripts for DOLFIN
ii dolfin-doc 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 all Documentation and demo programs for DOLFIN
ii libdolfin-dev:amd64 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 amd64 Shared links and development files for DOLFIN
ii libdolfin-dev-common 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 all Common header files for DOLFIN
un libdolfin0-dev <none> <none> (no description available)
un libdolfin1.0-dev <none> <none> (no description available)
un libdolfin1.1-dev <none> <none> (no description available)
un libdolfin1.2-dev <none> <none> (no description available)
un libdolfin1.3-dev <none> <none> (no description available)
un libdolfin1.4-dev <none> <none> (no description available)
ii libdolfin2019.2:amd64 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 amd64 Shared libraries for DOLFIN
ii python3-dolfin 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 amd64 Base Python interface for DOLFIN (Python 3)
ii python3-dolfin-real 2019.2.0~git20200629.946dbd3-2~ppa1~bionic4 amd64 Python interface for DOLFIN
What is the output from
python3 -c "import dolfin; print(dolfin.__version__); print(dolfin.__path__)"
and
dpkg -l *petsc* | cat
?
Sorry, I (Hari) am replying to you in with a different account because I have reached the new user reply limit.
python3 -c "import dolfin; print(dolfin.__version__); print(dolfin.__path__)"
2019.2.0.dev0
['/usr/lib/petsc/lib/python3/dist-packages/dolfin']
[4303537e1512:03986] *** Process received signal ***
[4303537e1512:03986] Signal: Segmentation fault (11)
[4303537e1512:03986] Signal code: Address not mapped (1)
[4303537e1512:03986] Failing at address: 0x7effa46ea20d
[4303537e1512:03986] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x128a0)[0x7effa799f8a0]
[4303537e1512:03986] [ 1] /lib/x86_64-linux-gnu/libc.so.6(getenv+0xa5)[0x7effa75de835]
[4303537e1512:03986] [ 2] /usr/lib/x86_64-linux-gnu/libtcmalloc.so.4(_ZN13TCMallocGuardD1Ev+0x34)[0x7effa7e49e44]
[4303537e1512:03986] [ 3] /lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0xf5)[0x7effa75df6c5]
[4303537e1512:03986] [ 4] /usr/lib/x86_64-linux-gnu/libtcmalloc.so.4(+0x13cb3)[0x7effa7e47cb3]
[4303537e1512:03986] *** End of error message ***
dpkg -l petsc | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==========================-===================-============-===============================================================
un libpetsc-complex-3.6.2-dev <none> <none> (no description available)
un libpetsc-complex-3.6.3-dev <none> <none> (no description available)
un libpetsc3.6 <none> <none> (no description available)
un libpetsc3.6.2-dev <none> <none> (no description available)
un libpetsc3.6.3-dev <none> <none> (no description available)
un libpetsc3.7 <none> <none> (no description available)
ii libpetsc3.7-dev:amd64 3.7.7+dfsg1-2build5 amd64 Static libraries, shared links, header files for PETSc
ii libpetsc3.7.7:amd64 3.7.7+dfsg1-2build5 amd64 Shared libraries for version 3.7 of PETSc
un libpetsc3.7.7-dbg <none> <none> (no description available)
ii libpetsc3.7.7-dev:amd64 3.7.7+dfsg1-2build5 amd64 Static libraries, shared links, header files for PETSc
un petsc-dev <none> <none> (no description available)
un petsc3.7-dev <none> <none> (no description available)
un petsc3.7.7-doc <none> <none> (no description available)
un python-petsc <none> <none> (no description available)
un python-petsc4py <none> <none> (no description available)
ii python-petsc4py-docs 3.7.0-3build2 all Python bindings for PETSc libraries: documentation and examples
ii python3-petsc4py 3.7.0-3build2 amd64 Python 3 bindings for PETSc libraries
Looks like the colab environment is not a straight Ubuntu system. I guess the jupyter notebook is running a virtual python environment which might explain why it hasnât found dolfin. jupyter would have to be configured to pull in modules from the host ubuntu system. I canât help debug that.
The segfault you got running python3 directly is a worry. But you can see your dolfin module itself has been installed.
@dparsons, I see. Thanks for all the help!
It is strange that I could run fenics successfully on colab a week ago. Is there a way I can install the older version of fenics and see if that works?
I donât know a simple way to roll back. You can see the old builds if you click on the âView all buildsâ link on the PPA, which takes you to https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics/+builds.
Then search and filter for âSuccessfully builtâ and you can find links to the past bionic builds. Download the .deb files manually and then install them with
sudo dpkg -i <package>.deb
Possibly the downloads can be brute-force-automated with some variation of
wget https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics/+build/*/+files/*_2019.1.0*bionic*.deb
though that line itself will not do it.
Okay, thank you. I appreciate the help.
Actually, restarting the runtime (Runtime->Restart Runtime
) after installing fenics seems to be all you need.
from google.colab import files
try:
from dolfin import *; from mshr import *
except ImportError as e:
!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
from dolfin import *; from mshr import *
import matplotlib.pyplot as plt;
from IPython.display import clear_output, display; import time; import dolfin.common.plotting as fenicsplot
import time
import os, sys, shutil
# dolfin_version = dolfin.dolfin_version()
# print ('dolfin version:', dolfin_version)
!rm -rf * # clean up all files
# Useful commands
# Remove an empty folder : os.rmdir("my_results")
# Remove a folder with files : shutil.rmtree("results")
# Make a folder : os.mkdir("my_results")
Thatâs how i installed fenics on Google Colab and it works for me.
Hi,
I use FEniCS Jupyter notebooks in my teaching and find them very useful together with Google Colab. I experienced the same problem described in this thread, and your fix with âRestart->Runtimeâ worked for me up to now. Although, today I received several messages from students stating that it no longer worked, and I could reproduce their issues.
Has anything changes the last couple of days? And is there a new solution/work around known for this issue?
Thank you for any help!