easyconfigs-it4i/q/qcengine/qcengine-0.24.1-psi4.patch
easybuild 4fbadeb08a new file: a/ANSYS/ANSYS-2023R1-intel-2022a.eb
new file:   b/Boost/Boost-1.79.0-intel-compilers-2022.1.0.eb
	new file:   c/CheMPS2/CheMPS2-1.8.12-intel-2022a.eb
	new file:   g/gau2grid/gau2grid-2.0.7-intel-2022a-lmax-5-psi4.eb
	new file:   m/mctc-lib/mctc-lib-0.3.1-GCC-11.2.0.eb
	new file:   m/msgpack/msgpack-1.0.5-GCCcore-11.3.0.eb
	new file:   p/Pint/Pint-0.20.1-GCCcore-11.3.0.eb
	new file:   p/pydantic/pydantic-1.10.6-GCCcore-11.3.0.eb
	new file:   q/qcengine/qcengine-0.24.1-foss-2021b.eb
	new file:   q/qcengine/qcengine-0.24.1-psi4.patch
	new file:   q/qcengine/qcengine-0.26.0-foss-2021b.eb
	new file:   q/qcengine/qcengine-0.26.0-psi4.patch
	new file:   s/simple-dftd3/simple-dftd3-0.7.0-foss-2021b.eb
	deleted:    c/CheMPS2/CheMPS2-1.8.9-intel-2021a.eb
2023-03-13 17:11:24 +01:00

21 lines
1.3 KiB
Diff

From: Alexander Grund <Flamefire@users.noreply.github.com>
Date: Mon, 5 Dec 2022 17:03:50 +0100
[PATCH] Prepend psiimport path instead of overwriting `$PYTHONPATH`
When `psi4` binary is found but the Python package is not we should not overwrite the `$PYTHONPATH` before importing `psi4` as that may cause other required packages to be not found anymore. Hence prepend it. See #292
---
diff --git a/qcengine-0.24.1.orig/qcengine/programs/psi4.py b/qcengine-0.24.1/qcengine/programs/psi4.py
index 7dd4d5e..437cdea 100644
--- a/qcengine-0.24.1.orig/qcengine/programs/psi4.py
+++ b/qcengine-0.24.1/qcengine/programs/psi4.py
@@ -66,7 +66,9 @@ class Psi4Harness(ProgramHarness):
if psiapi and not psithon:
psiimport = str(Path(which_import("psi4")).parent.parent)
env = os.environ.copy()
- env["PYTHONPATH"] = psiimport
+ pythonpath = env.get("PYTHONPATH")
+ # Prepend psiimport to $PYTHONPATH (carefull if it's empty/unset)
+ env["PYTHONPATH"] = os.pathsep.join([psiimport, pythonpath] if pythonpath else [psiimport])
with popen(["python", "-c", "import psi4; print(psi4.executable[:-5])"], popen_kwargs={"env": env}) as exc:
exc["proc"].wait(timeout=30)
os.environ["PATH"] += os.pathsep + exc["stdout"].split()[-1]