Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.

[COOK-1169] python::pip recipe failure because it's looking for Python in the wrong directory #2

Merged
merged 1 commit into from
Apr 26, 2012

Conversation

hectcastro
Copy link
Contributor

Separated Python and pip's prefix_dir so that the installation of pip can complete when install_method is package.

…ation of pip can complete when install_method is "package."
@hectcastro
Copy link
Contributor Author

Hey @captnswing, noticed your last patch via git blame. I'm not a heavy Python user – does this pull request make sense to you?

jtimberman pushed a commit that referenced this pull request Apr 26, 2012
[COOK-1169] python::pip recipe failure because it's looking for Python in the wrong directory
@jtimberman jtimberman merged commit bb17707 into poise:master Apr 26, 2012
@asergeyev
Copy link

It's failing currently for me on debian squeeze and fedora 16. Distributed install puts pip into /usr/bin, not to /usr/local/bin, therefore not_if in pip install never works.

@hectcastro
Copy link
Contributor Author

@asergeyev Are you able to get it to work by overriding node['python']['pip']['prefix_dir']?

@asergeyev
Copy link

yes, but IMO it should be tested on platforms and set to correct default one. I wonder if pip installer has clues where it puts stuff to be used in attributes/default.rb

Freebsd with python installed in /usr/local/bin put pip into /usr/local/bin for me. Maybe it's still match to python_prefix... why did you changed it originally?

@asergeyev
Copy link

["freebsd"] => {
"default" => ["python"]

needs to be smarter than

if python['install_method'] == 'package'
default['python']['prefix_dir'] = '/usr'

@hectcastro
Copy link
Contributor Author

@asergeyev I changed it because it wasn't working on Ubuntu and there was no way to differentiate between Python's path and pip's.

This solution isn't super intelligent – it pushes the decision out to the cookbook user. I don't necessarily disagree with your opinion that the cookbook should be smarter though.

@asergeyev
Copy link

Interesting... ubuntu has easy_install in /usr/bin and when you install pip it ends up in usr/local

log.info("Installing %s script to %s", script_name, self.script_dir)

Now here:
echo 'import setuptools.command.easy_install as ei; print ei.easy_install.INSTALL_SCHEMES' | python -

gives on fedora:
{'posix': {'install_dir': '$base/lib/python$py_version_short/site-packages', 'script_dir': '$base/bin'}}

on debian squeeze:
{'posix': {'install_dir': '$base/lib/python$py_version_short/site-packages', 'script_dir': '$base/bin'}}

on some ubuntu
{'unix_local': {'install_dir': '$base/local/lib/python$py_version_short/dist-packages', 'script_dir': '$base/local/bin'}, 'posix': {'install_dir': '$base/lib/python$py_version_short/site-packages', 'script_dir': '$base/bin'}, 'deb_system': {'install_dir': '$base/lib/python3/dist-packages', 'script_dir': '$base/bin'}, 'posix_local': {'install_dir': '$base/local/lib/python$py_version_short/dist-packages', 'script_dir': '$base/local/bin'}}

on few versions of freebsd
{'posix': {'install_dir': '$base/lib/python$py_version_short/site-packages', 'script_dir': '$base/bin'}}

let me suggest a patch here...

@hectcastro
Copy link
Contributor Author

Looks like you already answered your previous question, but for completeness:

hcastro@graphite:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
hcastro@graphite:~$ which easy_install
/usr/local/bin/easy_install
hcastro@graphite:~$ which pip
/usr/local/bin/pip

I actually don't think I ever checked for easy_install's location pre-install.

@asergeyev
Copy link

https://github.com/asergeyev/python-cookbook/compare/mytakeonit
What do you think about this one?

@hectcastro
Copy link
Contributor Author

It's not my call, since I don't work for Opscode or manage their repositories. I think maybe the best approach is to suggest this on JIRA since they probably monitor that more than pull request discussions: http://tickets.opscode.com/browse/COOK-1169

@asergeyev
Copy link

If you'd like you may re-open that ticket and let them know. I'd give them a poke via pull request but their lawyers have put so many rules around "contributing to Opscode cookbooks" discouraging me from doing it.
Thank you a lot for quick collaboration.

petecheslock pushed a commit to petecheslock/python that referenced this pull request Jan 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants