PrincetonUniversity/athena

FileNotFoundError for regression tests when "python" is not in PATH but "python3" is

henry2004y opened this issue · 5 comments

Prerequisite checklist

Place an X in between the brackets on each line as you complete these checks:

  • Did you check that the issue hasn't already been reported?
  • Did you check the documentation in the Wiki for an answer?
  • Are you running the latest version of Athena++?

Summary of issue

I encountered regression test errors FileNotFoundError: [Errno 2] No such file or directory: 'python' while executing run_tests.py on a fresh installation. The tutorial for shocktubes runs fine.

Steps to reproduce

I followed the commands described in QuickStart and Regression Testing

➜  regression git:(master) ✗ python run_tests.py gr/mhd_shocks_hlld
Exception occurred
Traceback (most recent call last):
  File "/home/local/hongyang/bin/athena/tst/regression/run_tests.py", line 134, in main
    module.prepare(**kwargs)
  File "/home/local/hongyang/bin/athena/tst/regression/scripts/tests/gr/mhd_shocks_hlld.py", line 18, in prepare
    athena.configure('bgt',
  File "/home/local/hongyang/bin/athena/tst/regression/scripts/utils/athena.py", line 39, in configure
    subprocess.check_call(configure_command + global_config_args,
  File "/usr/lib/python3.10/subprocess.py", line 364, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python'
---> Error in scripts/tests/gr/mhd_shocks_hlld.py
gr.mhd_shocks_hlld test: prepare(), run(), analyze() finished

Results:
    gr.mhd_shocks_hlld: failed -- unexpected failure in prepare() stage

Summary: 0 out of 1 test passed

Traceback (most recent call last):
  File "/home/local/hongyang/bin/athena/tst/regression/run_tests.py", line 330, in <module>
    main(**vars(args))
  File "/home/local/hongyang/bin/athena/tst/regression/run_tests.py", line 198, in main
    raise TestError()
__main__.TestError

Version info

  • Athena++ version: e34cd25
  • Compiler and version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  • Operating system: Ubuntu 22
  • Hardware and cluster name (if applicable):
  • External library versions (if applicable):

What does /usr/bin/env python return in your environment?

looks like /usr/bin/python3.10 might be the only one in your PATH

Indeed:

➜  LinearWave git:(slab) ✗ /usr/bin/env python
/usr/bin/env: ‘python’: No such file or directory

However, I guess only python3 exists in Ubuntu22 by default, but not python.

Any objections to changing

configure_command = ['python', 'configure.py']

to

pybin = sys.executable if sys.executable is not None else 'python'
configure_command = [pybin, 'configure.py']

@tomidakn @c-white @pdmullen ?

@henry2004y can you make that change to your local repo and confirm that it fixes everything?