Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Noob help #1

Closed
Snailson opened this Issue · 26 comments

4 participants

@Snailson

@samueljohn So here is everything I did if you have a minute or two to look over it sometime and let me know what I'm doing wrong I'd greatly appreciate it!

brew update
Already up-to-date.
chads-MacBook-Air:~ chad$ brew doctor
Your system is raring to brew.
chads-MacBook-Air:~ chad$ brew install python
==> 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
==> Downloading http://pypi.python.org/packages/source/p/pip/pip-1.2.tar.gz
######################################################################## 100.0%
==> /usr/local/Cellar/python/2.7.3/bin/python setup.py --no-user-cfg install --f
==> Caveats
The Python framework is located at
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework

You can find the Python demo at
/usr/local/share/python/Extras

You can brew linkapps to symlink "Idle" and the "Python Launcher".

A "distutils.cfg" has been written, specifying the install-scripts folder as:
/usr/local/share/python

If you install Python packages via "pip install x" or "python setup.py install"
(or the outdated easy_install), any provided scripts will go into the
install-scripts folder above, so you may want to add it to your PATH.

The site-package directory for brewed Python:
/usr/local/lib/python2.7/site-packages

Distribute and Pip have been installed. To update them
/usr/local/share/python/pip install --upgrade distribute
/usr/local/share/python/pip install --upgrade pip

See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
==> Summary
/usr/local/Cellar/python/2.7.3: 5165 files, 80M, built in 86 seconds
chads-MacBook-Air:~ chad$ which python
/usr/local/bin/python
chads-MacBook-Air:~ chad$ brew tap samueljohn/python
Cloning into '/usr/local/Library/Taps/samueljohn-python'...
remote: Counting objects: 58, done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 58 (delta 19), reused 48 (delta 10)
Unpacking objects: 100% (58/58), done.
Tapped 3 formula
chads-MacBook-Air:~ chad$ brew install gfortran
==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg
######################################################################## 100.0%
==> Installing gfortran 4.2.4 for XCode 4.2 (build 5666) or higher
==> Caveats
Brews that require a Fortran compiler should not use:
depends_on 'gfortran'

The preferred method of declaring Fortran support is to use:
def install
...
ENV.fortran
...
end

==> Summary
/usr/local/Cellar/gfortran/4.2.4-5666.3: 84 files, 72M, built in 42 seconds
chads-MacBook-Air:~ chad$ brew install numpy
Unsatisfied dependency: nose
Homebrew does not provide Python dependencies; install with:
easy_install nose
Error: An unsatisfied requirement failed this build.
chads-MacBook-Air:~ chad$ pip install nose
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in
working_set.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.2.1

@samueljohn
Owner

Alright, it looks like python still picks up the system version. If python installed ok which python should point to /usr/local/bin/python. Does it?

@samueljohn
Owner

New instructions:

brew remove python
rm -rf /Library/Python/2.7/site-packages # it's save to delete this!
brew install python
pip install nose
brew install numpy
@samueljohn samueljohn was assigned
@Snailson

brew remove python
Uninstalling /usr/local/Cellar/python/2.7.3...
chads-MacBook-Air:~ chad$ brew update
Already up-to-date.
chads-MacBook-Air:~ chad$ brew doctor
Your system is raring to brew.
chads-MacBook-Air:~ chad$ brew remove python
Error: No such keg: /usr/local/Cellar/python
chads-MacBook-Air:~ chad$ rm -rf /Library/Python/2.7/site-packages
chads-MacBook-Air:~ chad$ brew install python
==> 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 --datarootdir=
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.3/share/p
==> Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.2
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 --force
==> Downloading http://pypi.python.org/packages/source/p/pip/pip-1.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/pip-1.2.tar.gz
==> /usr/local/Cellar/python/2.7.3/bin/python setup.py --no-user-cfg install --force
==> Caveats
The Python framework is located at
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework

You can find the Python demo at
/usr/local/share/python/Extras

You can brew linkapps to symlink "Idle" and the "Python Launcher".

A "distutils.cfg" has been written, specifying the install-scripts folder as:
/usr/local/share/python

If you install Python packages via "pip install x" or "python setup.py install"
(or the outdated easy_install), any provided scripts will go into the
install-scripts folder above, so you may want to add it to your PATH.

The site-package directory for brewed Python:
/usr/local/lib/python2.7/site-packages

Distribute and Pip have been installed. To update them
/usr/local/share/python/pip install --upgrade distribute
/usr/local/share/python/pip install --upgrade pip

