Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use brew or pip for installing matplotlib?

I am using Mac OSX 10.8, previously I used macports, but I switched to brew.

Snows-MacBook-Pro:~ Mac$ brew search matplotlib
samueljohn/python/matplotlib

Snows-MacBook-Pro:~ Mac$ pip search matplotlib
matplotlib                - Python plotting package

So my question is easy. Should I use brew or pip for installing matplotlib ? Is there any difference and what ?

My goal is to have pandas, ipythone notebook and simpleCV up and running.

like image 448
WebOrCode Avatar asked Jun 03 '13 11:06

WebOrCode


People also ask

Is pip the same as brew?

pip is a packager for the python world - you should only ever be able to install python-things with it; homebrew is a package manager targetted at OSX; it doesn't impose any restrictions onto what software you can install with it - since python is a subset of software.

Where do I install matplotlib?

If you are using the Python version that comes with your Linux distribution, you can install Matplotlib via your package manager, e.g.: Debian / Ubuntu: sudo apt-get install python3-matplotlib. Fedora: sudo dnf install python3-matplotlib. Red Hat: sudo yum install python3-matplotlib.


1 Answers

I recommend using a package manager (brew, indeed, or MacPorts). Here are a few reasons why:

  • If you use your package manager (MacPorts, brew,…) to later install additional programs that depend on Matplotlib, the package manager will install it regardless.

  • If you install a Python package via pip, and pip installs it in your package manager tree (MacPorts, brew,…), the package manager might complain. For example, MacPorts does not want to erase pip-installed packages, as a precaution, so compilation stops when MacPort detects that someone walked on its turf. The best way of installing Python packages is to first check if they are provided by your package manager, and then only install them with pip if they are not.

  • Compilation with pip sometimes fails where a package manager (MacPorts,…) has no problem: package managers are simply more powerful and general tools (they play nicely with required compiled libraries, for instance).

  • I would not recommend using a separate distribution of Matplotlib, for the same kind of reasons: any program from brew that depends on Matplotlib will install it anyway. Furthermore, if you instead want to install such a program without your package manager, it is generally hard to make it work with a specific distribution of Matplotlib (they might need libraries to be installed of top of it, etc.).

In summary, I would recommend to use one system for everything (brew, since this is what you chose), and pip for things that this system does not provide (just make sure that the pip you use corresponds to where you want things to go: your package manager's Python library, with the right version, or the OS-provided Python,…). Multiplying tools and installs is too messy, in my experience, as various distributions/package managers/etc. are usually not meant to play well with each other.

like image 117
Eric O Lebigot Avatar answered Sep 21 '22 16:09

Eric O Lebigot