question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kfp.compiler.Compiler.compile() failed with Bazel due to kfp.CHECK_TYPE not found

See original GitHub issue

What steps did you take:

I use Bazel to compile the pipeline. It has been working for kfp==1.0.0 but failed for kfp>=1.1.2.

Environment:

python==3.8.5 bazel==3.2.0

KFP SDK version: kfp==1.1.2 as well as kfp==1.3.0

Anything else you would like to add:

Traceback from kfp==1.1.2

.../pypi_kfp/kfp/compiler/compiler.py", line 917, in compile
    type_check_old_value = kfp.TYPE_CHECK
AttributeError: module 'kfp' has no attribute 'TYPE_CHECK'

I suspect that the pkgutil style namespace packaging breaks the import (at least in Bazel) https://github.com/kubeflow/pipelines/blob/1.1.2/sdk/python/kfp/__init__.py#L17

/kind bug /area sdk

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
cristifalcascommented, Apr 12, 2022

This error comes from 2 things:

Rules python will make that kfp folder from kfp-pipeline-spec a module and, after that, python will try to load ‘TYPE_CHECK’ from there and everything fails.

As a workaround you need to delete the generated __init__.py file from bazel path.

Something like this before loading the kfp module:

import sys

for module_path in sys.path:
    if module_path.endswith("nameused_kfp_pipeline_spec"):
        os.remove(f"{module_path}/kfp/__init__.py")

replace the path with whatever you have named your pip_parse/pip_install call in WORKSPACE.

Or open an issue with rules_python for a proper fix

0reactions
pyang-auroracommented, Apr 12, 2022

Given that the original goal for adopting namespace package style is to ensure the protobuf generated python modules can be accessed under the same kfp namespace, would it be possible to bundle them at release time?

Read more comments on GitHub >

github_iconTop Results From Across the Web

kfp.compiler.compiler — Kubeflow Pipelines documentation
[docs]class Compiler(object): """DSL Compiler that compiles pipeline functions into workflow yaml. Example: How to use the compiler to construct workflow ...
Read more >
Bazel fails to compile TypeScript project - node.js
I'm using the nodejs_rules for bazel. Anyhow the TypeScript compiler genrates the transpiled .js files. The yarn install seems to have worked ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found