diff --git a/Changelog.md b/Changelog.md index 75658e65..c907e248 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented here. ## [unreleased] - Update python, pyta and jupyter testers to allow a requirements file (#580) - Update R tester to allow a renv.lock file (#581) +- Improve display of Python package installation errors when creating environment (#585) ## [v2.6.0] - Update python versions in docker file (#568) diff --git a/server/autotest_server/testers/jupyter/setup.py b/server/autotest_server/testers/jupyter/setup.py index 56bfbb36..e48918a5 100644 --- a/server/autotest_server/testers/jupyter/setup.py +++ b/server/autotest_server/testers/jupyter/setup.py @@ -10,12 +10,14 @@ def create_environment(settings_, env_dir, _default_env_dir): pip_requirements = ["wheel"] + env_data.get("pip_requirements", "").split() requirements = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt") pip = os.path.join(env_dir, "bin", "pip") - subprocess.run([f"python{python_version}", "-m", "venv", "--clear", env_dir], check=True) + subprocess.run( + [f"python{python_version}", "-m", "venv", "--clear", env_dir], check=True, text=True, capture_output=True + ) pip_install_command = [pip, "install", "-r", requirements, *pip_requirements] if env_data.get("pip_requirements_file"): pip_install_command.append("-r") pip_install_command.append(os.path.join(env_dir, "../", "files", env_data.get("pip_requirements_file"))) - subprocess.run(pip_install_command, check=True) + subprocess.run(pip_install_command, check=True, text=True, capture_output=True) return {"PYTHON": os.path.join(env_dir, "bin", "python3")} diff --git a/server/autotest_server/testers/py/setup.py b/server/autotest_server/testers/py/setup.py index 56bfbb36..e48918a5 100644 --- a/server/autotest_server/testers/py/setup.py +++ b/server/autotest_server/testers/py/setup.py @@ -10,12 +10,14 @@ def create_environment(settings_, env_dir, _default_env_dir): pip_requirements = ["wheel"] + env_data.get("pip_requirements", "").split() requirements = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt") pip = os.path.join(env_dir, "bin", "pip") - subprocess.run([f"python{python_version}", "-m", "venv", "--clear", env_dir], check=True) + subprocess.run( + [f"python{python_version}", "-m", "venv", "--clear", env_dir], check=True, text=True, capture_output=True + ) pip_install_command = [pip, "install", "-r", requirements, *pip_requirements] if env_data.get("pip_requirements_file"): pip_install_command.append("-r") pip_install_command.append(os.path.join(env_dir, "../", "files", env_data.get("pip_requirements_file"))) - subprocess.run(pip_install_command, check=True) + subprocess.run(pip_install_command, check=True, text=True, capture_output=True) return {"PYTHON": os.path.join(env_dir, "bin", "python3")} diff --git a/server/autotest_server/testers/pyta/setup.py b/server/autotest_server/testers/pyta/setup.py index 4747273a..431affca 100644 --- a/server/autotest_server/testers/pyta/setup.py +++ b/server/autotest_server/testers/pyta/setup.py @@ -16,12 +16,14 @@ def create_environment(settings_, env_dir, _default_env_dir): env_properties.append(pyta_version) requirements = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt") pip = os.path.join(env_dir, "bin", "pip") - subprocess.run([f"python{python_version}", "-m", "venv", "--clear", env_dir], check=True) + subprocess.run( + [f"python{python_version}", "-m", "venv", "--clear", env_dir], check=True, text=True, capture_output=True + ) pip_install_command = [pip, "install", "-r", requirements, *env_properties] if env_data.get("pip_requirements_file"): pip_install_command.append("-r") pip_install_command.append(os.path.join(env_dir, "../", "files", env_data.get("pip_requirements_file"))) - subprocess.run(pip_install_command, check=True) + subprocess.run(pip_install_command, check=True, text=True, capture_output=True) return {"PYTHON": os.path.join(env_dir, "bin", "python3")}