-
Notifications
You must be signed in to change notification settings - Fork 694
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
[bazel] [rules_foreign_cc] ModuleNotFoundError: No module named 'tools' #1420
Comments
This can't be the case, this module import is the first statement in emcc.py... I checked the contents of
|
I don't quite understand here. My understanding is that Meson is a build system like bazel. Are you using both at once? Is one invoking the other? |
Indeed, there is often a need in Bazel to build software that is primarily built using other build systems. In this case, I am looking at building numpy which uses the Meson build system. |
Finally got to the root cause of why the Since Meson is written in Python, it uses Bazel's |
@walkingeyerobot I think the solution to this problem is to unset the |
FWIW, I see a similar issue when trying to run Emscripten's test suite with Python 3.12. $ python -V
Python 3.12.4
$ ./test/runner other.*code_size* other.*metadce* --rebase
Traceback (most recent call last):
File "/home/kleisauke/emscripten/./test/runner.py", line 38, in <module>
import jsrun
File "/home/kleisauke/emscripten/test/jsrun.py", line 6, in <module>
import common
File "/home/kleisauke/emscripten/test/common.py", line 34, in <module>
import clang_native
File "/home/kleisauke/emscripten/test/clang_native.py", line 10, in <module>
from tools.shared import PIPE, run_process, CLANG_CC, CLANG_CXX
ModuleNotFoundError: No module named 'tools.shared' I'm currently working around this by removing the And by setting the |
@kleisauke, do you think that is somehow related? Is this related to PYTHONSAFEPATH? The runner.py script contains the following lines near the top.. can you figure out why they are not working:
|
3.12.2 seem to work find for me..
|
@sbc100 Sorry for the noise. I initially thought my issue was similar to this one, but it turns out to be different. It seems that installing Detectron2 triggers this issue: $ pip install 'git+https://github.com/facebookresearch/detectron2.git' After installation, it creates the following files in Python's per user site-packages directory ( $ ls $(python3 -m site --user-site)/tools
analyze_model.py benchmark.py convert-torchvision-to-d2.py __init__.py lazyconfig_train_net.py lightning_train_net.py plain_train_net.py __pycache__ train_net.py visualize_data.py visualize_json_results.py Since this path is included in Python's default search path, it conflicts with the tools directory in Emscripten. Here's a standalone reproducer: $ git clone https://github.com/emscripten-core/emscripten.git
$ cd emscripten
$ docker run -v $(pwd):/app -w /app -it fedora:40 sh -c 'mkdir -p $(python3 -m site --user-site)/tools && touch $(python3 -m site --user-site)/tools/__init__.py && python3 ./test/runner.py'
Traceback (most recent call last):
File "/app/./test/runner.py", line 38, in <module>
import jsrun
File "/app/test/jsrun.py", line 6, in <module>
import common
File "/app/test/common.py", line 34, in <module>
import clang_native
File "/app/test/clang_native.py", line 10, in <module>
from tools.shared import PIPE, run_process, CLANG_CC, CLANG_CXX
ModuleNotFoundError: No module named 'tools.shared' |
I guess that solution to that problem is to put our directory first in sys.path? |
This avoids issues where something called e.g. `tools` already exists in the python path. See emscripten-core/emsdk#1420 (comment)
This avoids issues where something called e.g. `tools` already exists in the python path. See emscripten-core/emsdk#1420 (comment)
…e#22230) This avoids issues where something called e.g. `tools` already exists in the python path. See emscripten-core/emsdk#1420 (comment)
When building a simple hello world binary with Meson, I am hitting the following error
Digging a bit deeper, it seems
emcc.py --version
is failing and unable to find the tools module.Perhaps this isn't included in the
compiler_files
filegroup which is passed to the toolchain?The text was updated successfully, but these errors were encountered: