Pip

Question or issue on macOS:

Homebrew Pip

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

色々とチェックが入った後、実際に変更を行う前にパスワードを聞いてきます、/usr/local 以下にしか変更をしようとしていないかどうか軽く確認してから、パスワードを与えてあげ. Installs (30 days) brew-pip: 14: Installs on Request (30 days) brew-pip: 14: Build Errors (30 days) brew-pip: 0: Installs (90 days) brew-pip: 57: Installs on Request (90 days). Homebrew is the package management tool for the macOS. We can use Homebrew in order to install Python and pip. Pip is provided with the python package. We will use brew command with the install command like below. $ brew install python. Add brew-pip.rb for Homebrew installation Can accept local source distributions for installation v0.2.0 (2011-12-25) Use pip directly, instead of creating temporary formula files. Alternatively, since pgcli is a python package you can install it via the python package manager pip. There is also an older package manager known as easyinstall but it is replaced by pip. Check if pip is installed on the system. $ which pip If the above command returns an error, then you do not have pip.

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.

How to solve this problem?

Solution no. 1:

Homebrew Pip Upgrade

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.

Solution no. 2:

Since you need compile many of these packages, it is not the simplest task on the Mac. I would recommend to use a distribution like Anaconda. It is free, comes with all the things you need and has a simple installer. It will save you a lot of hassle because all components work together.

Solution no. 3:

Brew does not have a clean matplotlib port; the port that brew search matplotlib finds is for python2, not python3.

However, Brew’s python3 installation recommends that pip3 be used to install python3 packages. This installs the Python3 packages into /usr/local/lib/python3.3/site-packages. I think that Brew’s approach may be better than MacPort’s, as with MacPorts I am constantly having MacPorts update python packages that don’t need to be updated, and it’s tracking of each python version independently of python is somewhat confusing to me.

However, pip3 now complains on installing matplotlib, saying that it is externally hosted which is a security vulnerability and will be disabled in the future.

Solution no. 4:

Edit: IMHO virtualenv and virtualenvwrapper have now been largely supplanted by the superb combination of pyenv and pipenv which combine to provide wonderfully isolated python version and dependency management. It makes it worth considering setting up dummy projects even if you want to just play around with various python packages. Dependencies are tracked stably and pipenv includes functionality for checking package updates and security issues. I’d highly recommend a switchover.

Consider managing your python packages in dedicated virtualenvs. You can install any non-python dependencies (freetype which is required by matplotlib) using Homebrew, but you may ultimately have fewer headaches managing your python packages using pip within a virtualenv

If you are using the system python, you can install matplotlib like so. Powerpoint to indesign. I’m assuming you want to place the virtualenv at top level of your home directory, so the first line in the listing below may be different if you want to create the virtualenv elsewhere and you’ll need to adjust the remaining lines accordingly.

If /usr/local/include/freetype2 exists but /usr/local/include/freetype doesn’t you will need to create a symlink from freetype2 to freetype to prevent errors when installing the matplotlib package

Finally, you can install matplotlib using pip.
pip install matplotlib

Install Pip With Brew

Any applications run from the previously created virtualenv will be able to import matplotlib.

Should you decide to use virtualenvs extensively, you may want to take a look at virtualenvwrapper which provide very nice functionality for managing multiple virtualenvs and switching between them.

Hope this helps!

The Homebrew package manager may be used on Linux and Windows Subsystem for Linux (WSL). Homebrew was formerly referred to as Linuxbrew when running on Linux or WSL. It can be installed in your home directory, in which case it does not use sudo. Homebrew does not use any libraries provided by your host system, except glibc and gcc if they are new enough. Homebrew can install its own current versions of glibc and gcc for older distributions of Linux.

Features, installation instructions and requirements are described below. Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is explained in the documentation. Bbo sports twitter.

Features

Homebrew Pipe

  • Can install software to your home directory and so does not require sudo
  • Install software not packaged by your host distribution
  • Install up-to-date versions of software when your host distribution is old
  • Use the same package manager to manage your macOS, Linux, and Windows systems

Install

Instructions for a supported install of Homebrew on Linux are on the homepage.

The installation script installs Homebrew to /home/linuxbrew/.linuxbrew using sudo if possible and in your home directory at ~/.linuxbrew otherwise. Homebrew does not use sudo after installation. Using /home/linuxbrew/.linuxbrew allows the use of more binary packages (bottles) than installing in your personal home directory.

The prefix /home/linuxbrew/.linuxbrew was chosen so that users without admin access can ask an admin to create a linuxbrew role account and still benefit from precompiled binaries. If you do not yourself have admin privileges, consider asking your admin staff to create a linuxbrew role account for you with home directory /home/linuxbrew.

Follow the Next steps instructions to add Homebrew to your PATH and to your bash shell profile script, either ~/.profile on Debian/Ubuntu or ~/.bash_profile on CentOS/Fedora/Red Hat.

You’re done! Try installing a package:

If you’re using an older distribution of Linux, installing your first package will also install a recent version of glibc and gcc. Use brew doctor to troubleshoot common issues.

Requirements

  • GCC 4.7.0 or newer
  • Linux 2.6.32 or newer
  • Glibc 2.13 or newer
  • 64-bit x86_64 CPU

Paste at a terminal prompt:

Debian or Ubuntu

Fedora, CentOS, or Red Hat

ARM

Install pip with brew

Homebrew can run on 32-bit ARM (Raspberry Pi and others) and 64-bit ARM (AArch64), but no binary packages (bottles) are available. Support for ARM is on a best-effort basis. Pull requests are welcome to improve the experience on ARM platforms.

You may need to install your own Ruby using your system package manager, a PPA, or rbenv/ruby-build as we no longer distribute a Homebrew Portable Ruby for ARM.

32-bit x86

Homebrew does not currently support 32-bit x86 platforms. It would be possible for Homebrew to work on 32-bit x86 platforms with some effort. An interested and dedicated person could maintain a fork of Homebrew to develop support for 32-bit x86.

Homebrew Pip2

Alternative Installation

Homebrew Pipestone

Extract or git clone Homebrew wherever you want. Use /home/linuxbrew/.linuxbrew if possible (to enable the use of binary packages).

Homebrew on Linux Community