-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Python purelib/platlib hardcoding breaks prefix detection with meson #120032
Comments
Given there's nothing technically wrong with our configuration and Fedora's configuration - which you're comparing our configuration to - is equally affected by this issue, this sounds like a Meson bug?
The problem is some packages bake this path into their installs and it is not a stable path.
purelib is not the correct way to retrieve base Python installation files - stdlib is. Unless I'm misunderstanding what you're saying.
Like Fedora, we use a system that makes our configuration not take effect in cases the prefix changes ( Python's sysconfig system is still extremely restrictive. There is no real system to swap out what Actually reading this again it sounds like Meson might be affected by the same shortcoming? |
Ah, that makes sense (but is unfortunate).
Sorry I mean to say 'build systems', not 'package managers'. I was trying to convey that build systems often have a destination directory (configured via some prefix) and install everything under there. Since there isn't really a good mechanism upstream in Python for this, its best guess would be to check sysconfig with What I was hoping for was Because the path is absolute and
Yeah, that's it - it seems like this is a gap in Python itself and everyone's is trying to work with what we have, but the net result is things don't interplay very well. I was hoping a change here could easily net positive results for meson and build systems using a similar technique, but the rationale you mentioned for preserving the absolute path makes sense. I don't think meson is doing anything wrong, it makes sense from its perspective to disallow writing files outside the configured prefix/destdir but on the other hand, it makes constructing the destination path difficult when python installations can use paths without |
Absolutely. This is awkward handling around an awkward ecosystem, if there's anything really to "blame" for the situation it's the fact that effectively undocumented interfaces have changed inside their undocumented guts and change is fragile. It doesn't help that python upstream doesn't have much of a usability story for /usr vs. /usr/local split and it's actually not exactly easy to reverse-engineer the venv vs. not-venv split either.
I'm not 100% sure what this means. In at least Fedora's case, the conflict was caused by the fact that Fedora patched sysconfig to say that when prefix is /usr, python files should still be installed to /usr/local, which needless to say is actually a Fedora bug because it's not like Fedora patches autotools to make --prefix=/usr install libraries to /usr/local/lib except inside of a Fedora buildroot, that would be insane. 🙄 But no, pip is special and magical and everyone has to design the entirety of the python packaging ecosystem around the assumption that pip, and only pip, is ever used. :D As far as virtualenvs go, I'm not sure what the problem is? Usually you do want virtualenvs to install into a different location from the global install path. That is, for example, why Fedora only patches "/local" into the scheme when it detects that you're not running in a virtualenv and you're not running inside of a Fedora rpm buildroot. Inside of a virtualenv, python's official scheme replacements for platbase and base are relative to the virtual environment, since sys.prefix is the virtual environment prefix (and the scheme detects the stdlib using base_prefix). This doesn't invalidate the concept of using those replacements -- it's just that sometimes distributors want the layout to have "literally nothing" to do with how python was installed, simply to stop pip from installing to it. And sysconfig doesn't have an option like |
Fedora fixed this in Fedora 37, fyi. I opened up a bug report in Fedora 36, which was subsequently fixed. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Leave it to stalebot to close valid issues in the name of project management. |
It's not clear what the right fix is, nor does it look like we have the bandwidth to work one out. We'll review a pull request for this, however. As a workaround, it may suffice to pass |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Sure. No one is asking for a fix this second or any time specifically. It just does users no good at all to have a stale bot closing valid issues. When users search for a bug report, GitHub hides closed issues by default, which will lead to a duplicate bug report. |
It does maintainers no good to have a never ending list of issues with no indication if they still occur. And when those are the options we optimise for the thing we have less of. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output" saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Install python module to brew-provided python using meson.
brew patches python's sysconfig with hardcoded, absolute paths to
/opt/homebrew/...
forpurelib
andplatlib
. This breaks prefix detection for installers like 'meson', rendering them unable to install python modules easily.This can be verified using
python3 -c "import pprint;import sysconfig; pprint.pprint(sysconfig.get_paths(vars={'base': '', 'platbase': '', 'installed_base': ''}, expand=False))"
.Fedora 37 (3.11.1)
brew python3.10
What happened (include all command output)?
Setting prefix=/ isn't helpful because then it gets the python paths right, but tries to install to read-only /bin, /share, etc.
What did you expect to happen?
Lack of a duplicate
/opt/homebrew/opt/homebrew
prefix.Since the constructed value
{platbase}/{platlibdir}/python{py_version_short}/site-packages
points to a symlink of/opt/homebrew/lib/python3.10/site-packages
anyways, please consider using it instead to permit build systems to construct paths using a user-specified prefix.This will permit package managers to obtain the path components under the brew python installation directory that they should apply along with the brew prefix.
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: