Solved

Python Install On Mac Yosemite

Posted on 2016-07-26
8
92 Views
Last Modified: 2016-07-28
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
Comment
Question by:sharingsunshine
  • 5
  • 3
8 Comments
 
LVL 27

Expert Comment

by:serialband
Comment Utility
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
 

Author Comment

by:sharingsunshine
Comment Utility
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
 
LVL 27

Expert Comment

by:serialband
Comment Utility
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
 

Author Comment

by:sharingsunshine
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 27

Accepted Solution

by:
serialband earned 500 total points
Comment Utility
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
 

Author Comment

by:sharingsunshine
Comment Utility
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
 

Author Comment

by:sharingsunshine
Comment Utility
using macports instead of default
0
 

Author Closing Comment

by:sharingsunshine
Comment Utility
thanks for the help and assistance
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now