2

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.

anonymous2
  • 4,298
sol
  • 135

1 Answers1

2

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.

Oli
  • 293,335
  • I was looking for a canonical answer on virtualenvs, couldn't find one. Could you make one? – muru Oct 21 '14 at 08:29
  • http://askubuntu.com/a/21031/449 – Oli Oct 21 '14 at 08: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 08: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 08: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 08:49
  • In my case installing numpy and scipy inside a virtualenv works well, but it fails with scikit-learn because the package still tries to install things at the system level! I get PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.4/site-packages' – Christophe Oct 19 '16 at 16:04