Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Python Install On Mac Yosemite

I ran these commands to install pip - and this is the first time I have done anything with python



    Install easy_install

    curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python

    Install pip

    sudo easy_install pip


 and got this output

Installing collected packages: regex
  Running setup.py install for regex ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/pip-build-S0yDgr/regex/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/pip-ys9aKs-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.10-intel-2.7
    copying Python2/regex.py -> build/lib.macosx-10.10-intel-2.7
    copying Python2/_regex_core.py -> build/lib.macosx-10.10-intel-2.7
    copying Python2/test_regex.py -> build/lib.macosx-10.10-intel-2.7
    running build_ext
    building '_regex' extension
    creating build/temp.macosx-10.10-intel-2.7
    creating build/temp.macosx-10.10-intel-2.7/Python2
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Python2/_regex.c -o build/temp.macosx-10.10-intel-2.7/Python2/_regex.o
    Python2/_regex.c:16675:77: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                if (state->total_errors < error_limit || i == 0 &&
                                                                      ~~ ~~~~~~~^~
    Python2/_regex.c:16675:77: note: place parentheses around the '&&' expression to silence this warning
                                if (state->total_errors < error_limit || i == 0 &&
                                                                                ^
    Python2/_regex.c:16678:38: warning: variable 'better' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                                else if (state->total_errors == error_limit)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16686:33: note: uninitialized use occurs here
                                if (better) {
                                    ^~~~~~
    Python2/_regex.c:16678:34: note: remove the 'if' if its condition is always true
                                else if (state->total_errors == error_limit)
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16673:40: note: initialize the variable 'better' to silence this warning
                                BOOL better;
                                           ^
                                            = '\0'
    Python2/_regex.c:18708:28: warning: unused function 'match_get_group_dict' [-Wunused-function]
    Py_LOCAL_INLINE(PyObject*) match_get_group_dict(MatchObject* self) {
                               ^
    3 warnings generated.
    Python2/_regex.c:16675:77: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                if (state->total_errors < error_limit || i == 0 &&
                                                                      ~~ ~~~~~~~^~
    Python2/_regex.c:16675:77: note: place parentheses around the '&&' expression to silence this warning
                                if (state->total_errors < error_limit || i == 0 &&
                                                                                ^
    Python2/_regex.c:16678:38: warning: variable 'better' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                                else if (state->total_errors == error_limit)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16686:33: note: uninitialized use occurs here
                                if (better) {
                                    ^~~~~~
    Python2/_regex.c:16678:34: note: remove the 'if' if its condition is always true
                                else if (state->total_errors == error_limit)
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python2/_regex.c:16673:40: note: initialize the variable 'better' to silence this warning
                                BOOL better;
                                           ^
                                            = '\0'
    Python2/_regex.c:18708:28: warning: unused function 'match_get_group_dict' [-Wunused-function]
    Py_LOCAL_INLINE(PyObject*) match_get_group_dict(MatchObject* self) {
                               ^
    3 warnings generated.
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Python2/_regex_unicode.c -o build/temp.macosx-10.10-intel-2.7/Python2/_regex_unicode.o
    cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/Python2/_regex.o build/temp.macosx-10.10-intel-2.7/Python2/_regex_unicode.o -o build/lib.macosx-10.10-intel-2.7/_regex.so
    running install_lib
    copying build/lib.macosx-10.10-intel-2.7/_regex.so -> /Library/Python/2.7/site-packages
    error: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/_regex.so'
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/pip-build-S0yDgr/regex/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/pip-ys9aKs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/pip-build-S0yDgr/regex/

Open in new window


I need to use python to change several blogger posts using this logic
http://www.tulane.edu/%7Ehoward/CompCultEN/webpages.html
0
sharingsunshine
Asked:
sharingsunshine
  • 5
  • 3
1 Solution
 
serialbandCommented:
Line 67 shows a permissions denied in the folder.


It indicates that your script doesn't have permissions to write to the folder.  While you did call sudo, it seems that it's still preventing your access.
0
 
sharingsunshineAuthor Commented:
I saw that but didn't know how to proceed.  Here is a screenshot of the site-packages contents

https://gyazo.com/c8143cd206091bfb85be276fa10959d3

They all have root:wheel ownership

So please tell me how to fix the problem.
0
 
serialbandCommented:
Well, a quick workaround would be to add write permissions to that folder.  It seems that the sudo pip call must somehow not have full root permissions when you ran it.

drwxr-xr-x  5 root  wheel  170 Jul 27 11:22 site-packages

sudo chmod +w /Library/Python/2.7/site-packages/

drwxrwxrwx  5 root  wheel  170 Jul 27 11:22 site-packages
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
sharingsunshineAuthor Commented:
that worked, but then I tried this

rjw sudo easy_install pip                           
Traceback (most recent call last):
  File "/usr/bin/easy_install-2.7", line 7, in <module>
    from pkg_resources import load_entry_point
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2928, in <module>
    @_call_aside
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2914, in _call_aside
    f(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2941, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 637, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 829, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'setuptools==1.1.6' distribution was not found and is required by the application

Open in new window

0
 
serialbandCommented:
You're missing the setuptools.
Download the it from : https://pypi.python.org/pypi/setuptools

Once downloaded, you just need to install it
python ez_setup.py

After that your pip command should work.
0
 
sharingsunshineAuthor Commented:
rjw sudo curl https://bootstrap.pypa.io/ez_setup.py -o - | python
Password:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12402  100 12402    0     0  75337      0 --:--:-- --:--:-- --:--:-- 93248
Extracting in /var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/tmpyT5qTU
Now working in /var/folders/vg/lzbgw_fx4k90zdjn3zy95qt80000gp/T/tmpyT5qTU/setuptools-25.1.0
Installing Setuptools
running install
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: '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/test-easy-install-11245.write-test'

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

    /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.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.

Something went wrong during the installation.
See the error message above.

Open in new window

0
 
sharingsunshineAuthor Commented:
using macports instead of default
0
 
sharingsunshineAuthor Commented:
thanks for the help and assistance
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now