Search code examples
pythonpython-2.7pelican

Python pip broken - installing Pelican


I'm trying to install Pelican for python using pip install pelican, but I get these errors. I use Python 2.7.9 bundled with Mac OSX

Exception:
    Traceback (most recent call last):
      File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg    >/pip/basecommand.py", line 211, in main
        status = self.run(options, args)
      File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg
/pip/commands    /install.py", line 311, in run
    root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req
/req_set.py", line 646, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req
/req_install.py", line 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req
/req_install.py", line 998, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", 
line 339, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", >line 310, in clobber
    ensure_dir(destdir)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils
/__init__.py", line 71, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pelican'
Evens-MacBook-Pro:~ even$ 

Solution

  • Modifying the system-level installation of Python (or Ruby, or Perl...) can turn into a mess, and I have had my work there trashed in the past by system updates. Apple doesn't really guarantee your local changes will be preserved after an OS update.

    You are likely better off installing your own versions using something like Homebrew, which installs into /usr/local.

    Homebrew has Python 2.x and 3.x available (and they can co-exist very well). It keeps up with new releases better than Apple does. Homebrew also has many other Unix things that you may or may not find useful.

    After installing Homebrew, installing Python is simple:

    brew install python
    brew install python3
    

    Make sure /usr/local/bin is early in your $PATH. It also provides you with pip and pip3 to install Python package for both 2.x and 3.x.