How to install scipy with pip3?

Solution 1:

It's telling you exactly what you need to do: install all those build dependencies.

Before I get there, I've said a few times before that I generally don't recommend people use pip (or pip3) to install packages into their global Python install. Both pip and apt-get are completely oblivious to each other. Files can be unduly overwritten or removed and because much of your operating system depends on your Python environment working, messing with it isn't a good idea.

So I would recommend either using a virtualenv (where you keep everything separate from the system) or only using repository-deployed packages.

That said, the technical reason you can't install is because SciPy needs to compile a load of stuff and it has external dependencies for a lot of that. These need to be fulfilled. You could do this manually (by reading the error) or in this case where there is a repo version, you could ask Apt to install the build dependencies:

sudo apt-get build-dep python3-scipy

And that will install a metric butt-load of packages. Note that some of these will probably be things you've already wedged in with pip. I'm seeing a lot of numpy stuff. Beware.

And you'd still need to go through a similar process if you're building in a virtualenv but I would recommend against using apt to fulfil your dependencies because you'll probably have differing versions of dependencies. That's not a healthy build recipe.

In short, using the repo version is easiest.

You could also try

sudo apt-get install python3-scipy