Build from source succeeds but subsequent `import`s fail - also ERROR: Configuration file not found: grain/third_party/py/grain/oss/copy.bara.sky
- Dominant language
- Python
- Stars
- 779
- Forks
- 86
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 6
Description
@ 77c56dc with Python (CPython) 3.10.16, setuptools 75.6.0, wheel 0.45.1 on x86_64 Linux:
```sh
$ python -m pip install .
$ python -m pip install jax
$ cd /tmp # to ensure PATH isn't being used
$ python -c 'import grain.python as grain'
Traceback (most recent call last):
File "", line 1, in
File "grain/grain/python.py", line 21, in
from . import python_experimental as experimental
File "grain/grain/python_experimental.py", line 53, in
from ._src.python.dataset.transformations.shuffle import WindowShuffleMapDataset
File "grain/grain/_src/python/dataset/transformations/shuffle.py", line 22, in
from grain._src.python.experimental.index_shuffle.python import index_shuffle_module as index_shuffle
ImportError: cannot import name 'index_shuffle_module' from 'grain._src.python.experimental.index_shuffle.python' (unknown location)
```
Ok so let's dig into your GitHub Actions to see if there's a hint on how to build; since the standard method didn't err:
```sh
# from repository root:
$ bazel build ... --action_env PYTHON_BIN_PATH="$(which python)"
```
```
ERROR: Skipping 'grain': error loading package 'grain': Unable to find package for @@[unknown repo 'bazel_skylib' requested from @@]//:bzl_library.bzl: The repository '@@[unknown repo 'bazel_skylib' requested from @@]' could not be resolved: No repository visible as '@bazel_skylib' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration.
ERROR: error loading package 'grain': Unable to find package for @@[unknown repo 'bazel_skylib' requested from @@]//:bzl_library.bzl: The repository '@@[unknown repo 'bazel_skylib' requested from @@]' could not be resolved: No repository visible as '@bazel_skylib' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration
```
Ok that failed, so let's try the scripted approach recommended in your [`build.md`](grain/oss/build.md):
```
$ ./grain/oss/runner.sh
+ SOURCE_DIR=grain
+ OUTPUT_DIR=/tmp/grain
+ mkdir -p /tmp/grain
+ copybara grain/third_party/py/grain/oss/copy.bara.sky local .. --init-history --folder-dir=/tmp/grain --ignore-noop
Dec 20, 2024 9:45:46 P.M. com.google.copybara.Main configureLog
INFO: Setting up LogManager
Copybara source mover (Version: Unknown version)
Task: Running migrate
ERROR: Configuration file not found: grain/third_party/py/grain/oss/copy.bara.sky
ERROR: Try 'copybara help'.
```
Contributor guide
Assessment
This issue has not been assessed yet.