Skip to content

[SDK Automation] Python script fails with 'ModuleNotFoundError' when generate the SDK  #7957

@raych1

Description

@raych1

Two issues identified for this spec PR:

  • Node 18 has been installed in the spec PR pipeline and each SDK language automation script should not need to re-install it.
    The following is the pipeline log:
01:20:23.663 command 	sh scripts/automation_generate.sh ../azure-sdk-for-python_tmp/generateInput.json ../azure-sdk-for-python_tmp/generateOutput.json
01:20:23.663 info 	Config: {"stderr":{"showInComment":true},"stdout":{"showInComment":"^\\[Autorest\\]"},"envs":[],"exitCode":{"showInComment":true,"result":"error"}}
01:20:33.792 cmdout 	[automation_generate.sh] changed 1 package in 3s
01:20:33.793 cmderr 	[automation_generate.sh]  
01:20:33.793 cmderr 	[automation_generate.sh] npm notice New minor version of npm available! 10.2.4 -> 10.5.0
01:20:33.793 cmderr 	[automation_generate.sh] npm notice Changelog: <[https://github.com/npm/cli/releases/tag/v10.5.0>](https://github.com/npm/cli/releases/tag/v10.5.0%3E)
01:20:33.793 cmderr 	[automation_generate.sh] npm notice Run `npm install -g npm@10.5.0` to update!
01:20:33.794 cmderr 	[automation_generate.sh] npm notice 
01:20:33.850 cmdout 	[automation_generate.sh]   installing : node-v18.19.0
01:20:33.895 cmdout 	[automation_generate.sh]        mkdir : /usr/local/n/versions/node/18.19.0
01:20:33.897 cmdout 	[automation_generate.sh]        fetch : https://nodejs.org/dist/v18.19.0/node-v18.19.0-linux-x64.tar.xz
01:20:35.552 cmdout 	[automation_generate.sh]      copying : node/18.19.0
01:20:37.155 cmdout 	[automation_generate.sh]    installed : v18.19.0 (with npm 10.2.3)
  • it fails to generated SDK due to ModuleNotFoundError for github module.
01:20:37.263 cmdout 	[automation_generate.sh] Traceback (most recent call last):
01:20:37.263 cmdout 	[automation_generate.sh]   File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/runpy.py", line 196, in _run_module_as_main
01:20:37.279 cmdout 	[automation_generate.sh]     return _run_code(code, main_globals, None,
01:20:37.279 cmdout 	[automation_generate.sh]   File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/runpy.py", line 86, in _run_code
01:20:37.279 cmdout 	[automation_generate.sh]     exec(code, run_globals)
01:20:37.280 cmdout 	[automation_generate.sh]   File "/mnt/vss/_work/1/s/azure-sdk-for-python/tools/azure-sdk-tools/packaging_tools/sdk_generator.py", line 18, in <module>
01:20:37.280 cmdout 	[automation_generate.sh]     from .swaggertosdk.SwaggerToSdkCore import (
01:20:37.280 cmdout 	[automation_generate.sh]   File "/mnt/vss/_work/1/s/azure-sdk-for-python/tools/azure-sdk-tools/packaging_tools/swaggertosdk/SwaggerToSdkCore.py", line 18, in <module>
01:20:37.280 cmdout 	[automation_generate.sh]     from ci_tools.github_tools import get_files, GithubLink
01:20:37.280 cmdout 	[automation_generate.sh]   File "/mnt/vss/_work/1/s/azure-sdk-for-python/tools/azure-sdk-tools/ci_tools/github_tools.py", line 13, in <module>
01:20:37.280 cmdout 	[automation_generate.sh]     from github import Github, GithubException
01:20:37.280 cmdout 	[automation_generate.sh] ModuleNotFoundError: No module named 'github'
01:20:37.292 cmdout 	[automation_generate.sh] [Generate] codegen done!!!
01:20:37.292 cmdout 	[automation_generate.sh] [Autorest]/mnt/vss/_work/1/s/azure-sdk-for-python_tmp/venv-sdk/auto_temp.json does not exist!!!Error happened during codegen
01:20:37.293 error C 	Script return with result [failed] code [1] signal [null] cwd [azure-sdk-for-python]: sh scripts/automation_generate.sh
01:20:37.293 endsection 	Call generateScript

CC: @msyyc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions