4

so I am working on a shared computer. It is a workhorse for computations across the department. The problem we have run into is controlling versions of imported modules. Take for example Biopython. Some people have requirements of an older version of biopython - 1.58. And yet others have requirements for the latest biopython - 1.61. How would I have both versions of the module installed side by side, and how does one specifically access a particular version. I ask because sometimes these apis change and break old scripts for other people (or they expect certain functionality that is no longer there).

I understand that one could locally (i.e. per user) install the module and specifically direct python to that module. Is there another way to handle this? Or would everyone have to create an export PYTHONPATH before using?

4
  • 2
    virtualenv will let you install whatever modules you want in a local directory. It would seem to sort your problem, albeit at the expense of disk space. Commented Mar 20, 2013 at 16:39
  • virtualenv will use a very small amount of extra space compared to installing multiple separate python interpreters. Commented Mar 20, 2013 at 16:41
  • There's also the "modules" system. You see it a lot in parallel environments to set up different compilers, etc. Commented Mar 20, 2013 at 16:47
  • 1
    I am curious about this "modules" system. To what exactly are you referring? Commented Mar 20, 2013 at 18:23

2 Answers 2

2

I'm not sure if it's possible to change the active installed versions of a given module. Given my understanding of how imports and site-packages work, I'm leaning towards no.

Have you considered using virtualenv though ?

With virtualenv, you could create multiple shared environments -- one for biopython 1.58 , another for 1.61 , another for whatever other special situations you need. They don't need to be locked down to a particular user, so while it would take more space than what you desired, it could take less space than everyone having their own python environment.

Sign up to request clarification or add additional context in comments.

Comments

1

It sounds like you're doing scientific computing. You should use Anaconda, and make particular note of the conda tool, documented here.

Conda uses hard links whenever possible to avoid copies of the same files. It also manages non-python binary modules in a much better way than virtualenv (virtualenv chokes on VTK, for example).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.