Hi all,

I was at SC last week, and many people shared interests in our setup for python, in particular the fact that we manage to support multiple versions of Python for the same module. I thought I would share our solution here.

1) We do not define PYTHONPATH. PYTHONPATH is too intrusive, and it is not python-version aware. In your PYTHONPATH contains packages for python 2.7, it won't work with python 3.5 and vice versa.

2) Instead, we define EBPYTHONPREFIXES  (our made up environment variable name), which points to the prefix directory.

3) We have a file called sitecustomize.py   (that's standard python) which contains the following logic (and a bit more that is not relevant for this crowd since it is related to our nix layer):

        if "EBPYTHONPREFIXES" in os.environ:
            for prefix in os.environ["EBPYTHONPREFIXES"].split(os.pathsep):
                sitedir = os.path.join(prefix, postfix)
                if os.path.isdir(sitedir):
                    site.addsitedir(sitedir)


4) In the modules, we install the python packages for all versions of python (currently only 2.7 and 3.5, but soon 3.6) under their typical "lib/pythonX.Y/site-packages" folders.


For examples recipes that use this :

https://github.com/ComputeCanada/easybuild-easyconfigs/blob/computecanada-master/easybuild/easyconfigs/i/igraph/igraph-0.7.1-iomkl-2016.4.11.eb

https://github.com/ComputeCanada/easybuild-easyconfigs/blob/computecanada-master/easybuild/easyconfigs/o/OpenMM/OpenMM-7.1.1-iomkl-2016.4.11.eb


Maxime

Reply via email to