Skip to content

Commit 682b1af

Browse files
Merge pull request #225264 from edebar01/patch-3
Update troubleshooting doc part 9
2 parents 00d3764 + 33010ae commit 682b1af

File tree

1 file changed

+178
-24
lines changed

1 file changed

+178
-24
lines changed

articles/machine-learning/how-to-troubleshoot-environments.md

Lines changed: 178 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,9 @@ The following are accepted location types:
573573
*Applies to: Python SDK v1*
574574

575575
For scenarios in which you're storing your Docker build context in a storage account
576-
* The path of the build context must be specified as `https://<storage-account>.blob.core.windows.net/<container>/<path>`
576+
* The path of the build context must be specified as
577+
578+
`https://<storage-account>.blob.core.windows.net/<container>/<path>`
577579
* Ensure that the location you provided is a valid URL
578580
* Ensure that you've specified a container and a path
579581

@@ -692,7 +694,7 @@ conda_dep.add_conda_package("python==3.8")
692694

693695
*Applies to: all scenarios*
694696

695-
If you're using a yaml for your conda specification, include Python as a dependency
697+
If you're using a YAML for your conda specification, include Python as a dependency
696698

697699
```yaml
698700
name: project_environment
@@ -708,39 +710,191 @@ channels:
708710
* [Add conda package v1](https://aka.ms/azureml/environment/add-conda-package-v1)
709711
710712
### Multiple Python versions
711-
- Only one Python version can be specified in the environment definition
713+
<!--issueDescription-->
714+
**Potential causes:**
715+
* You've specified more than one Python version in your environment definition
716+
717+
**Affected areas (symptoms):**
718+
* Failure in registering your environment
719+
<!--/issueDescription-->
720+
721+
**Troubleshooting steps**
722+
723+
*Applies to: Python SDK v1*
724+
725+
Choose which Python version you want to use, and remove all other versions
726+
727+
```python
728+
myenv.python.conda_dependencies.remove_conda_package("python=3.6")
729+
```
730+
731+
*Applies to: all scenarios*
732+
733+
If you're using a YAML for your conda specification, include only one Python version as a dependency
734+
735+
**Resources**
736+
* [CondaDependencies Class v1](https://aka.ms/azureml/environment/conda-dependencies-class)
712737

713738
### Python version not supported
714-
- The Python version provided in the environment definition isn't supported
715-
- Consider using a newer version of Python
716-
- See [Python versions](https://aka.ms/azureml/environment/python-versions) and [Python end-of-life dates](https://aka.ms/azureml/environment/python-end-of-life)
739+
<!--issueDescription-->
740+
**Potential causes:**
741+
* You've specified a Python version that is at or near its end-of-life and is no longer supported
742+
743+
**Affected areas (symptoms):**
744+
* Failure in registering your environment
745+
<!--/issueDescription-->
746+
747+
**Troubleshooting steps**
748+
749+
Specify a [python version](https://aka.ms/azureml/environment/python-versions) that hasn't reached and isn't nearing its [end-of-life](https://aka.ms/azureml/environment/python-end-of-life)
717750

718751
### Python version not recommended
719-
- The Python version used in the environment definition is at or near its end of life, and should be avoided
720-
- Consider using a newer version of Python as the specified version will eventually be unsupported
721-
- See [Python versions](https://aka.ms/azureml/environment/python-versions) and [Python end-of-life dates](https://aka.ms/azureml/environment/python-end-of-life)
752+
<!--issueDescription-->
753+
**Potential causes:**
754+
* You've specified a Python version that is at or near its end-of-life
755+
756+
**Affected areas (symptoms):**
757+
* Failure in registering your environment
758+
<!--/issueDescription-->
759+
760+
**Troubleshooting steps**
761+
762+
Specify a [python version](https://aka.ms/azureml/environment/python-versions) that hasn't reached and isn't nearing its [end-of-life](https://aka.ms/azureml/environment/python-end-of-life)
722763

723764
### Failed to validate Python version
724-
- The provided Python version may have been formatted improperly or specified with incorrect syntax
725-
- See [conda package pinning](https://aka.ms/azureml/environment/how-to-pin-conda-packages)
765+
<!--issueDescription-->
766+
**Potential causes:**
767+
* The provided Python version was formatted improperly or specified with incorrect syntax
768+
769+
**Affected areas (symptoms):**
770+
* Failure in registering your environment
771+
<!--/issueDescription-->
772+
773+
**Troubleshooting steps**
774+
775+
*Applies to: Python SDK v1*
776+
777+
Use correct syntax to specify a Python version using the SDK
778+
779+
```python
780+
myenv.python.conda_dependencies.add_conda_package("python=3.8")
781+
```
782+
783+
*Applies to: all scenarios*
784+
785+
Use correct syntax to specify a Python version in a conda YAML
786+
787+
```yaml
788+
name: project_environment
789+
dependencies:
790+
- python=3.8
791+
- pip:
792+
- azureml-defaults
793+
channels:
794+
- anaconda
795+
```
796+
797+
**Resources**
798+
* See [conda package pinning](https://aka.ms/azureml/environment/how-to-pin-conda-packages)
726799
727800
### *Conda issues*
728801
### Missing conda dependencies
729-
- The [environment definition](https://aka.ms/azureml/environment/environment-class-v1)
730-
has a [PythonSection](https://aka.ms/azureml/environment/environment-python-section)
731-
that contains a `user_managed_dependencies` bool and a `conda_dependencies` object
732-
- If `user_managed_dependencies` is set to `True`, you're responsible for ensuring that all the necessary packages are available in the
733-
Python environment in which you choose to run the script
734-
- If `user_managed_dependencies` is set to `False` (the default), Azure ML will create a Python environment for you based on `conda_dependencies`.
735-
The environment is built once and is reused as long as the conda dependencies remain unchanged
736-
- You'll receive a *"missing conda dependencies"* error when `user_managed_dependencies` is set to `False` and you haven't provided a conda specification.
737-
- See [how to create a conda file manually](https://aka.ms/azureml/environment/how-to-create-conda-file)
738-
- See [CondaDependencies class](https://aka.ms/azureml/environment/conda-dependencies-class)
739-
- See [how to set a conda specification on the environment definition](https://aka.ms/azureml/environment/set-conda-spec-on-environment-definition)
802+
<!--issueDescription-->
803+
**Potential causes:**
804+
* You haven't provided a conda specification in your environment definition, and `user_managed_dependencies` is set to `False` (the default)
805+
806+
**Affected areas (symptoms):**
807+
* Failure in registering your environment
808+
<!--/issueDescription-->
809+
810+
**Troubleshooting steps**
811+
812+
*Applies to: Python SDK v1*
813+
814+
If you don't want AzureML to create a Python environment for you based on `conda_dependencies,` set `user_managed_dependencies` to `True`
815+
816+
```python
817+
env.python.user_managed_dependencies = True
818+
```
819+
* You're responsible for ensuring that all necessary packages are available in the Python environment in which you choose to run the script
820+
821+
If you want AzureML to create a Python environment for you based on a conda specification, `conda_dependencies` needs to be populated in your environment definition
822+
823+
```python
824+
from azureml.core.environment import CondaDependencies
825+
826+
env = Environment(name="env")
827+
conda_dep = CondaDependencies()
828+
conda_dep.add_conda_package("python==3.8")
829+
env.python.conda_dependencies=conda_dep
830+
```
831+
832+
*Applies to: Azure CLI & Python SDK v2*
833+
834+
You must specify a base Docker image for the environment, and the conda environment will be built on top of that image
835+
* Provide the relative path to the conda file
836+
* See how to [create an environment from a conda specification](https://aka.ms/azureml/environment/create-env-conda-spec-v2)
837+
838+
**Resources**
839+
* See [how to create a conda file manually](https://aka.ms/azureml/environment/how-to-create-conda-file)
840+
* See [CondaDependencies class](https://aka.ms/azureml/environment/conda-dependencies-class)
841+
* See [how to set a conda specification on the environment definition](https://aka.ms/azureml/environment/set-conda-spec-on-environment-definition)
740842

741843
### Invalid conda dependencies
742-
- Make sure the conda dependencies specified in your conda specification are formatted correctly
743-
- See [how to create a conda file manually](https://aka.ms/azureml/environment/how-to-create-conda-file)
844+
<!--issueDescription-->
845+
**Potential causes:**
846+
* The conda dependencies specified in your environment definition aren't formatted correctly
847+
848+
**Affected areas (symptoms):**
849+
* Failure in registering your environment
850+
<!--/issueDescription-->
851+
852+
**Troubleshooting steps**
853+
854+
*Applies to: Python SDK v1*
855+
856+
Ensure that `conda_dependencies` is a JSONified version of the conda dependencies YAML structure
857+
858+
```json
859+
"condaDependencies": {
860+
"channels": [
861+
"anaconda",
862+
"conda-forge"
863+
],
864+
"dependencies": [
865+
"python=3.8",
866+
{
867+
"pip": [
868+
"azureml-defaults"
869+
]
870+
}
871+
],
872+
"name": "project_environment"
873+
}
874+
```
875+
876+
Conda dependencies can also be specified using the `add_conda_package` method
877+
878+
```python
879+
from azureml.core.environment import CondaDependencies
880+
881+
env = Environment(name="env")
882+
conda_dep = CondaDependencies()
883+
conda_dep.add_conda_package("python==3.8")
884+
env.python.conda_dependencies=conda_dep
885+
```
886+
887+
*Applies to: Azure CLI & Python SDK v2*
888+
889+
You must specify a base Docker image for the environment, and the conda environment will be built on top of that image
890+
* Provide the relative path to the conda file
891+
* See how to [create an environment from a conda specification](https://aka.ms/azureml/environment/create-env-conda-spec-v2)
892+
893+
**Resources**
894+
* See [more extensive examples](https://github.com/Azure/MachineLearningNotebooks/blob/9b1e130d18d3c61d41dc225488a4575904897c85/how-to-use-azureml/training/using-environments/using-environments.ipynb)
895+
* See [how to create a conda file manually](https://aka.ms/azureml/environment/how-to-create-conda-file)
896+
* See [CondaDependencies class](https://aka.ms/azureml/environment/conda-dependencies-class)
897+
* See [how to set a conda specification on the environment definition](https://aka.ms/azureml/environment/set-conda-spec-on-environment-definition)
744898

745899
### Missing conda channels
746900
- If no conda channels are specified, conda will use defaults that might change

0 commit comments

Comments
 (0)