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.

[BUG] `AttributeError` on import with protobuf 3.18.1

See original GitHub issue

Willingness to contribute

Yes. I would be willing to contribute a fix for this bug with guidance from the MLflow community.

MLflow version

1.26.1

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 11
  • Python version: 3.9
  • yarn version, if running the dev UI: n/a

Describe the problem

With MLflow 1.26.1, I am getting an AttributeError at import when using older versions of protobuf (in my case, 3.18.1) that are still permitted by the conda recipe’s protobuf >=3.7.0 constraint.

This seems to be a relatively new issue that does not impact MLflow 1.26.0; this also only seems to be impacting Windows, as the same environment on Linux machines does not result in failures.

Tracking information

No response

Code to reproduce issue

Create a conda environment on Windows with latest MLflow and an older version of protobuf:

$ conda create -n mlflow-repro python=3.9 mlflow=1.26.1 protobuf=3.18.1
$ conda activate mlflow-repro

Attempt to run mlflow:

$ mlflow

Other info / logs

Traceback (most recent call last):
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\Scripts\mlflow-script.py", line 6, in <module>
    from mlflow.cli import cli
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\__init__.py", line 32, in <module>
    import mlflow.tracking._model_registry.fluent
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\tracking\__init__.py", line 8, in <module>
    from mlflow.tracking.client import MlflowClient
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\tracking\client.py", line 16, in <module>
    from mlflow.entities import Experiment, Run, RunInfo, Param, Metric, RunTag, FileInfo, ViewType
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\entities\__init__.py", line 6, in <module>
    from mlflow.entities.experiment import Experiment
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\entities\experiment.py", line 2, in <module>
    from mlflow.entities.experiment_tag import ExperimentTag
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\entities\experiment_tag.py", line 2, in <module>
    from mlflow.protos.service_pb2 import ExperimentTag as ProtoExperimentTag
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\protos\service_pb2.py", line 18, in <module>
    from .scalapb import scalapb_pb2 as scalapb_dot_scalapb__pb2
  File "C:\Users\geniu\mambaforge\envs\mlflow-test\lib\site-packages\mlflow\protos\scalapb\scalapb_pb2.py", line 22, in <module>
    options = DESCRIPTOR.extensions_by_name['options']
AttributeError: 'NoneType' object has no attribute 'extensions_by_name'

What component(s) does this bug affect?

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/projects: MLproject format, project running backends
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/server-infra: MLflow Tracking server backend
  • area/tracking: Tracking Service, tracking client APIs, autologging

What interface(s) does this bug affect?

  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/docker: Docker use across MLflow’s components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

What language(s) does this bug affect?

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

What integration(s) does this bug affect?

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

3reactions
starovoitovscommented, Sep 21, 2022

Installing protobuf==3.20.1 solved the issue.

0reactions
dbczumarcommented, Jun 22, 2022

@charlesbluca Glad that installation from PyPI resolved the issue. It does seem to be a problem with the conda package. I’m going to go ahead and close this issue; hopefully the resolution is useful for others who may encounter the same issue with protobuf installation from conda. Thank you for using MLflow!

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'google.protobuf.descriptor' has no attribute ...
I encountered it while executing from object_detection.utils import label_map_util in jupyter notebook. It is actually the tensorflow ...
Read more >
protobuf · PyPI
protobuf 4.21.12 · Project description · Project details · Release history Release notifications | RSS feed · Download files · Help · About...
Read more >
CHANGES.txt - Google Git
Improved the error message when AttributeError is returned from __getattr__ ... [experimental] fast import protobuf module, only works with cpp generated ...
Read more >
attribute error while importing compiled protos in python
to Protocol Buffers. I have compiled protos in python and i want to use them in my python project while importing those protos...
Read more >
FindProtobuf — CMake 3.25.1 Documentation
Locate and configure the Google Protocol Buffers library. ... List of additional directories to be searched for imported .proto files. Protobuf_DEBUG.
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