Closed amir20 closed 12 years ago
After investigating a little, I think the correct bin/python is /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python
and not /usr/local/Cellar/python/2.7.3/bin/python
. But I have no idea if what I am doing is right. I basically downloaded the source code and tried to make & install with the same parameters as above. I see at the end the that /usr/local/Cellar/python/2.7.3/bin/python
doesn't exist. Has any body else ran in to this issue?
I get the same error when I try to brew install Python3.
Same output from brew doctor too.
Have you installed other python distributions, set any python related env vars?
Strange, the other person who had this issue also had rvm upfront in path but I don't believe this to be the problem.
I didn't installed other distributions. But I was blocked so I installed python after giving up on this. I can try the fix on #14931 when I get home tonight.
No RVM and only the Mountain lion install of Python on the system. python3 was the first thing I tried to install via homebrew. I only have the command line tools installed and not the full Xcode. But accoriding to the homebrew page that should be fine.
Hmm I could not reproduce this on my 10.7 CLT-only (so without Xcode). And also not on my 10.8 Xcode-only system.
I see at the end the that /usr/local/Cellar/python/2.7.3/bin/python doesn't exist. Has any body else ran in to this issue?
Strange ...
A few minutes ago there was another fix in homebrew regarding the ordering of -L
flags, which might perhaps also affect this here. So perhaps brew update
and brew python --verbose
again?
I'll give it a shot. The only custom thing in my $PATH is $HOME/bin so PATH=$HOME/bin:$PATH. Basically this is a new install of mountain lion that I am working with.
BTW, thanks for your effort in helping. I have gone to using Fedora in the meantime and was contemplating just switching back to Linux altogether. This has given me hope!
Somehow brewed python picks up a PythonPath from system's python.
We had that problem once when we a -L<dir>
flag pointing to the OS X system libs because then when building brewed python, it accidentally linked against the system python which in turn sets some internals such as the dir where to install site-packages wrong.
I'll pull the latest brew and try again this evening. I will report back.
thanks
I also had a fresh install.
Amir Raminfar
On Friday, September 14, 2012 at 12:27 PM, Greg Sieranski wrote:
I'll give it a shot. The only custom thing in my $PATH is $HOME/bin so PATH=$HOME/bin:$PATH. Basically this is a new install of mountain lion that I am working with.
— Reply to this email directly or view it on GitHub (https://github.com/mxcl/homebrew/issues/14712#issuecomment-8566963).
I tried different configurations ... but I just can't reproduce :-/
Perhaps I need all your brew doctor
, brew config
, env
outputs please!
brew doctor Your system is raring to brew.
I'll have to get the others to you tonight. But I know brew doctor says everything is fine.
@wonbyte ok thanks.
xcode-select: Error: No Xcode is selected. Use xcode-select -switch
Error: Failed executing: make install PYTHONAPPSDIR=/usr/local/Cellar/python3/3.2.3 (python3.rb:99)
This link will help resolve the above errors: https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
Interesting line is: xcode-select: Error: No Xcode is selected. Use xcode-select -switch
(gps ~)$ env GREP_COLOR=1;32 TERM_PROGRAM=Apple_Terminal TERM=xterm-256color SHELL=/bin/bash TMPDIR=/var/folders/n1/wdcflt4j14962kbrk84kw9hr0000gn/T/ Apple_PubSub_Socket_Render=/tmp/launch-QjEX9R/Render TERM_PROGRAM_VERSION=309 TERM_SESSION_ID=21BF8624-9683-45F8-A0BC-48192FDE69AE LC_ALL=en_US.UTF-8 ANT_HOME=/usr/bin/ant GIT_EDITOR=/usr/bin/vim SVN_EDITOR=/usr/bin/vim USER=gps COMMAND_MODE=unix2003 SSH_AUTH_SOCK=/tmp/launch-nkpGR1/Listeners __CF_USER_TEXT_ENCODING=0x1F5:0:0 Apple_Ubiquity_Message=/tmp/launch-CUd4Da/Apple_Ubiquity_Message PATH=/Users/gps/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin PWD=/Users/gps JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0_33-b03-424.jdk/Contents/Home EDITOR=/usr/bin/vim LANG=en_US.UTF-8 PS1=(\u \w)$ GPG_TTY=/dev/ttys000 SHLVL=1 HOME=/Users/gps GREP_OPTIONS=--color=auto LOGNAME=gps LC_CTYPE=enUS.UTF-8 CVSEDITOR= DISPLAY=/tmp/launch-HxBbQc/org.macosforge.xquartz:0 =/usr/bin/env
(gps ~)$ brew doctor Your system is raring to brew.
Thanks, I can look at it tomorrow. There have been some updates, so
perhaps brew update and then retry?
Also if you explicitly add --env=std
, does it help (it should use
std for python but internally automatically)?
Still no luck. Same error. What I supposed to pull a branch?
@wonbyte what is in your /Users/gps/bin
?
I am running out of options. There must be something that is non-standard but I don't know what is is, yet. At least there is not set any environment variable that influences python.
When you start up "python" (whichever it may be - probably system's python) and print out what import sys; sys.path
returns, what does it show?
I installed the official python package last week because I wasn't able to get things working. Do you still want me to run import sys; sys.path
?
Then I probably know the reason: The official python.org Python package installs (with sudo rights) /usr/local/python
and homebrew (which does avoid using sudo) is not able to overwrite that, so that the freshly built python
cannot be moved in place. Still insterested what is which python
and what the sys.path
is if you start that python.
Well I was getting this error before I had installed the official python package. I'd like to remove it and use the brew version. Here is the output:
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.path;
['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/Library/Python/2.7/site-packages/PIL', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL', '/Library/Python/2.7/site-packages']
Should I remove /usr/local/python
manually and try again?
Good idea. This is also the cause of the problem. Let me look up the right command to find and remove the python form python.org installer.
I had once written brew doctor
check for it, but it was rejected.
This seems to be the right place http://hg.python.org/cpython/file/default/Mac/README?
Edit: Actually even better, maybe pkgutil --pkgs | grep org.python.Python | xargs -L1 pkgutil -f --unlink
Using python.org's python conflicts with Homebrew's python and you may not be able to successfully brew install python
. While you may use python.org's version, we cannot provide support for it, especially for the python bindings in Homebrew.
Unfortunately, there is no uninstaller.
To list all symlinkes from python.org's installer:
ls -l #{HOMEBREW_PREFIX}/bin | grep '../Library/Frameworks/Python.framework'
Delete them manually.
@amir20 yes, you found the right file :-)
@samueljohn Unfortunatly still no luck. I removed all sym links using ls -l $HOMEBREW_PREFIX/bin | grep '../Library/Frameworks/Python.framework'
. I removed python from my $PATH. But I sitll get this error:
Removing elements out of the way...
Renaming /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools-0.6c12dev_r88846-py2.7.egg-info into /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools-0.6c12dev_r88846-py2.7.egg-info.OLD.1347807689.27
Traceback (most recent call last):
File "setup.py", line 131, in <module>
_before_install()
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 363, in _before_install
_fake_setuptools()
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 420, in _fake_setuptools
res = _remove_flat_installation(setuptools_location)
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 224, in __no_sandbox
return function(*args, **kw)
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 279, in _remove_flat_installation
patched = _patch_egg_dir(pkg_info)
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 224, in __no_sandbox
return function(*args, **kw)
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 347, in _patch_egg_dir
_rename_path(path)
File "/private/tmp/brew-__UNKNOWN__-0.6.28-UG3B/distribute-0.6.28/distribute_setup.py", line 259, in _rename_path
os.rename(path, new_name)
OSError: [Errno 13] Permission denied
config.log was copied to /Users/amirraminfar/Library/Logs/Homebrew
==> Build Environment
HOMEBREW_VERSION: 0.9.3
HEAD: c9554818a533f4f4c8df640612f28668813925c7
CPU: 8-core 64-bit ivybridge
OS X: 10.8.1-x86_64
Xcode: 4.4 (guessed)
CLT: 4.4.0.0.1.1249367152
X11: 2.7.2 => /opt/X11
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -pipe -Wno-unused-value -Wno-empty-body -Qunused-arguments
CXXFLAGS: -Os -pipe -Wno-unused-value -Wno-empty-body -Qunused-arguments
CPPFLAGS: -I/usr/local/opt/readline/include -I/opt/X11/include
LDFLAGS: -L/usr/local/opt/readline/lib -L/usr/local/lib -L/opt/X11/lib
CMAKE_PREFIX_PATH: /usr/local/opt/readline:/opt/X11
CMAKE_INCLUDE_PATH: /opt/X11/include
MACOSX_DEPLOYMENT_TARGET: 10.8
ACLOCAL_PATH: /opt/X11/share/aclocal
OBJC: /usr/bin/clang
PATH: /Users/amirraminfar/.rvm/gems/ruby-1.9.3-p194/bin:/Users/amirraminfar/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/amirraminfar/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/amirraminfar/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Library/Contributions/cmds:/opt/X11/bin
Error: Failed executing: /usr/local/Cellar/python/2.7.3/bin/python setup.py --no-user-cfg install --force --verbose (python.rb:152)
I think this is a different problem because I didn't need to sudo
to remove the symlinks.
Please try to move away /Library/Frameworks/Python.framework
. Perhaps the easy_install there is found (because it is a standard location for system-wide site-packages).
I have to think harder how to avoid this.
There is also /Library/Python/2.7/site-packages/pip-1.1-py2.7.egg
in your sys.path
. How does all these stuff get in there, if your env. var PYTHONPATH
is empty. There must be a "site.py" or "sitecustomize" file somewhere which sets up all these dirs into the sys.path
.
I have an empty /Library/Python/2.7/site-packages
. Perhaps you have some files there, too?
I'd also try to rename this (just for testing) and see at which point python installation works again.
Python 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import sys; sys.path ['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
(gps ~)$ ls /Library/Python/2.7/site-packages/ README
@samueljohn
So I did a clean install and Python3 install sucessfully. The only two things I can think of that might matter are:
Is installing virtualenv or virtualenvwrapper going to cause issues?
@wonbyte I somehow missed you were talking about python3 and not python. But still, both do work with CLT only and with Xcode only. However, there are some (other) formulae that either need Xcode or need the CLT to be installed.
Virtualenv and virtualenvwrapper? Perhaps. I don't know where your current vitualenv/wrapper came from. Just try to remove the startup script from you ~/.bash_profile
and then, after installing brew python3
do pip-3.2 install virtualenvwrapper
. Virtualenv completely encapsulates the site-packages and should normally not be the problem! However, when installing brew install python3
or brew install python
, you should open a clean new shell and _not a shell where you have called virtualenvwrapper's workon
or similar_, because that would cause the installation of brew python to fail by attempting to install into the virtualenv or the python referenced by the virtualenv.
Your django project should not be the problem (PYTHONAPPS
should also cause no harm).
@amir20 Do you have virtualenv or virtualenvwrapper installed? Also please double check that there is no hidden file: ~/.pydistutils.cfg
or a sitecustomize.py
file somewhere altering the sys.path
. (They are both able to change the default site-packages)
The sad thing is, I don't yet have a clue what caused the trouble for you both here, but without that knowledge I can't improve the brew doctor
or the python formula
:-(
@samueljohn
No I have not install virtualenv yet. Basically I tried installing python3 on a blank system. The first time I only had CLT and it failed. The second time I had Xcode and it worked. That is the only difference between the two. Everything else was a stock Mountain Lion install.
@samueljohn
I'll re-print my sys.path to see if there is a difference from the above.
I had a similar problem -- clean install of moutain lion with just CLTs installed and got the error below when I tried "brew install python --framework --universal". After installing the full Xcode, brew was able to install python ending with "==> Summary /usr/local/Cellar/python/2.7.3: 5168 files, 82M, built in 2.6 minutes"
==> Build Environment HOMEBREW_VERSION: 0.9.3 HEAD: 81f9a64060cc088a5f793890de9d99f52f577b8a CPU: dual-core 64-bit penryn OS X: 10.8.1-x86_64 Xcode: 4.4 (guessed) CLT: 4.4.0.0.1.1249367152 X11: 2.7.3 => /opt/X11 CC: /usr/bin/clang CXX: /usr/bin/clang++ => /usr/bin/clang LD: /usr/bin/clang CFLAGS: -Os -pipe -Wno-unused-value -Wno-empty-body -Qunused-arguments CXXFLAGS: -Os -pipe -Wno-unused-value -Wno-empty-body -Qunused-arguments CPPFLAGS: -I/usr/local/opt/readline/include -I/opt/X11/include LDFLAGS: -L/usr/local/opt/readline/lib -L/usr/local/lib -L/opt/X11/lib CMAKE_PREFIX_PATH: /usr/local/opt/readline:/opt/X11 CMAKE_INCLUDE_PATH: /opt/X11/include MACOSX_DEPLOYMENT_TARGET: 10.8 ACLOCAL_PATH: /opt/X11/share/aclocal OBJC: /usr/bin/clang PATH: /usr/local/bin:/Users/lmanders/.local/bin:/usr/local/bin:/Users/lmanders/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/Library/Contributions/cmds:/opt/X11/bin
Error: Failed executing: make install PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3 (python.rb:128)
These existing issues may help you: https://github.com/mxcl/homebrew/issues/12918 https://github.com/mxcl/homebrew/issues/14497 https://github.com/mxcl/homebrew/issues/14712 Otherwise, this may help you fix or report the issue: https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
@samueljohn I used to have virtualenv
installed. But I took everything out of my class path. Should it matter?
So is the problem that I need XCode?
Ok, I guess, I'll have to upgrade my CLT-only system from Lion to Mountain Lion to check this myself.
It could be that this happens on CLT-only on 10.8 and not on 10.7 (because I tested that).
@amir20 If you don't mind to install Xcode and test again? That would potentially help me. Would be great to have both outputs of brew install --verbose python
side by side so I can compare and perhaps make a diff.
Going to try installing Xcode tonight.
Amir Raminfar
On Tuesday, September 18, 2012 at 6:45 AM, Samuel John wrote:
Ok, I guess, I'll have to upgrade my CLT-only system from Lion to Mountain Lion to check this myself.
It could be that this happens on CLT-only on 10.8 and not on 10.7 (because I tested that). @amir20 (https://github.com/amir20) If you don't mind to install Xcode and test again? That would potentially help me. Would be great to have both outputs of brew install --verbose python side by side so I can compare and perhaps make a diff.— Reply to this email directly or view it on GitHub (https://github.com/mxcl/homebrew/issues/14712#issuecomment-8649467).
@amir20 In my pasted error above this is what I got when I just had CLT installed:
xcode-select: Error: No Xcode is selected. Use xcode-select -switch , or see the xcode-select manpage (man xcode-select) for further information.
I installed Xcode and it worked.
I did not get that error. I think I had a permission error.
Amir Raminfar
On Tuesday, September 18, 2012 at 10:47 AM, Greg Sieranski wrote:
@amir20 (https://github.com/amir20) In my pasted error above this is what I got when I just had CLT installed: xcode-select: Error: No Xcode is selected. Use xcode-select -switch , or see the xcode-select manpage (man xcode-select) for further information. I installed Xcode and it worked.
— Reply to this email directly or view it on GitHub (https://github.com/mxcl/homebrew/issues/14712#issuecomment-8657290).
I'm having the same problem, let me know what information you need from me to help resolve this issue:
brew install python --framework --universal
==> Downloading http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/python-2.7.3.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/python/2.7.3 --enable-ipv6 --dataroot
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3/sha
==> Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0
Already downloaded: /Library/Caches/Homebrew/distribute-0.6.28.tar.gz
==> /usr/local/Cellar/python/2.7.3/bin/python setup.py --no-user-cfg install --f
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg
Egg installation
Patching...
Renaming /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg into /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg.OLD.1347989822.78
Traceback (most recent call last):
File "setup.py", line 131, in
Error: Failed executing: /usr/local/Cellar/python/2.7.3/bin/python setup.py --no-user-cfg install --force --verbose (python.rb:152)
These existing issues may help you: https://github.com/mxcl/homebrew/issues/12918 https://github.com/mxcl/homebrew/issues/14497 https://github.com/mxcl/homebrew/issues/14712 Otherwise, this may help you fix or report the issue: https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
@wonbyte I had the same issue as you when trying to brew Python. I too had CLT only.
I tried brewing again after sudo xcode-select -switch /usr/bin/
and it worked.
Could be an issue with the new Mountain Lion CLT installer not setting this properly?
The issue @Snailson is having is due to an older setuptools installation at Setuptools installation detected at /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg
which can't be overwritten, thus the OSError: [Errno 13] Permission denied
. Python has the /Library/Python/site-packages
dir built-in to look for additional modules and I think that is good, because it is the standard for all Python's on OS X. You can put global stuff there (but need sudo - which homebrew avoids).
To solve your issue @Snailson, you should empty that site-package dir (and install the needed stuff later with pip
).
@samueljohn @eidorb I didn't have a permission issue. My error above was
xcode-select: Error: No Xcode is selected. Use xcode-select -switch , or see the xcode-select manpage (man xcode-select) for further information.
So could it be that there are two issues. One with installing Python and another with Python3. With Python needing an empty site packages dir and Python3 needing Xcode?
When I try to install python, the following error happens.
I have looked at #14278 and my path seems to be correct. I haven't install python from anywhere else. So I am not sure how I can resolve this problem if my PATH doesn't contain Python. Any advice on how to go about fixing this?
My brew doctor output:
My verbose output is here: https://gist.github.com/3628114