Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not recommend pip install --prefix=<empty> hack, this breaks default pip command #821

Merged
merged 2 commits into from
Nov 7, 2016

Conversation

chhantyal
Copy link
Contributor

Hi,

Please do not recommend pip install --prefix=<empty>

This works with --targetor --user option, but breaks normal/default pip operations.

pip install package won't work anymore. Tested on OSX. Because of this recommendation, people are getting weird errors like here Homebrew/legacy-homebrew#44836

That recommendation is also top recommendation on this answer http://stackoverflow.com/questions/24257803/distutilsoptionerror-must-supply-either-home-or-prefix-exec-prefix-not-both

But see the user comments on first answer.

@tdsmith
Copy link
Contributor

tdsmith commented Aug 26, 2016

It works except in virtualenvs, right?

@chhantyal
Copy link
Contributor Author

Nope, it doesn't work with brew installed python which contains pip and setuptools

@tdsmith
Copy link
Contributor

tdsmith commented Aug 26, 2016

Both pip install --user --install-option="--prefix=" tweepy and pip install --user tweepy work fine for me as of this writing.

@UniqMartin UniqMartin added the python Homebrew/brew's python support label Aug 29, 2016
@tdsmith
Copy link
Contributor

tdsmith commented Aug 30, 2016

Can you elaborate on "doesn't work"?

@tdsmith tdsmith added the needs response Needs a response from the issue/PR author label Aug 30, 2016
@chhantyal
Copy link
Contributor Author

Sorry I removed the brew python, thus can't do testing right now. I will update with details soon.
In my case, it was with ~/.pydistutils.cfg config file with prefix=

@ghost ghost removed the needs response Needs a response from the issue/PR author label Aug 30, 2016
@chhantyal
Copy link
Contributor Author

chhantyal commented Aug 30, 2016

Ok, here is how to reproduce:

Add ~/.pydistutils.cfg with (as recommended in docs)

[install]
prefix=

Now run pip install requests

Collecting requests
  Using cached requests-2.11.1-py2.py3-none-any.whl
Installing collected packages: requests
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/lib/python2.7/site-packages/requests'

@tdsmith
Copy link
Contributor

tdsmith commented Sep 2, 2016

Gotcha, thanks.

@tdsmith tdsmith self-assigned this Sep 2, 2016
@MikeMcQuaid
Copy link
Member

@tdsmith Thoughts on 🚢ing this?

@MikeMcQuaid
Copy link
Member

@tdsmith

@MikeMcQuaid
Copy link
Member

Passing on this for now but @tdsmith feel free to apply any of this.

@chhantyal
Copy link
Contributor Author

chhantyal commented Oct 12, 2016

Hi, any reason this and related issue both are closed without it being resolved? Keeping them open would get attentions eventually?

@MikeMcQuaid
Copy link
Member

@chhantyal There's been no activity or conversation on them so there's little point in leaving them open for now. @tdsmith may disagree.

@chhantyal
Copy link
Contributor Author

If you keep issue open, may be maintainers and other contributors would try to fix whenever they are free. When you close, it's going to be hidden and people probably won't find.

Anyway, that's how I view Github issues. Obviously, everybody has different opinion.
Sorry for bugging you again.

@MikeMcQuaid
Copy link
Member

No need to apologise, thanks @chhantyal.

@tdsmith
Copy link
Contributor

tdsmith commented Nov 7, 2016

Okay, I agree the pydistutils.cfg section doesn't work (pip got smarter!), but the command-line form still does.

@tdsmith tdsmith reopened this Nov 7, 2016
@tdsmith tdsmith added the in progress Maintainers are working on this label Nov 7, 2016
A possible workaround (which puts executable scripts in `~/Library/Python/<X>.<Y>/bin`) is:

pip install --user --install-option="--prefix=" <package-name>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave the text above this comment in place?

@tdsmith tdsmith added the needs response Needs a response from the issue/PR author label Nov 7, 2016
@BrewTestBot BrewTestBot removed the needs response Needs a response from the issue/PR author label Nov 7, 2016
@chhantyal
Copy link
Contributor Author

Alright. I rebased and put back command line option

@tdsmith tdsmith merged commit 89e8222 into Homebrew:master Nov 7, 2016
@tdsmith tdsmith removed the in progress Maintainers are working on this label Nov 7, 2016
@tdsmith
Copy link
Contributor

tdsmith commented Nov 7, 2016

Thanks!

@mminklet
Copy link

mminklet commented Jan 19, 2017

I don't understand what the resolution to the actual problem was. Looks like the recommendation is removed with no alternative. Trying suggested commandline options doesn't work
pip install --install-option="--prefix=" tweepy -t .

Same error. Removed Homebrew python + pip for now.

@chhantyal
Copy link
Contributor Author

Yup, you are right. There is no alternative if you use homebrew python.

@Homebrew Homebrew locked and limited conversation to collaborators Jan 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
python Homebrew/brew's python support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants