?
Solved

Python Install On Mac Yosemite

Posted on 2016-07-26
8
Medium Priority
?
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 30

Expert Comment

by:serialband
ID: 41731775
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
ID: 41732223
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 30

Expert Comment

by:serialband
ID: 41732270
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
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 

Author Comment

by:sharingsunshine
ID: 41732922
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
 
LVL 30

Accepted Solution

by:
serialband earned 2000 total points
ID: 41733044
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
ID: 41733117
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
ID: 41733377
using macports instead of default
0
 

Author Closing Comment

by:sharingsunshine
ID: 41733378
thanks for the help and assistance
0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to dynamically set the form action using jQuery.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

719 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