1

I'm very fresh on linux, so there might be some obvious misssteps in what follows.

I've freshly installed the last Ubuntu LTS version yesterday, and also pyCharm (Python editor). I went on updating the scipy-stack following the command on their website:

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

However, now in pyCharm, I observe that scipy is not updated. Turn's out that there's several python installations available:

$ sudo ls /usr/bin/python*
/usr/bin/python        /usr/bin/python2-config  /usr/bin/python3m
/usr/bin/python2       /usr/bin/python3     /usr/bin/python-config
/usr/bin/python2.7     /usr/bin/python3.4       /usr/bin/pythontex
/usr/bin/python2.7-config  /usr/bin/python3.4m      /usr/bin/pythontex3

$ which python
/usr/bin/python

I'd like to use python2.7 as my main/standard python reference, and also update its packages. How do I accomplish that?

  • python2.7 is the default python. All those packages you installed are for Python 2.7 (Python 3.X packages are named python3-.... – muru Nov 12 '15 at 13:09
  • @muru my pCharm is using the 2.7 python, and it displays scipy to have version 0.13.3. – FooBar Nov 12 '15 at 13:13
  • Which is the version of scipy in the repos: packages.ubuntu.com/trusty/python-scipy. – muru Nov 12 '15 at 13:14
2

There are actually only two python installations by default. 2.7 and 3.4 here. All the python-* packages are built for Python 2.7. All the python3-* packages are built for Python 3.4.

What you are noticing with the version of scipy has nothing to do with the general layout of these Python installations, it's about how Ubuntu works. Ubuntu won't update every package for every update its developers push out. It only updates packages when there are security releases or things that make it drastically better. This provides stability for developer who don't want API/ABI changes on systems they've deployed.

I suspect you actually don't want to be using Ubuntu's Python system at all, rather you want to use a virtualenv. These use the system's python (or python3) binary but you get to own the rest of the environment (site-packages, etc). This gives you near-total flexibility to install whatever versions of whatever from pip, without needing root, without trampling over system-managed files.

Normally this is a case of creating a virtualenv, "activating" it and then installing your packages:

virtualenv /path/to/venv  # or python3 -mvenv /path/to/venv
source /path/to/venv/bin/activate
pip install -U pip  # update pip
pip install -U numpy scipy matplotlib ipython ipython-notebook pandas sympy nose

Note the names of these packages might not be correct above, pip will tell you.

Also note that you'll likely run into a few errors about missing build dependencies. Packages you download from Ubuntu that need compilation (most of these computation packages) have been pre-compiled. You'll need to meet their dependencies. A dirty way of doing this is to use apt-get build-dep for the Ubuntu versions. If the dependencies between the Ubuntu and PyPi versions have deviated, you may have to install other things. See the docs for that project to find out what you need.

sudo apt-get build-dep python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Tediously, this will install build-deps for both Python 2 and 3 but it's only disk space, right? :) You can fulfil the dependencies manually if you'd rather.

  • Thank you for the extensive answer, which pinpointed the underlying issue. I ran into problems with compiling my own packages, so I used anaconda which took over all that hassle. – FooBar Nov 12 '15 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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