-
Notifications
You must be signed in to change notification settings - Fork 115
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
ModuleNotFoundError: No module named 'orjson.orjson' #165
Comments
I'm also seeing this on 22.04 |
Hack to use
where the patch file is:
|
Phew, any idea what's going wrong under the hood, guys? (I'm not succeeding in reproducing on macOS, which I what I have in front of me at the moment.) Does orjson otherwise work on your machine? E.g.
I'm trying to narrow down if it's orjson or Bazel's rules_python. I assume we're all on the latest version of this tool, and if via workspace, could I ask you to check that you've added the addition transitive import lines (all 4 🙄) and that it's at the top, just so some other tool isn't bringing in an old version of rules_python? |
I'm so sorry this has caused such a headache; we tried to switch to Bazel's new python infrastructure to not reply on system python and to be able to use packages, but they've had quite a few bugs. To try to narrow things down a bit more, a couple commits to try: Here's with rules python downgraded (use this tool's commit 4d56714)? If that works, great, temporarily. And if not let's zip you back to 6d58fa6, just to make sure all was working before moving to rules python. |
Thanks for having a look @cpsauer . Extra information from my end (not sure how much is useful or not):
I've been away from Bazel for a while, and just jumping back in now, but isn't the whole hermetic Bazel promise that things like this (i.e. it worked before but doesn't now) can't happen? Are Bazel modules / the tie in to package managers weakening this? Let me know if there's any more investigation I can do to help from my end. |
We're using Bazel 7 + the bzlmod installation instructions + @btalb's patch on top of commit 09fee2f, so no transitive import lines. We haven't switched our rules_python stuff to using bzlmod yet, so this tool is the only one requesting the BCR version of rules_python. $ bazel query 'deps(//:refresh_compile_commands)'
...
@@rules_python~0.29.0//python/config_settings:_is_python_3.11
@@rules_python~0.29.0//python/config_settings:_is_python_3.11_2
@@rules_python~0.29.0//python/config_settings:_is_python_3.11_3
@@rules_python~0.29.0//python/config_settings:_is_python_3.11_4
@@rules_python~0.29.0//python/config_settings:_is_python_3.11_5
@@rules_python~0.29.0//python/config_settings:_python_version_flag_equals_3.11
@@rules_python~0.29.0//python/config_settings:is_python_3.11
@@rules_python~0.29.0//python/config_settings:is_python_3.11.1
@@rules_python~0.29.0//python/config_settings:is_python_3.11.3
@@rules_python~0.29.0//python/config_settings:is_python_3.11.4
@@rules_python~0.29.0//python/config_settings:is_python_3.11.5
@@rules_python~0.29.0//python/config_settings:is_python_3.11.6
@@rules_python~0.29.0//python/config_settings:python_version
@@rules_python~0.29.0~pip~hedron_compile_commands_pip//orjson:pkg
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:_pkg
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:pkg
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/__init__.py
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson-3.9.12.dist-info/INSTALLER
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson-3.9.12.dist-info/METADATA
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson-3.9.12.dist-info/WHEEL
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson-3.9.12.dist-info/license_files/LICENSE-APACHE
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson-3.9.12.dist-info/license_files/LICENSE-MIT
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson/__init__.py
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson/__init__.pyi
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson/orjson.cpython-311-x86_64-linux-gnu.so
@@rules_python~0.29.0~pip~hedron_compile_commands_pip_311_orjson//:site-packages/orjson/py.typed |
Re hermetic preventing this: yes, it should, but rules_python is definitely causing a lot of issues. I think the move is to report these issues to rules_python, revert out usage of rules_python, and then return to rules_python when they've gotten things more usable. Sorry for all the headache here. Could I ask for one more round of your help here @btalb? Would you be down to report to rules_python, linking this issue and tagging me? They might ask to verify that your env was working with Python 3.11, so maybe worth a quick double check there, too. The revert, I'll work on... |
Mostly reverts 0e5b1aa Tracking restoration at #168 Please see - #163 - bazelbuild/rules_python#1732 - #165 - (rules_python issue to come) - #166 - bazelbuild/rules_python#1169
Reverted rules_python in 0b821b7. Tracking restoration in #168. That avoids this for now, but seriously, worth our working with them to get it fixed for future use; this'll be important in the future. (Just holler if you want me to reopen.) Thanks again for helping leave things better than you found them! |
Not sure if this is the result you were looking for @cpsauer ; but I just tried to do a repro for posting to
All the files:
|
Super appreciate your investigating--that definitely narrows things down considerably. |
I'll have a go at this sometime this week hopefully |
Thanks so much @btalb. Quite valuable for helping Bazel Python work out its quirks more generally--but also so this tool (and others) can move forward for y'all in the future. |
I've had another dig with this and haven't found much unfortunately:
Observations:
Unless there's something very targeted to try, I'm going to have to pause on this sorry. |
Baffling! I really appreciate your giving it a go. Super weird because that should be a parallel invocation, right? We weren't doing anything fancy; just a raw py_binary with a single source and dependency...doesn't get much simpler of a use case than that. genrule(
name = "generate_python",
outs = [hello_orjson.py],
cmd = """
cat > $(OUTS) <<EOF
import orjson
EOF
""",
)
py_binary(
name = "hello_orjson",
srcs = [":generate_python"],
deps = [requirement("orjson")]
) If that does not reproduce, and you do find yourself willing to experiment a little more, I think the next step would be to grab, e.g., c4918fa and cut it down until the issue goes away. That is repro, delete the WORKSPACE, repro, delete almost all the python except the import, repro, etc. |
Mostly reverts hedronvision/bazel-compile-commands-extractor@59dc7ff Tracking restoration at hedronvision/bazel-compile-commands-extractor#168 Please see - hedronvision/bazel-compile-commands-extractor#163 - bazelbuild/rules_python#1732 - hedronvision/bazel-compile-commands-extractor#165 - (rules_python issue to come) - hedronvision/bazel-compile-commands-extractor#166 - bazelbuild/rules_python#1169
mvukov/optimus#81:
This is what I get on my local machine w/ Ubuntu 22.04 (I also got the same error or another machine w/ the same OS).
The text was updated successfully, but these errors were encountered: