add cpackage path to sys.path
@@ -10,9 +10,17 @@ import imp
import time
import json
import os
-import tensorflow as tf
+import sys
import numpy as np
+# We have to augment search paths manually before importing TF
+# otherwise standard paths prepend ones from PYTHONPATH in `sys.path`
+# and pip-installed TF is loaded instead of ck-installed one
+for p in os.getenv('PYTHONPATH', '').split(':'):
+ sys.path.insert(0, p)
+
+import tensorflow as tf
+
MODEL_MODULE = os.getenv('CK_ENV_TENSORFLOW_MODEL_MODULE')
MODEL_WEIGHTS = os.getenv('CK_ENV_TENSORFLOW_MODEL_WEIGHTS')
MODEL_WEIGHTS_ARE_CHECKPOINTS = os.getenv('CK_ENV_TENSORFLOW_MODEL_WEIGHTS_ARE_CHECKPOINTS') == 'YES'
