3

I'm trying to configure a RHEL6 server to allow multiple users to run multiple versions of Python, multiple versions of various python modules, and multiple versions of various other programs (e.g. gcc). I believe the appropriate way to do this is to use environment-modules and virtualenv. I'm familiar with virtualenv, but I'm confused about using environment-modules.

I installed Python 2.7.3 with:

# ./configure --prefix=/usr/local
# make && make altinstall

and I can easily enough run Python 2.7.3 with:

/usr/local/python-2.7

I thought I could simply use my module file to preprend my PATH environment variable with /usr/local/python-2.7 but there is not python binary in /usr/local/python-2.7, only a binary called python-2.7.

Am I missing something? How do I use an environment-modules module file to use Python 2.7?

2 Answers 2

1

If you run it using /usr/local/python-2.7 then the directory to include in your PATH would be /usr/local which is undesirable.

You should do something like this:

rm /usr/local/python-2.7
mkdir -p /usr/local/python-2.7
./configure --prefix=/usr/local/python-2.7
make && make altinstall

Then you can do:

PATH=/usr/local/python-2.7:$PATH

or the environment-modules equivalent. Then it can be run without specifying the directory:

python-2.7

In order to run it directly, then, you'd do this:

/usr/local/python-2.7/python-2.7
2
  • I see, I just needed to push the Python install in one more directory. I'll give it a shot now. Thanks. Nov 14, 2013 at 23:53
  • Still had to add a python -> python-2.7 softlink, but now everything works as expected. Nov 15, 2013 at 18:02
0

You should take a look at VirtualEnv, it's a python tool made to do address exactly what you're looking for.

Python - VirtualEnv

4
  • Sure, virtualenv does what I need inside Python as mentioned in the question, but I'm talking about multiple versions of Python (and gcc, other misc tools) on the same server, which is what environment-modules is for. It's confusing because Python uses 'modules' and virtualenv lets you manage different versions of python modules, but environment-modules also uses 'modules' to manage different versions of applications and is entirely unrelated to python modules. Nov 14, 2013 at 16:54
  • If I correctly understand your needs, it more than just the python environment that you need to look at but rather a system-wide solution like Docker docker.io, let me know if my assumption is correct.
    – Dr I
    Nov 15, 2013 at 8:52
  • Docker does look interesting, I'll keep an eye on it Nov 15, 2013 at 18:01
  • @DylanHettinger, yeah, its a new way to work with old tools named LXC, it is mostly a high level unified command liner and APIs for LXC indeed with some really interesting implements for Chief/Puppet Master and Heath OpenStack Orchestrators. If you're looking for a WebAdmin dashboard, there is Shipyard that I like :D
    – Dr I
    Nov 18, 2013 at 10:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .