Skip to content

Commit 5ba4759

Browse files
authored
Merge pull request #202496 from Blackmist/protobuf-error
Protobuf error
2 parents daa16c6 + d411c63 commit 5ba4759

File tree

3 files changed

+113
-3
lines changed

3 files changed

+113
-3
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: "Troubleshoot `descriptors cannot not be created directly`"
3+
titleSuffix: Azure Machine Learning
4+
description: Troubleshooting steps when you get the "descriptors cannot not be created directly" message.
5+
services: machine-learning
6+
ms.service: machine-learning
7+
ms.subservice: core
8+
author: Blackmist
9+
ms.author: larryfr
10+
ms.topic: troubleshooting
11+
ms.date: 06/22/2022
12+
---
13+
14+
# Troubleshoot `descriptors cannot not be created directly` error
15+
16+
When using Azure Machine Learning, you may receive the following error:
17+
18+
```
19+
TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.” It is followed by the proposition to install the appropriate version of protobuf library.
20+
21+
If you cannot immediately regenerate your protos, some other possible workarounds are:
22+
1. Downgrade the protobuf package to 3.20.x or lower.
23+
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
24+
```
25+
26+
You may notice this error specifically when using AutoML.
27+
28+
## Cause
29+
30+
This problem is caused by breaking changes introduced in protobuf 4.0.0. For more information, see [https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates](https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates).
31+
32+
## Resolution
33+
34+
For a local development environment or compute instance, install the Azure Machine Learning SDK version 1.42.0.post1 or greater.
35+
36+
```bash
37+
pip install azureml-sdk[automl,explain,notebooks]>=1.42.0
38+
```
39+
40+
For more information on updating an Azure Machine Learning environment (for training or deployment), see the following articles:
41+
42+
* [Manage environments in studio](how-to-manage-environments-in-studio.md#rebuild-an-environment)
43+
* [Create & use software environments (SDK v1)](how-to-use-environments.md#update-an-existing-environment)
44+
* [Create & manage environments (CLI v2)](how-to-manage-environments-v2.md#update)
45+
46+
To verify the version of your installed SDK, use the following command:
47+
48+
```bash
49+
pip show azureml-core
50+
```
51+
52+
This command should return information similar to `Version: 1.42.0.post1`.
53+
54+
> [!TIP]
55+
> If you can't upgrade your Azure Machine Learning SDK installation, you can pin the protobuf version in your environment to `3.20.1`. The following example is a `conda.yml` file that demonstrates how to pin the version:
56+
>
57+
> ```yml
58+
> name: model-env
59+
> channels:
60+
> - conda-forge
61+
> dependencies:
62+
> - python=3.8
63+
> - numpy=1.21.2
64+
> - pip=21.2.4
65+
> - scikit-learn=0.24.2
66+
> - scipy=1.7.1
67+
> - pandas>=1.1,<1.2
68+
> - pip:
69+
> - inference-schema[numpy-support]==1.3.0
70+
> - xlrd==2.0.1
71+
> - mlflow== 1.26.0
72+
> - azureml-mlflow==1.41.0
73+
> - protobuf==3.20.1
74+
> ```
75+
76+
## Next steps
77+
78+
For more information on the breaking changes in protobuf 4.0.0, see [https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates](https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates).
79+
80+
For more information on updating an Azure Machine Learning environment (for training or deployment), see the following articles:
81+
82+
* [Manage environments in studio](how-to-manage-environments-in-studio.md#rebuild-an-environment)
83+
* [Create & use software environments (SDK v1)](how-to-use-environments.md#update-an-existing-environment)
84+
* [Create & manage environments (CLI v2)](how-to-manage-environments-v2.md#update)

articles/machine-learning/how-to-troubleshoot-serialization-error.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,40 @@ ms.date: 06/15/2022
1414

1515
# Troubleshoot "cannot import name 'SerializationError'"
1616

17-
When using Azure Machine Learning, you may receive the error "Cannot import name 'SerializationError'". This error may occur when using an Azure Machine Learning environment. For example, when submitting a training job.
17+
When using Azure Machine Learning, you may receive one of the following errors:
18+
19+
* `cannot import name 'SerializationError'`
20+
* `cannot import name 'SerializationError' from 'azure.core.exceptions'`
21+
22+
This error may occur when using an Azure Machine Learning environment. For example, when submitting a training job or using AutoML.
1823

1924
## Cause
2025

2126
This problem is caused by a bug in the Azure Machine Learning SDK version 1.42.0.
2227

2328
## Resolution
2429

25-
Update your Azure Machine Learning environment to use SDK version 1.42.0.post1 or greater.
30+
Update the affected environment to use SDK version 1.42.0.post1 or greater. For a local development environment or compute instance, use the following command:
31+
32+
```bash
33+
pip install azureml-sdk[automl,explain,notebooks]>=1.42.0
34+
```
35+
36+
For more information on updating an Azure Machine Learning environment (for training or deployment), see the following articles:
37+
38+
* [Manage environments in studio](how-to-manage-environments-in-studio.md#rebuild-an-environment)
39+
* [Create & use software environments (SDK v1)](how-to-use-environments.md#update-an-existing-environment)
40+
* [Create & manage environments (CLI v2)](how-to-manage-environments-v2.md#update)
41+
42+
To verify the version of your installed SDK, use the following command:
43+
44+
```bash
45+
pip show azureml-core
46+
```
47+
48+
## Next steps
2649

27-
For more information on updating an environment, see the following articles:
50+
For more information on updating an Azure Machine Learning environment (for training or deployment), see the following articles:
2851

2952
* [Manage environments in studio](how-to-manage-environments-in-studio.md#rebuild-an-environment)
3053
* [Create & use software environments (SDK v1)](how-to-use-environments.md#update-an-existing-environment)

articles/machine-learning/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@
638638
href: how-to-debug-visual-studio-code.md
639639
- name: Troubleshoot SerializationError
640640
href: how-to-troubleshoot-serialization-error.md
641+
- name: Troubleshoot descriptor error
642+
displayName: descriptors cannot not be created directly
643+
href: how-to-troubleshoot-protobuf-descriptor-error.md
641644
- name: Reference
642645
items:
643646
- name: Python SDK

0 commit comments

Comments
 (0)