Python site-packages permission denied?

Discussion in 'Python' started by Shane Neeley, Mar 7, 2012.

  1. Shane Neeley

    Shane Neeley Guest

    What do I need to do to successfully install a package onto python so that I can use it as a module?

    I have tried in terminal in the correct directory "python2.7 ./setup.py install" but it says permission denied.

    Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python2.7.1 ./setup.py install
    -bash: python2.7.1: command not found
    Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python ./setup.py install
    running install
    running build
    running build_py
    running install_lib
    copying build/lib/urllib2_file.py -> /Library/Python/2.7/site-packages
    error: /Library/Python/2.7/site-packages/urllib2_file.py: Permission denied
    Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$
     
    Shane Neeley, Mar 7, 2012
    #1
    1. Advertising

  2. Shane Neeley

    Chris Rebert Guest

    On Wed, Mar 7, 2012 at 1:02 PM, Shane Neeley <> wrote:
    > What do I need to do to successfully install a package onto python so that I can use it as a module?
    >
    > I have tried in terminal in the correct directory "python2.7 ./setup.py install" but it says permission denied.
    >
    > Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python2.7.1 ./setup.py install
    > -bash: python2.7.1: command not found
    > Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python ./setup.py install
    > running install
    > running build
    > running build_py
    > running install_lib
    > copying build/lib/urllib2_file.py -> /Library/Python/2.7/site-packages
    > error: /Library/Python/2.7/site-packages/urllib2_file.py: Permission denied
    > Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$


    You generally shouldn't mess with Mac OS X's system copies of Python.
    Typically, one installs a separate copy using MacPorts, Fink, or
    whatever, and uses that instead.
    In any case, you generally need to `sudo` when installing stuff system-wide.

    Cheers,
    Chris
     
    Chris Rebert, Mar 7, 2012
    #2
    1. Advertising

  3. Shane Neeley

    Ned Deily Guest

    In article
    <>,
    Chris Rebert <> wrote:
    > You generally shouldn't mess with Mac OS X's system copies of Python.
    > Typically, one installs a separate copy using MacPorts, Fink, or
    > whatever, and uses that instead.


    I don't understand what you mean by "mess with". Certainly one should
    not attempt alter standard library modules provided with the system
    Python but adding additional packages is fully supported. Apple
    conveniently provides a special directory in user-controlled space
    (/Library/Python) as the default location for Distutils-based installs.
    They even provide versions of easy_install for the system Pythons.

    --
    Ned Deily,
     
    Ned Deily, Mar 8, 2012
    #3
  4. On Wed, 07 Mar 2012 21:47:37 -0800, Ned Deily wrote:

    > In article
    > <>,
    > Chris Rebert <> wrote:
    >> You generally shouldn't mess with Mac OS X's system copies of Python.
    >> Typically, one installs a separate copy using MacPorts, Fink, or
    >> whatever, and uses that instead.

    >
    > I don't understand what you mean by "mess with". Certainly one should
    > not attempt alter standard library modules provided with the system
    > Python but adding additional packages is fully supported.


    I read Chris as making a general comment that one should be cautious
    about making changes to the system copy of Python, advice that holds for
    all OSes not just OS-X.


    > Apple
    > conveniently provides a special directory in user-controlled space
    > (/Library/Python) as the default location for Distutils-based installs.
    > They even provide versions of easy_install for the system Pythons.


    Perhaps so, but it seems to have the permissions messed up, or some other
    problem, because the OP can't write to it. His error is:

    copying build/lib/urllib2_file.py -> /Library/Python/2.7/site-packages
    error: /Library/Python/2.7/site-packages/urllib2_file.py:
    Permission denied


    I note also that Chris' final comment was:

    "In any case, you generally need to `sudo` when installing stuff system-
    wide."

    which is probably the solution the OP is looking for.



    --
    Steven
     
    Steven D'Aprano, Mar 8, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hudson
    Replies:
    0
    Views:
    464
    Hudson
    Nov 3, 2004
  2. Replies:
    3
    Views:
    1,476
    Steve Holden
    Mar 6, 2005
  3. Mark E. Hamilton
    Replies:
    0
    Views:
    371
    Mark E. Hamilton
    Oct 18, 2005
  4. David Lyon
    Replies:
    19
    Views:
    596
    David Lyon
    Apr 24, 2009
  5. Piet L.
    Replies:
    1
    Views:
    155
    Brian McCauley
    Feb 24, 2005
Loading...

Share This Page