-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
installing formula with python requirement and system python #31229
Comments
I understand your frustration but there will always be edge cases. I'm trying to bottle against the system Python as much as possible but I haven't finished my work here yet and anything that provides bindings and has a bottle will be using a Homebrew Python unless you manually build that individual package from source. |
I'll try and investigate the |
Thanks for your response. Yes, hombrew and python can still be a PITA, but I believe it is going in a good direction. I am extremely grateful for all the work you put it. I usually don't have time to dig into these issues (I am spending a lot of time on other open source projects already), but I at least want to raise these issues here and point at use cases that are poorly supported. I know PR's, even half-baked, would be more useful :-/ First of all, can we agree on how this should work?
(*)
|
cc @wjwwood fyi |
No, I don't think so I'm afraid. We're supporting system Python for stuff that doesn't create bindings (i.e. applications like |
I see, I actually forgot about the bottles against system python for stuff without bindings (good idea IMO). Assuming I were able to install that combination as described in 3. above. Is there a technical reason that a formula with only indirect dependency on python (like gtk+) would not work if installed from bottle when the dependency that brings in python (gobject-introspection) is installed from source (and thus against system python)? |
There's probably not a technical reason but it's probably not something we'll support as it's a pretty niche case. |
Is it really a niche case? I was not suggesting that 3. is the way it should work. I wanted to know if there are technical hurdles for supporting 5. My main concern is that people who want to stick with system python have to carefully watch out for formulae that have a recursive dependency on python somehow and make sure to manually specifying |
If you have system Python installed you can still use Homebrew Python and vice-versa. If you want Homebrew Python to never be installed the only way around this is to always build-from-source. |
System python is always installed. Of course you can still use it after installing brewed python, but the default Do I understand you correctly that the default situation (not-niche case) for homebrew & python is -- and in your opinion should be -- that most users start out with system python only, and then (consciously or not) eventually switch to brewed python as the default, once they install a formula with a (recusive) python requiremnet? |
No, I don't agree with that. My opinion is that users who care about what Python is used by an individual package will build it from source. |
@MikeMcQuaid: You disagree with that statement, but you only provide your opinion on what people who care about what version of python is being used (in the sense that they make a consious choice about using either system or brewed python) should have to do. For those people, I agree that it is tolerable that they have to jump through some hoops to get exactly what they want. If they go for brewed python, they at some point decide to The "default situation" I was refering to above are users that don't care about exactly which python is being used. I would say these are the majority (would you disagree?). They may install formulae that are implemented with python (e.g. ansible), they may install formulae that have python bindings (e.g. The user installs homebrew, makes no choice about python and therefore starts of with system python only. She goes on to install and use stuff that does not depend on python, and keeps having system python only. At some point she wants to do some C++/opencv development. She Now this problem would not arise if homebrew would not have pulled in Does that example make sense? This is not just some made up scenario. These kind of things are actually happening to people. |
These people should submit issues if it's affecting them. Until there's a bunch of those issues I don't think we should stop providing bottles to all people unless they have installed Homebrew We need to make a decision about the best approach to take. Every approach is going to make some people unhappy. I'm afraid I don't want to talk about this any more; I've spent far, far too long fixing all the Python stuff (which I don't use) for almost zero thanks from the community and constant criticism. If you think we should change the way we're doing this: submit pull requests and we'll talk about them. |
Fine. This is exactly what I wanted to do, discuss how it should work vs how it currently works. You can not expect people to support patches when it is not documented how things are intended to work and you are also not willing to discuss it before hand. How are people supposed to know what is a bug and what a "limitation" of the currently chosen design? At least I have failed to realize the distinction a number of times now. With all respect Mike, I believe this is mostly an issue of communication. Here and in other discussions I sometimes feel like issues raised are not acknowledged at all (while maybe they are actually perfectly understood). I can live with "yes, we know this problem exists, but the alternative has also downsides which we think weigh heavier because it affects more people" or "yes, we know this problem exists; it would be great if it worked differently, but noone of us has time to implement that", but if you simply reply with "we will likely not support this, sorry; please provide a PR with proposed changes to discuss there" I feel like the issue raised is not being understood and I might start arguing strongly why I think it is a problem. Please don't mistake that as criticism of your work. I will leave it at that. To repeat what I said above: I am extremely grateful for your work. For my personal usage, the homebrew & python situation has really improved as I can take advantage of an increasing number of bottled python-related formulae. So thank you, Mike, for your effort! |
The problem is when speculative issues are raised as actual issues. Stuff like "these kind of things are actually happening to people" is unhelpful, honestly. Which people? When? Have they filed issues on Homebrew? If not, why not? It feels like around the Python stuff in particular there has been a lot of talking about potential issues and very few PRs for actual being submitted. This isn't helpful, really; it means the maintainers spend their time reading walls of text and even after that are unable to work out how to fix a problem. For example, if you were filing this issue again the best way would be to:
If you're happy to restate the original issue in that format I'm happy to try and elaborate more. |
I will try to improve the way I raise issues according to your guidelines. I can see that this will be more helpful. I might revisit this issue in that format when I get around to it. Thank you. |
This issue described by Nikolause is not purely speculative. Today I ran into the exact problematic use case Nikolause described - first installing packages against system python, and having them disappear because brew unexpectedly installed brewed python when installing pyqt. I believe the pyqt formula must have changed since I don't recall this happening last year, and I'd wager that others have run into this issue but not filed a git issue. Is a warning presented when brew installs python as a dependency? Is brew now less friendly to users of the system python. Is there a way to brew pyqt against the system python and avoid having it install brewed python? If so, would you mind explaining? I'm sorry, but despite looking at the formula, reading the various brew/python help pages, and reading the discussion above about "--build-from-souce", I'm still unclear how to use brew with the system python. Thanks, |
Insofar as we use the brewed Python for some things now without users requesting it: yes.
brew install pyqt --build-from-source |
Thank you for your help. I ran: Based on the discussion above, I believe it was necessary to avoid letting pyqt install the sip dependency because this would have installed brewed python, correct? The relationship between --build-from-source and whether or not brewed python is installed is unintuitive to me (probably because I don't understand the inner working of homebrew/bottling) and can result in strange behavior. Is this the documented somewhere? I don't see this information on the Homebrew and Python page: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md Perhaps it be possible to print a warning when brew installs python as a dependency and masks the system python? The warning could mention that --build-from-source can be used to avoid this. Also, I realized today that the gstreamer Formula does not list python as a dependency, but none the less installs python and hides system python. Thanks |
The docs should probably be updated, yes. I would also say that the system Python can still be used, you'll just need to put it before the Homebrew Python in your PATH. |
Regarding system python still being usable, the problem will be that the installed package (e.g. pyqt) will have been built against the brewed python. In my experience if you try to import this into the system python, there is a decent chance you'll end up with a segmentation fault. |
A note about that: segfault on import is often an artifact of libraries improperly linking against a Python framework at build time. Homebrew Python and Apple Python should be binary-compatible for extension modules. Things that are imported from Python (as opposed to embedding Python) should be (but often aren't) built with |
Thanks for the information - that will probably come in handy in the future. |
@tdsmith I worked on this a bit and gave up so might be worth sharing notes. They should be binary compatible but I've not found out a way of consistently making it so. @nerduno Yes and unfortunately when I had the opposite I had the Homebrew Python users complaining. There's no solution that will make everyone happy, unfortunately. |
Thanks for all your help. As we discussed above, my two-cents is that documentation could help a Thus adding a warning or message like: "Brewed python will be installed and If the functionality were changeable, I might consider adding a -a On Wed, Oct 29, 2014 at 6:14 AM, Mike McQuaid notifications@github.com
|
I'm going to try and add some when I get the chance.
Perhaps just say "building against /usr/bin/python
Sadly the more people try to convince me this is a good idea I'm increasingly thinking we should never use the system Python for anything that requires bindings. It's really, really, really error-prone the way Python bindings are handled and we've gone back and forth many times trying to work out how to do it better and fail every time. Obviously none of this was probably known to you or your fault but just explaining why things are the way they are. |
@tdsmith Open to your input here. |
I don't know if you wanted more half-baked ideas but has Homebrew tried only pouring :python bottles if the python in PATH is Homebrew python? Building pyqt from source isn't a great user experience but I think it's less surprising than having a new Python appear in PATH, especially if brew install ohai's an explanation of why the user isn't getting a bottle. |
@tdsmith We did something like that previously and people got even more confused, unfortunately. Perhaps a drastic solution here is we depend on Python for more things but make it keg-only? |
Yeah, I thought about it but I don't think that helps in either major case. If For users who are installing pyqt because it's a dependency of something else, I guess we could bundle pyqt into libexec. (If pyqt were cellar :any, I might not even be joking.) I guess the long-term solution here remains variant support for bottles; I wonder about a keg-only
I don't mean to be tendentious but was that confusion really widespread? I'm happier defending fail-to-pour in principle but I agree that doing something that works for users is more important than being principled. I went looking for confused-user stories on the tracker and only came up with #28281, where the complaint seems to be about the message rather than the behavior. |
I'd rather bottle everything against the system Python but then Homebrew Python people complain the opposite.
I'm against variant support for bottles. That bottles currently use the default configuration is a feature rather than a bug; they handle the majority case and reduce errors in that case. If people have special needs they should build from source and be able to handle the errors that may result from doing so.
I guess we read differently; most of that thread to me reads as "I want to use Homebrew Python and the Boost bottle". Perhaps the long-term solution is you set an environment variable "HOMEBREW_PYTHON_DEVELOPER" and then everything is built from source against the Homebrew Python and otherwise everything is built against the system Python (although I suspect people will still complain that they want to enable that and e.g. still use a boost bottle). That seems more Homebrew'y as we don't force an extra dependency or linked system duplicate on people who don't want it (which I'd guess is the majority case). By this point though I really hate anything including the words "Homebrew" and "Python". |
Greetings, I found this issue because it is one of 2 issues which mention |
So with the recent python changes, bottles for formulae that require python (
depends_on :python
). I thought the idea was that when the user does not use brewed python, these formulae are built from source. It turns out this does not happen automatically. Rather, I have to specify--build-from-source
manually, otherwise brewed python is pulled in.This is especially awkward if the python requirement is only a recursive requirement. It turns out, this is not only inconvenient but actually broken:
brew deps gtk+ -1
reveals no python dependencybrew deps gtk+ --tree
indicates a recursive:python
dependency viagobject-introspection
.Assume I have a setup with brewed python and gtk+ installed. I now do
brew uninstall python gtk+
. Following this withbrew install gtk+
would pull in brewed python as a dependecy. However if instead I executebrew install gtk+ --build-from-source
, it does not pull in brewed python (butgobject-introspection
is still installed from bottle). The fact that I installgtk+
from source should have no influence on the choice of brewed vs system python.The text was updated successfully, but these errors were encountered: