-
Notifications
You must be signed in to change notification settings - Fork 543
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
PyQt6 .dll/.so load fails on Windows 10 and Ubuntu #508
Comments
I ran into the same issue with PyQt5. I found one solution that uses a modified version of https://github.com/ali5h/rules_pip/blob/master/src/whl.py, but the AGPL license didn't work for my project. I dug deeper with
In Bazel 3.x, I could use After I updated to Bazel 4.x, the
I wish there was a better way to do this automatically. Pip installs all of the PyQt5 dependencies to the same directory so this extra redirection for library path isn't needed On Windows, hopefully doing something similar with the |
Turns out that this solution doesn't work on macOS because of System Integrity Protection that disables the use of I was able to manually set an RPATH for I could also copy the contents of |
Is this why the dlib resolving happens correctly outside of Bazel? Seems so, you say: "Pip installs all of the PyQt5 dependencies to the same directory so this extra redirection for library path isn't needed". I'd want to work out why PyQt6 in particular has this problem. Is its lib resolving logic non-hermetic, or making some assumption that's invalid in the Bazel context? Is the assumption something that's specified by some official Python packaging specification?
Would be good to have this workaround documented in this thread in case others arrive here with the same issue. |
Yes. This problem doesn't seem isolated to PyQt, but any package that ships libraries in this way. i.e. multiple modules can be added as dependencies, but they include dlibs with relative path information embedded into them that relies on other modules to be installed in the same root directory. I ran into this issue with pyobjc in addition to PyQt.
After the first
I reconstructed this command from the I was able to temporarily unblock my development by moving PyQt from a |
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. |
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?" |
I missed that this issue was marked stale. As far as I know, this issue doesn't have a solution. Can it be reopened? |
+1, I met the same issue. I believe this is not a good solution. Do we have any progress on this? |
Should a new bug be opened to continue discussion about the more general issue of using As pointed out by several people above, the underlying issue doesn't really have anything to do with the Because it was hard for me to parse the conversation above without just recreating the environment myself, I'll include a simple visual example. Let's pretend for simplicity that Then after a
however, since
There are many very common assumptions used in "standard" Python that can easily be broken by this change. In order from probably most well-known to least well-known IME:
Clearly, there are several approaches to knock out this problem in the general case, depending on how The first solution one might think of would be to just check at This would solve the particular case of requirements("napari"),
requirements("napari-extension-1"),
...
requirements("napari-extension-N"), This specification would happen in a Note that we cannot combine multiple If I understand the current setup of
Is there interest in supporting this (quite common) use-case? I know that my company (and several others) all solve this by simply running our own PyPI repo or constructing these "multi-source" artifacts out-of-band, but the overhead to do this for a smaller or newer company is quite high, and this seems like an easy-enough quality of life improvement that would acknowledge how Python is really used in the wild without exposing any significant new API surface (just the very simple |
I am reopening to keep the discussion context from above in one place. Thanks @bruno-digitbio for a nice write up. Macros that live in requirements.bzl are somewhat hard to maintain and they do increase the API surface in a way that may be difficult to deal with later. If I understand correctly, rules_py might be unaffected by this issue, because they are creating venv like folder structures for the final targets and maybe exploring that direction in rules_python would be good. However I cannot say for sure without a deeper look into this. That said I have been hit by some of the side effects in the past as well, see #1242. |
Thanks for the quick response and feedback!
After some squinting, I can see how adding a macro to a dynamically-generated filegroup(
name = "{site_packages_label}",
srcs = glob(["site-packages/**"], exclude=["site-packages/*.dist-info/**"], allow_empty = True),
) to the build file generation code be any better?
My first thought had actually also been to propose that full secondary venv-like layer should sit above the current If both are on the table, then I think I would agree that modifying |
I personally think we have to move carefully to not break existing usecases but at the same time solve the actual problem we are having and I think the friction of "Everything assumes to be in a venv like layout" with "we can have each package in a separate dir and just manipulate env vars" is there and we just have to be careful that any API extensions moves us closer to the end goal. As you mentioned previously, bigger companies that are more invested in Python bazel tooling have workarounds and it would be interesting to learn from these experiences - knowing what does and does not work if we go with the filegroup approach when attempting to change rules_python itself would be super useful. |
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. |
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?" |
@bruno-digitbio @aignas Curious if this discussion went anywhere? AFAICT this is a problem I'm having trying to use |
(And for anyone else that finds this thread, using the |
This is basically the duplicate of #2156. |
🐞 bug report
Affected Rule
I don't know. This is related to packaging the
.dll
s and.so
s of python requirements. The most similar looking issue is: #381Is this a regression?
I don't think so. I tested against
0.3.0
and0.2.0
Description
Running the
PyQt6
hello world example on Windows 10 fails due to being unable to find a PyQt.dll
. It also fails on Ubuntu, unable to find.so
files.🔬 Minimal Reproduction
https://github.com/driftregion/rules_python_pyqt_bug_example
This issue doesn't affect all python packages which use dynamic libraries. I have confirmed that pygame works. I have confirmed it is actually using the
.dll
s packaged byrules_python
by removing them at runtime but before import time and observing the same error thrown byPyQt
when a.dll
is unfindable.https://github.com/driftregion/rules_python_pyqt_bug_example/tree/pygame
🔥 Exception or Error
Windows
Ubuntu
🌍 Your Environment
Operating System:
Output of
bazel version
:Windows
Ubuntu
Rules_python version:
The text was updated successfully, but these errors were encountered: