0

For a scientific application, I need to use specific versions of the Python packages numpy, scipy, and brian2. I've installed the correct versions on my laptop and run their test suites as follows:

>>> import numpy as np
>>> import scipy
>>> import brian2
>>> np.test()
>>> scipy.test()
>>> brian2.test()

All the tests pass.

Now I'd like to do the same thing on my lab's computing cluster. I've again installed all the correct versions. However, in this new environment, only the numpy and brian2 tests pass. For scipy, a single test fails:

====================================================================== 
FAIL: test_decomp_update.TestQRdelete_f.test_delete_last_p_col
----------------------------------------------------------------------     
Traceback (most recent call last):   File
"/usr/local/anaconda/lib/python2.7/site-packages/nose/case.py", line
197, in runTest
    self.test(*self.arg)   File "/home/despo/dbliss/lib/python2.7/site-packages/scipy/linalg/tests/test_decomp_update.py",
line 328, in test_delete_last_p_col
    assert_unitary(q1)   File "/home/despo/dbliss/lib/python2.7/site-packages/scipy/linalg/tests/test_decomp_update.py",
line 21, in assert_unitary
    assert_allclose(aTa, np.eye(a.shape[1]), rtol=rtol, atol=atol)   File
"/home/despo/dbliss/.local/lib/python2.7/site-packages/numpy/testing/utils.py",
line 1297, in assert_allclose
    verbose=verbose, header=header)   File "/home/despo/dbliss/.local/lib/python2.7/site-packages/numpy/testing/utils.py",
line 665, in assert_array_compare
    raise AssertionError(msg) AssertionError:  Not equal to tolerance rtol=0.0001, atol=2.38419e-07

(mismatch 100.0%)  x: array([[  9.999999e-01,   1.746230e-08, 
-1.490116e-08,   1.490116e-08,
         -6.146729e-08,  -6.332994e-08,   3.352761e-08,   7.450581e-08,
          3.352761e-08,   2.142042e-08,  -4.097819e-08,   4.656613e-08],...  y: array([[ 1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
       [ 0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
       [ 0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],...

---------------------------------------------------------------------- 
Ran 18599 tests in 253.381s

FAILED (KNOWNFAIL=97, SKIP=1165, failures=1)

Seemingly, the only relevant difference between my computing cluster and my laptop are the versions of Python they're running. My laptop has version 2.7.6, whereas the cluster has 2.7.10.

My question is, how can I install version 2.7.6 locally on the cluster (i.e., local to my account), and then use that version when I open IPython?

2
  • Are you using the anaconda distribution of python on your laptop? Oct 7, 2015 at 19:52
  • @MarkWagner no, i'm using whatever comes with ubuntu by default.
    – abcd
    Oct 7, 2015 at 20:22

1 Answer 1

1

Direct answer to your question: use virtualenv as explained here: https://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv

However, your conclusion is probably incorrect because numpy, scipy, and brian2 depend on many other bits of the system, not just the version of python, and those bits are probably different too.

What you should be doing is using the numpy and scipy that came with the anaconda python distribution, as those presumably have been tested. brian2 isn't included. You'll have to test that yourself.

5
  • your second paragraph is dead on, but your third isn't. for many reasons that aren't worth getting into, i can't use the versions of numpy and scipy that came with anaconda. to give one reason, i need a function that was introduced in the last month in the development version of scipy. i think what i need to do is investigate the failures i'm getting and try to work out why i'm getting them in certain situations and not others. i also need to figure out whether there is a version of scipy in particular that has what i need but isn't associated with test failures.
    – abcd
    Oct 7, 2015 at 21:51
  • Yeah, I suspected as much. You're on the bleeding edge and you got cut. :) I was hoping to save you the pain of managing an entire python installation. Oct 7, 2015 at 21:56
  • i looked a little further into this, and the discrepancy between my laptop and the cluster seems not to have to do with python, per se, but with the C code used in certain areas of scipy. do you know scipy well? i'm wondering how i might inspect what C-related software my laptop is using as compared to what the cluster is using. i'm wondering whether there's a difference in the version of the underlying C code or C compiler.
    – abcd
    Oct 7, 2015 at 22:41
  • see this follow-up question.
    – abcd
    Oct 7, 2015 at 22:49
  • also, for what it's worth, there is a version of brian2 available as a conda package.
    – abcd
    Oct 8, 2015 at 1:25

You must log in to answer this question.

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