|
| 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) |
0 commit comments