[petsc-dev] Configure won't find python

Jacob Faibussowitsch jacob.fai at gmail.com
Fri Apr 17 12:40:20 CDT 2020


Hello All,

I use an Ubuntu docker image based on jedbrown/mpich-ccache and ran into the following error (Dockerfile attached as well).

If in a user only has python3 installed and not python2 then /usr/bin/python doesn’t exist. Given that python2 has gone the way of the dodo perhaps petsc should be looking for python3 over python2. This is a somewhat funky but functioning implementation that replaces the shebang line in configure that I have been using to default to python3. I don’t know how portable it is however, I believe “command" is not universally available in every shell?
#!/bin/sh
# “”” is comment in python, and : is noop in shell so this configure can be run as ./configure and python2.7 ./configure
""":"

# Find the right python implementation, check by sending it on over to dave
for pyimpls in python3 python2 python /usr/bin/python /usr/bin/env python ; do
   command -v > /dev/null $pyimpls && exec $pyimpls $0 "$@“
done
# Error code in case things go awry 
Echo “PYTHON NOT FOUND” >2
exit 2
":"""
if sys.version_info < (2,6) or (sys.version_info >= (3,0) and sys.version_info < (3,4)):
  print('************************************************************************')
  print('*      Python version 2.6+ or 3.4+ is required to run ./configure      *')
  print('*         Try: "python2.7 ./configure" or "python3 ./configure"        *')
  print('************************************************************************')
  sys.exit(4)

sys.path.insert(0, os.path.abspath('config'))
import configure
configure.petsc_configure([])



Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200417/9e9e4646/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Dockerfile
Type: application/octet-stream
Size: 1356 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200417/9e9e4646/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200417/9e9e4646/attachment-0001.html>


More information about the petsc-dev mailing list