diff --git a/harness/constants.py b/harness/constants.py index 874dec86b..38aae6fd3 100644 --- a/harness/constants.py +++ b/harness/constants.py @@ -1,26 +1,26 @@ MAP_VERSION_TO_INSTALL_SKLEARN = { k: { "python": "3.6", - "packages": "numpy scipy cython pytest pandas matplotlib", + "packages": "numpy scipy Cython==0.27 pytest pandas matplotlib", "install": "pip install -v --no-use-pep517 --no-build-isolation -e .", } - for k in ["0.20", "0.21", "0.22"] + for k in ["0.20"] } MAP_VERSION_TO_INSTALL_SKLEARN.update( { k: { "python": "3.7", - "packages": "numpy scipy cython pytest pandas matplotlib", + "packages": "numpy scipy Cython==0.29 pytest pandas matplotlib", "install": "pip install -v --no-use-pep517 --no-build-isolation -e .", } - for k in ["0.23", "0.24"] + for k in ["0.21", "0.22", "0.23", "0.24"] } ) MAP_VERSION_TO_INSTALL_SKLEARN.update( { k: { "python": "3.9", - "packages": "numpy scipy cython pytest pandas matplotlib joblib threadpoolctl", + "packages": "numpy scipy Cython==0.29 pytest pandas matplotlib joblib threadpoolctl", "install": "pip install -v --no-use-pep517 --no-build-isolation -e .", } for k in ["1.0", "1.1", "1.2", "1.3", "1.4"] @@ -215,12 +215,25 @@ ].append("sed -i 's/Jinja2>=2.3/Jinja2<3.1/' setup.py") MAP_VERSION_TO_INSTALL_ASTROPY = { - k: {"python": "3.9", "install": "pip install -e .[test]"} - for k in - ["0.1", "0.2", "0.3", "0.4", "1.1", "1.2", "1.3", "3.0", "3.1", "3.2"] + \ - ["4.1", "4.2", "4.3", "5.0", "5.1", "5.2"] + k: { + "python": "3.9", + "install": "python setup.py install", + "pip_packages": "pytest extension-helpers numpy", + } + for k in ["0.1", "0.2", "0.3", "0.4", "1.1", "1.2", "1.3", "3.0", "3.1", "3.2"] } +MAP_VERSION_TO_INSTALL_ASTROPY.update( + { + k: { + "python": "3.9", + "install": "pip install -e .[test]", + "pip_packages": "pytest extension-helpers numpy", + } + for k in ["4.1", "4.2", "4.3", "5.0", "5.1", "5.2"] + } +) + MAP_VERSION_TO_INSTALL_SYMPY = { k: { "python": "3.9", diff --git a/harness/context_manager.py b/harness/context_manager.py index ae5e804ff..073be5083 100644 --- a/harness/context_manager.py +++ b/harness/context_manager.py @@ -321,12 +321,23 @@ def __enter__(self): os.remove(path_to_reqs) else: # Create environment + install dependencies - cmd = f"{exec_cmd} create -n {env_name} python={install['python']} {pkgs} -y" + cmd = f"{exec_cmd} create -n {env_name} python={install['python']} -y" logger_testbed.info( f"[Testbed] Creating environment {env_name}; Command: {cmd}" ) self.exec(cmd.split(" ")) + # Activate the environment and install the packages + activate_cmd = f". {path_activate} {env_name}" + full_cmd = f"{activate_cmd} && echo 'activate successful'" + if pkgs != "": + install_cmd = f"pip install {pkgs}" + full_cmd += f" && {install_cmd}" + logger_testbed.info( + f"[Testbed] Installing environment dependencies {pkgs}; Command: {full_cmd}" + ) + self.exec(full_cmd, shell=True) + # Install additional packages if specified if "pip_packages" in install: cmd = f"source {path_activate} {env_name} && pip install {install['pip_packages']}"