Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21344 > unrolled thread

Python site-packages permission denied?

Started byShane Neeley <shane.neeley@gmail.com>
First post2012-03-07 13:02 -0800
Last post2012-03-08 11:34 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Python site-packages permission denied? Shane Neeley <shane.neeley@gmail.com> - 2012-03-07 13:02 -0800
    Re: Python site-packages permission denied? Chris Rebert <clp2@rebertia.com> - 2012-03-07 13:30 -0800
    Re: Python site-packages permission denied? Ned Deily <nad@acm.org> - 2012-03-07 21:47 -0800
      Re: Python site-packages permission denied? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-08 11:34 +0000

#21344 — Python site-packages permission denied?

FromShane Neeley <shane.neeley@gmail.com>
Date2012-03-07 13:02 -0800
SubjectPython site-packages permission denied?
Message-ID<5849344.1361.1331154163099.JavaMail.geo-discussion-forums@pbls8>
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$ 

[toc] | [next] | [standalone]


#21348

FromChris Rebert <clp2@rebertia.com>
Date2012-03-07 13:30 -0800
Message-ID<mailman.488.1331155826.3037.python-list@python.org>
In reply to#21344
On Wed, Mar 7, 2012 at 1:02 PM, Shane Neeley <shane.neeley@gmail.com> 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

[toc] | [prev] | [next] | [standalone]


#21372

FromNed Deily <nad@acm.org>
Date2012-03-07 21:47 -0800
Message-ID<mailman.502.1331185676.3037.python-list@python.org>
In reply to#21344
In article 
<CAMZYqRTXy3mSMXtivuE8ApYX2ZFAG3DQp1UN+fqWnAYWNOANAw@mail.gmail.com>,
 Chris Rebert <clp2@rebertia.com> 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,
 nad@acm.org

[toc] | [prev] | [next] | [standalone]


#21382

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-03-08 11:34 +0000
Message-ID<4f58994f$0$29989$c3e8da3$5496439d@news.astraweb.com>
In reply to#21372
On Wed, 07 Mar 2012 21:47:37 -0800, Ned Deily wrote:

> In article
> <CAMZYqRTXy3mSMXtivuE8ApYX2ZFAG3DQp1UN+fqWnAYWNOANAw@mail.gmail.com>,
>  Chris Rebert <clp2@rebertia.com> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web