See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
==> Summary
/usr/local/Cellar/python/2.7.3: 5165 files, 80M, built in 89 seconds
chads-MacBook-Air:~ chad$ pip install nose
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in
working_set.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.2.1
chads-MacBook-Air:~ chad$ which python
/usr/local/bin/python

@samueljohn
Owner

I feel sorry that you have so much trouble ...
after brewing python, I hope that which python points to /usr/local/bin/python.

Can you do this, so I can decide what to do next:
python -c "import sys; print sys.path"

and paste the output here

@Snailson

python -c "import sys; print sys.path"
['', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2-py2.7.egg', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages']

@samueljohn
Owner

Thanks, this looks good, now.
Now we have to check what pip does (perhaps thats an old pip from an old install which is hard-coded to system python?

Do which pip and tell me.
And more important: cat $(which pip). I expect there to be #!/System.... in the first line.

@Snailson

Yeah I don't know you tell me your the boss.

which pip
/usr/local/bin/pip

cat $(which pip)
#!/usr/bin/python

EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.2.1','console_scripts','pip'

requires = 'pip==1.2.1'
import sys
from pkg_resources import load_entry_point

sys.exit(
load_entry_point('pip==1.2.1', 'console_scripts', 'pip')()
)

@samueljohn
Owner

hmmm ... no, I was wrong. Strange, so that pip is fine and the sys.path in python looks fine, too.
Now in theory your pip install something should not need sudo any more.

@samueljohn
Owner

protip: Put the pasted stuff between tripple `

@Snailson

So what should I do? Just do a clean install of OSX?

protip: Put the pasted stuff between tripple`

@samueljohn
Owner

No, that would be overkill. Don't reinstall. We have to find the reason and fix it.

@samueljohn
Owner

Can you now pip install nose or does it still fail?

@Snailson

Sounds good. I just feel bad making you take your time on this. But if you want to continue, I'm game just let me know what you'd like me to do.

I'm going to restart the computer real quick.

@Snailson

brew update
Already up-to-date.
chads-MacBook-Air:~ chad$ brew doctor
Your system is raring to brew.
chads-MacBook-Air:~ chad$ pip install nose
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.2.1

@samueljohn
Owner

I'd like to find the reason, so I can put a check in homebrew (perhaps for the doctor) so that he will outright print a message that helps others.

A little background.

We see that somehow, when installing, the pip tries to load something from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py which it should really not.
How can this come, since we have checked that the /usr/local/bin/python does not have that dir in its sys.path?

I assumed some file called easy_install.pth or setuptools.pth to be the "evil" here.
Because these files contain (on my test system: the path to the /System/Libr... etc.

Do you have got a file named .pydistutils.cfg in your home? Check with ls -la ~/.pydistutils.cfg.
Have you set the env var PYTHONHOME or PYTHONPATH (or anything beginning with PYTHON) ?

@Snailson

Not that I know of do you use google chrome? We could run this chrome.google.com/remotedesktop

Here's the output

ls -la ~/.pydistutils.cfg
ls: /Users/chad/.pydistutils.cfg: No such file or directory

@samueljohn
Owner

I have chrome. We can try that.

@samueljohn
Owner

ok, how do I continue? send me a mail or something? (github@samueljohn.de)
I never used remote desktop.

@Snailson

Sent you an email.

@Snailson

@samueljohn You are the MAN! issue resolved!

@Snailson Snailson closed this
@samueljohn
Owner

Solution was:

$(brew --prefix)/share/python has to be in the PATH, too (for all the python scripts). Man I was blind. I'll ensure this gets more prominent into the homebrew python formula.

@mikaelengstrom

Helped a lot. Thanks.

@anton164

@samueljohn It seems like I have the exact same issue and I've tried reinstalling python with brew, and I just tried adding $(brew --prefix)/share/python which becomes '''/usr/local/share/python/" to my PATH (.bash_profile) without any luck. Any tips on what I could try?

@samueljohn
Owner

@anton164 please open a new issue.
Also note that brewed python no longer puts executable python scripts into share/python but directly into $(brew --prefix)/bin. The brew doctor knows already about this.

@anton164

@samueljohn Thanks, but no worries I figured it out. In case anyone else stumbles upon this thread, Tom's answer here solved my problem. http://stackoverflow.com/questions/11704379/python-pip-broken-after-os-x-10-8-upgrade

@samueljohn
Owner

Cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.