If there is already a python package on the machine then it will be used instead of the package in the pex
sys.path.append(str(path_entry)) should be replaced with sys.insert(0, str(path_entry))
example:
import numpy as np
print(np.file)
output should be:
'/root/.cache/pants_jupyter_plugin/pex/venvs/af9ad1d89fc2fa245423d7cf55e8918e657a1e3b/5e00e7661f4f5acffe541d6d332efbd8d39ea6b1.pex/lib/python3.7/site-packages/numpy/init.py'
but is instead:
'/usr/local/lib/python3.7/site-packages/numpy/init.py'