Bug: wandb_gql import fails with W&B SDK >=0.27.1
Package: prime-rl
File: prime_rl/utils/monitor/wandb.py
Commit: 256809b (latest main)
Description
prime_rl/utils/monitor/wandb.py imports from wandb_gql import gql — a private, vendored module that was bundled inside the W&B Python SDK. W&B SDK v0.27.1 removed this vendored module as part of PR #11818 (routing GraphQL through wandb-core).
This means a fresh pip install prime-rl resolves to wandb>=0.27.1 and fails at import time:
$ python3 -c "from prime_rl.utils.monitor.wandb import WandbMonitor"
Traceback (most recent call last):
...
File "prime_rl/utils/monitor/wandb.py", line 18, in <module>
from wandb_gql import gql
ModuleNotFoundError: No module named 'wandb_gql'
This also breaks the orchestrator and rl entrypoints since the monitor is imported at startup:
File "/home/ubuntu/wordle/.venv/bin/orchestrator", line 10, in <module>
sys.exit(main())
...
File "prime_rl/utils/monitor/wandb.py", line 18, in <module>
from wandb_gql import gql
ModuleNotFoundError: No module named 'wandb_gql'
Root Cause
The file uses two private/internal APIs from the wandb SDK:
from wandb_gql import gql — wandb_gql was a vendored copy of the gql GraphQL library inside wandb/vendor/gql-0.2.0/wandb_gql/. W&B SDK v0.27.1 deleted it.
wandb.Api().client.execute() — wandb.Api().client was the gql.Client instance. The modern replacement is wandb.Api()._service_api.execute_graphql().
Both were never public API — they were internal implementation details that happened to be importable.
Fix
Replacement API: wandb.Api()._service_api.execute_graphql() accepts a raw GraphQL query string (no gql() parsing needed) and returns a plain dict — same shape as before.
Changes (3 lines in one file)
File: prime_rl/utils/monitor/wandb.py
1. Remove the import (line 18):
-from wandb_gql import gql
2. Replace gql() parsing + client.execute() with raw string + execute_graphql():
-def list_views(entity: str, project: str) -> list[tuple[str, str]]:
- query = gql(
- """
+def list_views(entity: str, project: str) -> list[tuple[str, str]]:
+ query = """
query Views($entity: String!, $project: String!) {
project(name: $project, entityName: $entity) {
allViews(viewType: "project-view") { edges { node { name displayName } } }
}
}
- """
- )
- res = wandb.Api().client.execute(query, variable_values={"entity": entity, "project": project})
+ """
+ res = wandb.Api()._service_api.execute_graphql(query, {"entity": entity, "project": project})
That's it. The _service_api attribute exists in wandb SDK v0.27.0+ (earlier versions had client). Since v0.27.1 is required for the vendored wandb_gql removal to be a problem, this is always available.
Verified
- Python 3.12, wandb 0.28.1 (latest)
WandbMonitor imports successfully
list_views imports successfully
- Full
rl @ config.toml --dry-run passes
- No dependency pins or workarounds needed
Workaround (temporary)
Until this fix lands upstream, pin wandb<0.27.1:
uv pip install "wandb<0.27.1"
Context
This is the same issue that affected wandb-workspaces (fixed in v0.4.2) and the W&B MCP server (temporarily worked around with wandb<0.27.1 cap, then resolved by upgrading wandb-workspaces).
References
Bug:
wandb_gqlimport fails with W&B SDK >=0.27.1Package: prime-rl
File:
prime_rl/utils/monitor/wandb.pyCommit:
256809b(latest main)Description
prime_rl/utils/monitor/wandb.pyimportsfrom wandb_gql import gql— a private, vendored module that was bundled inside the W&B Python SDK. W&B SDK v0.27.1 removed this vendored module as part of PR #11818 (routing GraphQL throughwandb-core).This means a fresh
pip install prime-rlresolves towandb>=0.27.1and fails at import time:This also breaks the
orchestratorandrlentrypoints since the monitor is imported at startup:Root Cause
The file uses two private/internal APIs from the wandb SDK:
from wandb_gql import gql—wandb_gqlwas a vendored copy of thegqlGraphQL library insidewandb/vendor/gql-0.2.0/wandb_gql/. W&B SDK v0.27.1 deleted it.wandb.Api().client.execute()—wandb.Api().clientwas thegql.Clientinstance. The modern replacement iswandb.Api()._service_api.execute_graphql().Both were never public API — they were internal implementation details that happened to be importable.
Fix
Replacement API:
wandb.Api()._service_api.execute_graphql()accepts a raw GraphQL query string (nogql()parsing needed) and returns a plain dict — same shape as before.Changes (3 lines in one file)
File:
prime_rl/utils/monitor/wandb.py1. Remove the import (line 18):
-from wandb_gql import gql2. Replace
gql()parsing +client.execute()with raw string +execute_graphql():That's it. The
_service_apiattribute exists in wandb SDK v0.27.0+ (earlier versions hadclient). Since v0.27.1 is required for the vendoredwandb_gqlremoval to be a problem, this is always available.Verified
WandbMonitorimports successfullylist_viewsimports successfullyrl @ config.toml --dry-runpassesWorkaround (temporary)
Until this fix lands upstream, pin
wandb<0.27.1:Context
This is the same issue that affected
wandb-workspaces(fixed in v0.4.2) and the W&B MCP server (temporarily worked around withwandb<0.27.1cap, then resolved by upgradingwandb-workspaces).References