[petsc-dev] Configure won't find python
Lisandro Dalcin
dalcinl at gmail.com
Fri Apr 17 16:21:20 CDT 2020
On Fri, 17 Apr 2020 at 20:41, Jacob Faibussowitsch <jacob.fai at gmail.com>
wrote:
> 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.
>
And what if someone is running on a (perhaps old) Linux distro that does
not have python3 installed by default?
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
> """:"
>
> This kind of trickery may be fragile...
> # 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
>
>
And there you have, you are trying to check for '/usr/bin/env python', but
the shell code you wrote will not work the way you are expecting.
Also, unless you are running on a funny environment that does not have
/usr/bin/ in $PATH, the trial for 'python' should be enough, and
the /usr/bin/python /usr/bin/env python look redundant. Am I missing
something?
> command -v > /dev/null $pyimpls && exec $pyimpls $0 "$@“
>
>
And the last quote the line above is likely wrong, it is an unicode
character.
> done
>
> # Error code in case things go awry
>
> Echo “PYTHON NOT FOUND” >2
>
>
"Echo" ? Are you really running this on Ubuntu?
Or you just hacked in on macOS and assumed that it will work everywhere?
BTW, Are you aware of the behavior of `command -v` with shell aliases?
$ alias python=python3
$ command -v python
alias python='python3'
--
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200418/aedc55b0/attachment.html>
More information about the petsc-dev
mailing list