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.

jaxlib.mlir._mlir_libs._mlir overrides python's logging module config.

See original GitHub issue

Description

Importing jaxlib.mlir._mlir_libs._mlir (and by extension any modules depending on these, including jaxlib and jax), seems to render python’s logging module unable to work.

I have a script test.py:

import logging
import importlib
import sys

logger = logging.getLogger(__name__)

import jax
logging.basicConfig(level=logging.INFO)
# import jax

logger.info('Test')

Running python -m test results in no logging output. If the second import statement, after the logging.basicConfig, is used instead of the first, then the expected INFO:__main__:Test line appears. If another module e.g. numpy is used instead of jax, the log line appears. I also do see the log line when using jax==0.3.14, jaxlib==0.3.14 - it disappears on version 0.3.15-0.3.18.

By looking at sys.modules before and after the import, the module that replicates this behaviour with the smallest number of dependencies appears to be jaxlib.mlir._mlir_libs._mlir.

What jax/jaxlib version are you using?

jax >=0.3.14, jaxlib >=0.3.14

Which accelerator(s) are you using?

CPU

Additional system info

Linux

NVIDIA GPU info

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hawkinspcommented, Dec 6, 2022

The upstream LLVM fix was merged. This should be fixed as part of the next jaxlib release.

0reactions
hawkinspcommented, Nov 28, 2022

I guess we’re still waiting for the MLIR fix to be merged…

Read more comments on GitHub >

github_iconTop Results From Across the Web

MLIR Python Bindings
There are likely two primary use cases for the MLIR python bindings: ... Parse a module in standalone_ctx (override the context manager). Module.parse("....
Read more >
python - Using logging in multiple modules - Stack Overflow
Best practice is, in each module, to have a logger defined like this: import logging logger = logging.getLogger(__name__).
Read more >
Logging in Python with sub-modules and configuration files
Python logging introduces lots of concepts and configuration options. I'm going to smooth them out for good.
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