This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Import mshr with python

0 votes

Hello
I have troubles importing mshr:

$ python -c 'import mshr'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named mshr

My machine is a Debian stable (jessie), with dolfin-bin and fenics packages installed (via apt).
According to the install guidelines the fenics package should suffice.

It seems strange to me that apt-cache search mshr and apt-file search mshr don't find fenics. There is no information about the removal of mshr in the debian changelog.

What am I missing? Can someone reproduce?

asked Jan 21, 2016 by adoll FEniCS Novice (530 points)

1 Answer

+1 vote
 
Best answer

The mshr debian package is currently only available in the FEniCS PPA for Ubuntu. What you can do is to download the package from the FEniCS PPA and build it for your computer, for instance something like this:

dget https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics-1.4.x/+files/mshr_1.4.0~git201411123-1~ppa1~utopic1.dsc
cd mshr-1.4.0~git201411123/
dpkg-buildpackage -us -uc -rfakeroot
cd ..
sudo dpkg -i *mshr*.deb
answered Jan 22, 2016 by johannr FEniCS Expert (17,350 points)
selected Jan 27, 2016 by adoll

I misinterpreted the install guidelines, and thought the Ubuntu PPA is just a more recent packaged version.
I tried your tip, but upon running debuild I face

Now signing changes and any dsc files...
 signfile mshr_1.4.0~git201411123-1~ppa1~utopic1.dsc Johannes Ring <johannr@simula.no>
gpg: skipped "Johannes Ring <johannr@simula.no>": secret key not available
gpg: /tmp/debsign.TK2s3k1J/mshr_1.4.0~git201411123-1~ppa1~utopic1.dsc: clearsign failed: secret key not available
debsign: gpg error occurred!  Aborting....
debuild: fatal error at line 1295:
running debsign failed

As far as I understand this, debuild wants to sign some files with your gpg key. Sorry if this is a newbie question, but why is this needed, and how shall I deal with that?

Please try to run dpkg-buildpackage -us -uc -rfakeroot instead of debuild. I have updated the instructions in the answer.

BTW, you might want to use the fenics-install.sh script to build from source instead. That will give you the latest stable version (1.6), while the FEniCS packages in jessie are old (version 1.4).

Works, much obliged!

You can also pull the Debian version of mshr from https://anonscm.debian.org/git/debian-science/packages/fenics/mshr.git/

mshr can't enter Debian in its own right until we've configured mshr to use the system copy of CGAL, but the git repository will be kept up to date.

...