I need to install numpy 1.9 ('cause some methods are available in this version, not in the previous) which isn't the numpy package proposed yet today (apt-get returns 1.8).

How to install the latest version of numpy, scipy, scikit and parallel python? I'm quite new to manage unusual install (using tar.gz?). My guess:

  • download the latest package and unpack them somewhere (how to do that and in which folder?)
  • adding some Personal Package Archives (PPA), but which one and how to do that sudo add-apt-repository ppa:<name of the ppa>? I tried but I have now some errors (connexion error to access ppa)

Thanks for your incoming help.

up vote 2 down vote accepted

You need a custom Python environment? Build a custom Python environment. It's easy.

sudo apt-get install python-virtualenv

# cd to wherever you want to keep your distribution

# create it
virtualenv --no-site-packages virtualenv

# activate it
source ./virtualenv/bin/activate

pip install numpy scipy scikit-learn

You'd install all your other requirements in there too. You also have to make sure your scripts use the virtualenv too. If you're calling them globally, that can just mean making sure they're called with this /path/to/virtualenv/bin/python instead of your system version.

Or if they're called from a Bash script, you can call the activation script and your path will be updated automatically.

There is a strong argument against using pip in your global site-packages. Apt won't respect it. It won't respect Apt. They will trample over each other and can cause serious issues, especially if you accidentally upgrade a system package that isn't backwards compatible.

It seems easy to begin with but it's not a long-term solution.

  • I was looking for a canonical answer on virtualenvs, couldn't find one. Could you make one? – muru Oct 21 '14 at 8:29
  • askubuntu.com/a/21031/449 – Oli Oct 21 '14 at 8:30
  • Nope, saw that (even linked to it in a comment on the question). But it doesn't say how to set one up (like this answer), good practices, things to avoid, etc. – muru Oct 21 '14 at 8:33
  • can you choose the python version? All the script I will run will use that python or do I need to launch them from that folder? – sol Oct 21 '14 at 8:38
  • The version of Python is selected when you create your virtualenv. So (just for example) you could create a virtualenv with Pypy and then /path/to/virtualenv/bin/python would link to a Pypy version. The same goes for other versions of Python. Install virtualenv for that version, call it to create a virtualenv, done. The confusing bit is switching between distributions with activate and deactivate. – Oli Oct 21 '14 at 8:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.