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
Merged

Conversation

@chhantyal
Copy link
Contributor

@chhantyal chhantyal commented Aug 26, 2016

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 tdsmith commented Aug 26, 2016

It works except in virtualenvs, right?

@chhantyal
Copy link
Contributor Author

@chhantyal chhantyal commented Aug 26, 2016

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

@tdsmith
Copy link
Contributor

@tdsmith 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.

@tdsmith
Copy link
Contributor

@tdsmith tdsmith commented Aug 30, 2016

Can you elaborate on "doesn't work"?

@chhantyal
Copy link
Contributor Author

@chhantyal chhantyal commented Aug 30, 2016

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 label Aug 30, 2016
@chhantyal
Copy link
Contributor Author

@chhantyal 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 tdsmith commented Sep 2, 2016

Gotcha, thanks.

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

@MikeMcQuaid MikeMcQuaid commented Sep 20, 2016

@tdsmith Thoughts on 🚢ing this?

@MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Oct 8, 2016

@tdsmith

@MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Oct 12, 2016

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

@chhantyal
Copy link
Contributor Author

@chhantyal 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

@MikeMcQuaid MikeMcQuaid commented Oct 12, 2016

@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

@chhantyal chhantyal commented Oct 12, 2016

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

@MikeMcQuaid MikeMcQuaid commented Oct 12, 2016

No need to apologise, thanks @chhantyal.

@tdsmith
Copy link
Contributor

@tdsmith 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
A possible workaround (which puts executable scripts in `~/Library/Python/<X>.<Y>/bin`) is:

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

This comment has been minimized.

@tdsmith

tdsmith Nov 7, 2016
Contributor

Can you leave the text above this comment in place?

@chhantyal
Copy link
Contributor Author

@chhantyal chhantyal commented Nov 7, 2016

Alright. I rebased and put back command line option

@tdsmith
tdsmith approved these changes Nov 7, 2016
@tdsmith tdsmith merged commit 89e8222 into Homebrew:master Nov 7, 2016
1 of 2 checks passed
1 of 2 checks passed
@BrewTestBot
default Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@tdsmith
Copy link
Contributor

@tdsmith tdsmith commented Nov 7, 2016

Thanks!

@MichaelMallett
Copy link

@MichaelMallett MichaelMallett 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

@chhantyal chhantyal commented Jan 19, 2017

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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants