<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 17 Apr 2020 at 20:41, Jacob Faibussowitsch <<a href="mailto:jacob.fai@gmail.com">jacob.fai@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Hello All,<div><br></div><div>I use an Ubuntu docker image based on jedbrown/mpich-ccache and ran into the following error (Dockerfile attached as well).</div><div><br></div><div>If in a user only has python3 installed and not python2 then /usr/bin/python doesn’t exist.</div></div></blockquote><div><br></div><div>And what if someone is running on a (perhaps old) Linux distro that does not have python3 installed by default?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div> 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?</div><div><pre>#!/bin/sh</pre><pre># “”” is comment in python, and : is noop in shell so this configure can be run as ./configure and python2.7 ./configure<br>""":"<br><br></pre></div></div></blockquote><div>This kind of trickery may be fragile...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><pre># Find the right python implementation, check by sending it on over to dave<br>for pyimpls in python3 python2 python /usr/bin/python /usr/bin/env python ; do</pre></div></div></blockquote><div><br></div><div>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.</div><div>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?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><pre><div>   command -v > /dev/null $pyimpls && exec $pyimpls $0 "$@“</div></pre></div></div></blockquote><div><br></div><div>And the last quote the line above is likely wrong, it is an unicode character.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><pre>done</pre><pre># Error code in case things go awry </pre><pre>Echo “PYTHON NOT FOUND” >2</pre></div></div></blockquote><div><br></div><div>"Echo" ? Are you really running this on Ubuntu? </div><div>Or you just hacked in on macOS and assumed that it will work everywhere? </div><div><br></div><div>BTW, Are you aware of the behavior of `command -v` with shell aliases?</div><div><br></div><div>$ alias python=python3<br>$ command -v python<br>alias python='python3'<br></div></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Lisandro Dalcin<br>============<br>Research Scientist<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br></div></div></div></div>