0

I run OSX Yosemite on a macbook air. I have python3 installed, as well as the apple developer package. I am trying to install modules like ones I have installed already including matplotlib. Basically when I try to install scientific python packages like SciPy, Ginga, AstroPy, iPython, etc, I get this in the terminal after attempting a pip install:

-bash: pip: command not found

So I attempt at downloading the tarball if provided and I follow the instructions to install that way as guided by the website and the README files, and I still get errors. For instance, in this astropy tarball, it states to run python setup.py install from the directory and this is what happens:

jesses-Air:astropy-1.0 jessehanowell$ python setup.py install
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-

install-632.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.

It says the same thing for a "python3 setup.py install" command as well. Keep in mind I have python3 installed and Yosemite still runs on python v2.4.7, and I am running the terminal from the downloads directory, where the files are located. Maybe I have to change the file unzipped files to a new location? But basically I am disappointed because I really want to learn to use these packages. I know if my friend was able to install matplotlib that I should be able to install these.

So is there a way to restore pip to my computer and install that way? Or can someone point out the obvious thing I am doing incorrectly? Thanks for the assistance folks!

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
11thZone
  • 71
  • 3
  • 10
  • [Homebrew installs pip](http://docs.python-guide.org/en/latest/starting/install/osx/) when you install python with `brew install python`. – krock Feb 22 '15 at 00:43
  • I have python3 running on the mac. Why would I need to reinstall python? – 11thZone Feb 22 '15 at 00:47
  • if you installed python or python3 using homebrew, you would have pip installed. Looks like pip wasn't installed when python(3) was. – krock Feb 22 '15 at 00:52
  • Run `python setup.py install --user`. Also, the pip command not found means you have to [install pip first](https://pip.pypa.io/en/latest/installing.html), which would be your best course of action. Even better, just use homebrew, because setting up configuration for the packages yourself might be a hassle. – pv. Feb 22 '15 at 00:53
  • I used pip3 and it worked! – 11thZone Feb 22 '15 at 00:56
  • "Yosemite still runs on python v2.4.7" <-- for what it's worth (and I know the OP isn't trying to), never ever *ever* use the Python that comes installed with OSX. It is there for the use of some built-in software and is not meant to be or functional as a normal Python distribution for users. – Iguananaut Feb 23 '15 at 14:51

2 Answers2

3

For anyone reading some of the other replies, I should emphasize that you should not use sudo to bypass the permission error - instead, run the install command with:

python setup.py install --user

This will install packages to Library in your home directory.

In general, I would actually recommend using the Anaconda Python Distribution to install a Scientific Python distribution on Mac (it includes Numpy, SciPy, Astropy, etc. by default).

astrofrog
  • 32,883
  • 32
  • 90
  • 131
-1

Permission denied problems usually mean you need to prefix the command with sudo.

Here's a post I did that includes installing python with homebrew:

https://rlkamradt.wordpress.com/2015/02/14/setting-up-a-development-environment-on-a-mac-languages/