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.

ImportError: cannot import name 'xla_data_pb2' - Jax, Broken on Colab after current release

See original GitHub issue

I use jax via trax, and today I got an error AttributeError: 'jaxlib.tpu_client_extension.TpuExecutable' object has no attribute 'ExecutePerReplica'

normally jax in Colab I install it using:

!pip install --upgrade -q jax

import requests
import os
if 'TPU_DRIVER_MODE' not in globals():
  url = 'http://' + os.environ['COLAB_TPU_ADDR'].split(':')[0] + ':8475/requestversion/tpu_driver0.1-dev20191206'
  resp = requests.post(url)
  TPU_DRIVER_MODE = 1

# The following is required to use TPU Driver as JAX's backend.
from jax.config import config
config.FLAGS.jax_xla_backend = "tpu_driver"
config.FLAGS.jax_backend_target = "grpc://" + os.environ['COLAB_TPU_ADDR']

However, when I saw there has been a new release I rolled back to the old one. After doing that via !pip install --upgrade -q jax==0.1.39 jaxlib===0.1.39 I started getting ImportError: cannot import name 'xla_data_pb2' on import config from jax which I fixed temporarily by doing url = 'http://' + os.environ['COLAB_TPU_ADDR'].split(':')[0] + ':8475/requestversion/tpu_driver_nightly'. However, then I started getting an error on import jax instead

I tried doing !pip upgrade pip but the best I could reach is ImportError: cannot import name 'xla_client' on import jax

And again, I can install the current jax but that doesn’t work with my version of trax, and I cannot install the older version of jax anymore at all.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hawkinspcommented, Mar 17, 2020

Done. I released jax v0.1.60 to pypi, which should fix the problem. Hope that helps!

1reaction
gneculacommented, Mar 17, 2020

We have just released jaxlib 0.1.41 yesterday, perhaps the Colab backend is not picking up that version?

Can you try:

!pip install --upgrade -q jax jaxlib
from jax import version as jax_version
print(jax_version.__version__)
from jaxlib import version as jaxlib_version
print(jaxlib_version.__version__)

I get 0.1.59 and 0.1.41.

Note that jax and jaxlib use separate version numbers, it is not correct to use !pip install --upgrade -q jax==0.1.39 jaxlib===0.1.39

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal with ImportError: cannot import name 'pytree' from ...
It appears that you are importing a much older jax version than you report in the question; jax.lib has not attempted to import...
Read more >
Getting DeepChem running in Colab - Community
... who are interested in using Colab. Paste the following into your first cell in your Colab not… ... ImportError: cannot import name...
Read more >
Unable to Import 'IEPlugin' Class in OpenVINO™... - Intel
Used IEPlugin in OpenVINO™ toolkit 2021 on Google* Colab Notebook. Encountered: ImportError: cannot import name 'IEPlugin' from 'openvino.inference_engine'.
Read more >
How to fix this Import error problem when training a model in ...
ImportError: cannot import name 'builder' from ... You need to upgrade to the latest version of the protobuf package as shown below.
Read more >
Fast.ai with Google Colab - Beginner (2018)
I heard that Google is providing free GPU through the Colab platform ... Hi thanks but this doesnt work for it wont import...
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