Closed dark9t closed 11 years ago
Can you please paste the output of brew doctor
? Please follow the instructions for filing a new bug here as well, thanks! https://github.com/mxcl/homebrew/wiki/Troubleshooting
Please also provide the full output of brew install -v python
in a gist.github.com. Then I can tell more. My bet is that a wrong python is picked up and tries to install the distribute
package in a dir where you need sudo. But then this indicates that your configuration (PATH?) would be wrong.
@mistydemeo : Hi Misty, thank you for your help. my 'brew doctor' output shows no problem, saying "Your system is raring to brew."
@samueljohn : Thank you. Here is the dump of the command you suggested. https://gist.github.com/4200501
Thanks @dark9t. Unfortunately, I can't get a clue out of the gist. Seems like the install of distribute fails. You could try to delete /usr/local/lib/python2.7
and then try to reinstall - but this is just a guess.
@dark9t you don't happen to have set a PYTHONHOME
or something? Anything you could think of?
I think I found a fix - will open a PR soon.
Fuck. Wrong window. No - I havn't found a fix (that was the vtk thing). Sorry all.
Can you try again, I saw we have distribute-0.6.32.tar.gz
now and in your test, you have /distribute-0.6.30.tar.gz
.
Don't know if this makes a difference.
If that does not help, can you wipe out (or move to a save place) your $(brew --prefix)/lib/python2.7/site-packages/
dir? That dir is not removed if you brew rm python
, so perhaps some remains of older attempts are still left.
Any update on this? I'm seeing this error as well.
@weeewake the "OSError: [Errno 13] Permission denied" thing? Can you please gist.github.com the output of brew install --verbose python
after you brew rm python && rm -r $(brew --prefix)/lib/python2.7
.
@dark9t you still have this problem?
I was having this problem as well. I went into my old /Library/Python/2.7 directory and nuked the site-packages directory and it fixed it. I had some stuff in there from before I knew what I was doing with Python (well, I still don't know what I'm doing, but I knew even less then). It looked like Homebrew was finding something in there (possibly setuptools-0.6c11-py2.7.egg) and trying to use it instead of its own copy. Hope this helps. Here's a link to the gist of the relevant output from brew install --verbose python
: https://gist.github.com/4436231.
Thanks @davidthelazar ... indeed that is an issue and I already know if it. I thought I fixed that by especially removing all items from Python's sys.path
that start with /System
when a brewed Python is present (look in the /usr/local/lib/python2.7/site-packages/sitecustomize.py
file).
However, I don't want to remove /Library/Python/2.7
because its a feature that you can import Python packages from there.
I guess I have to think harder and perhaps move Homebrew's Python site-packages to the first position in sys.path
.
I think I found a fix for this. Adding -S
to the python setup.py
call, right after python, results in the site
module being skipped and therefore the /Library/Python...
is not in the path, so distribute
can install even if there is an old easy_install (setuptools flying around). I will open a PR in the next iteration, since this is not so pressing right now.
@samueljohn: close this particular error then?
@adamv not yet, hope to open my PR later this day (CET) with my new PythonInstalled
requirement where I fix some minor things (such as this issure here, too).
I have this issue as well. As a temporary solution I chown'ed /usr/local/bin/brew to root, then sudo installed python, then chmod -R /usr/local back to my own user.
Not ideal, but at least I got python installed with no errors..
No that is really a bad hack. Now you have all files of python installed as root. You should chown -R <youeruser> /usr/local
otherwise the next brew upgrade
or perhaps pip install...
or other things may give you permission errors, too.
Probably you had either installed python once with sudo or you had the "official" python installer from python.org that prompts for you password and installs as root into /usr/local/bin
!
Yes, I know it's a really bad hack, but it's better than having no brewed python at all ;)
I was probably a bit unclear; Yes, I did install as root, and all python files was installed as root, but I changed ownership back to my own user (chown -R $(whoami) /usr/local) once installed, so now I own them again.
I had a completely clean /usr/local and installed the newest homebrew, but python install failed with same error as the original post here. Otherwise, thanks for a great piece of software!
@rhblind okay then :-)
Yes, I should add the -S
to the call of python -S setup.py...
because I bet you have a setuptools/easy_install at either /Library/Python/2.7/site-packages
or ~/Library/Python/2.7/lib/python/site-packages
. Strangely somehow that setuptools installation takes precedence because of python's built-in search strategy...
That's right, I have setuptools installed in /Library/Python/2.7/site-packages
. That's what causing the problem?
In that case, the -S
flag sounds like a good idea. I know I'm not the only one with this problem ;)
Besides, there's no reason you would like to use the /Library/Python/2.7/site-packages
setuptools in a brand new python install.
Besides, there's no reason you would like to use the /Library/Python/2.7/site-packages setuptools in a brand new python install.
It's a dilemma, on the one side, that setuptools there is a mess (but if you only use pip
with your new python, it should be fine) on the other hand, I don't want to disable the whole /Library/Python/2.7/site-package because it is a feature to put (pure python) modules there which can be imported from all python 2.7 binaries on you Mac.
I'm basically having the same issue. Is there a resolution?
Here's my output: https://gist.github.com/satmandu/5042446
@satmandu your issue is different. You did probably sudo brew python
some time ago.
You should probably do something like chown -R <YOURUSER> /usr/local
and chmod -R +rw /usr/local
.
Any update on this?
My work around was to temporarily move setuptools and the setuptools egg somewhere else, then run "brew install python". Will there be any side effects caused by doing this?
I should add that I was having the same problem as rhblind, where brew was finding my /Library/Python/2.7/site-packages/setuptools
@tclose can you brew edit python
and change
Distribute.new.brew { system "#{bin}/python", *setup_args }
into
Distribute.new.brew { system "#{bin}/python", "-S", *setup_args }
Then brew install python
and tell me if it is working?
I assume yes, but not 100% sure. -S
is a python switch that disables the site-packages temporary.
I assume you know how you can change back the modifications later one via git? cd $(brew --prefix) && git checkout -- Library/Formula/python.rb
(should do the trick)
Hi Samuel,
I don't have access to the system i was having the problem with at the moment but might be able to have a look at it towards the end of next week,
Cheers,
Tom
On 16/03/2013, at 12:29 AM, Samuel John notifications@github.com wrote:
@tclose https://github.com/tclose can you brew edit python and change
Distribute.new.brew { system "#{bin}/python", *setup_args }
into
Distribute.new.brew { system "#{bin}/python", "-S", *setup_args }
Then brew install python and tell me if it is working? I assume yes, but not 100% sure. -S is a python switch that disables the site-packages temporary.
I assume you know how you can change back the modifications later one via git? cd $(brew --prefix) && git checkout -- Library/Formula/python.rb(should do the trick)
— Reply to this email directly or view it on GitHubhttps://github.com/mxcl/homebrew/issues/16303#issuecomment-14967048 .
The -S
flag will be added in #18588, too.
samueljohn's fix worked for me, but now brew's pip conflicts with the system one.
I'm having real problems installing Python 2.7.4
brew doctor
says Your system is raring to brew.
Here's my brew config
: https://gist.github.com/neilalbrock/5349352
and the result of brew install --verbose python
: https://gist.github.com/neilalbrock/5349384
Any help would be much appreciated.
I finally got the install to work by clearing /Library/Python/2.7/site-packages
, I'd previously tried the -S
option mentioned earlier in this thread but it failed with an error locating setuptools. Anyway, everything seems fine now.
Thanks for your report and the suggest work-a-round.
@samueljohn I got this permission error too, I don't know what's going on here! is this fixed? I pasted the error output as below
==> /usr/local/Cellar/python/2.7.4/bin/python -s setup.py --no-user-cfg install File "/private/tmp/UNKNOWN-1EIF/distribute-0.6.36/distribute_setup.py", line 360, in _patch_egg_dir _rename_path(path) File "/private/tmp/UNKNOWN-1EIF/distribute-0.6.36/distribute_setup.py", line 271, in _rename_path os.rename(path, new_name) OSError: [Errno 13] Permission denied
my brew doctor shows the system is ready to brew and brew update works like a charm.
It's hard to fix for us because we don't want to disable that Python looks in /Library/Python/...
or ~/Library/Python
for shared packages. However a setuptools sitting there sucks a lot and I have not found a good way to fix that, yet. Open for suggestions. Probably, I'll make the brew doctor
complain if it finds a setuptools installation in that place.
@samueljohn so, now the best way to fix this is to clean up the Python and everything it comes with macOS?
Do not remove the system python. Don't ever do this. Mac OSX may depend on it.
But ~/Library/Python/2.7/site-packages and /Library/Python/2.7/site-packages can be savely emptied. They are empty (except for the readme) on a fresh OS X.
@samueljohn ok, roger that
Emptying both ~/Library/Python/2.7/site-packages
and /Library/Python/2.7/site-packages
did it for me. Thanks @samueljohn :+1:
Not sure why I'm receiving these emails, but anyway let me strongly advise against lightly removing the whole site-packages directory. Anyone considering doing so must realize beforehand that when doing so, he will loose all custom installed python packages. For instance, if one has installed numpy, scipy, matplotlib, ipython, etc, he will loose it all after emptying site-packages.
Best, Rodrigo Ventura
On 22/05/2013, at 05:40, Carlos Iriarte wrote:
Emptying both ~/Library/Python/2.7/site-packages and /Library/Python/2.7/site-packages did it for me. Thanks @samueljohn
— Reply to this email directly or view it on GitHub.
Rodrigo Ventura Institute for Systems and Robotics Instituto Superior Técnico Lisbon, Portugal http://users.isr.ist.utl.pt/~yoda
this issue is really pain in the s. hope will get fixed soon
We can only work-around. Fixing this is up to python/distribute/pip/easy_install.
And, yes, removing the content of site-packages is the last thing I recommend.
Note, I maintain a tap for numpy, SciPy, matplotlib and other python formulae that don't build easily with pip, so installing these should be less pain.
What will it take to close this issue? I don't like keeping issues open for a long time just to serve as documentation of a workaround.
I'll move this one to the top of my todo list.
Sorry, I don't mean to randomize your list.
Ok, the best I can do, is to add a very precise brew doctor
check telling to remove the offending setuptools installation (will need admin rights).
I think a setuptools installation, for example like /Library/Python/2.7/site-packages/setuptools-0.6c12dev_r88846-py2.7.egg-info
is the cause of this problem. The newer distribute needs to rename it because the more modern distribute provides the same functionality. Since that dir (/Library/Python/2.7/site-packages/
) needs admin rights to write to, the renaming distribute attempts fails.
Anyone still having this problem, could you please post me these lines:
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 to /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg.OLD.1357145182.72
from your brew install python -v
output? The exact name will differ. I am interested in the exact filename of that setuptools. It could perhaps also be a setuptools.pth file or something.
Then I'll make a better brew doctor check
.
here is the exact file name in my system
setuptools-0.6c11-py2.7.egg setuptools.pth
Thanks @HughGrant!
@samueljohn What's the status of this?
Tried brew doctor and brew update. The error still persisted. Here is the error part of the installation log:
==> Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6 Already downloaded: /Library/Caches/Homebrew/distribute-0.6.30.tar.gz ==> /usr/local/Cellar/python/2.7.3/bin/python -s setup.py --no-user-cfg install -- File "/private/tmp/UNKNOWN-Id1h/distribute-0.6.30/distribute_setup.py", line 355, in _patch_egg_dir _rename_path(path) File "/private/tmp/UNKNOWN-Id1h/distribute-0.6.30/distribute_setup.py", line 266, in _rename_path os.rename(path, new_name) OSError: [Errno 13] Permission denied
Thank you for your help!