INNER CODE UNIT · Python
install
OSU-NLP-Group/ScienceAgentBench · agent.py:97
def install(self, out_fname):
err_msg = ""
test_path = Path("program_to_eval/")
if test_path.exists():
rmtree(test_path)
os.mkdir(test_path)
copyfile(out_fname, Path("program_to_eval/", out_fname.split("/")[-1]))
exec_res = subprocess.run(
["pipreqs", "program_to_eval/", "--savepath=requirements.in", "--mode", "no-pin"],
capture_output=True
)
if exec_res.returncode != 0:
err_msg = "There is a problem extracting packages used in the program. Please use packages that are easier to identify and install via pip."
return True, err_msg