Open smijolovic opened 3 years ago
@smijolovic, did you make any change init.py or other python scripts? If so, you need to make sure they comply with flake8.
no changes made.
What's your flake8 version?
This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.
@justinchuby , as you are working on formatting the python code, please help look this. Is it still relevant? If not, please help us close this issue.
I mean, we don't need to update the code of ONNX Runtime version 1.8.2. I am just curious if the latest code still has the issue.
E402 module level import not at top of file
probably caused by https://github.com/microsoft/onnxruntime/blob/6fb29f5b9a50f95e18c81a2052c00bac2f23e3dd/onnxruntime/__init__.py#L34-L35 . Auto-format doesn't solve this, but I think we can remove these two lines, and refactor
Just a little (remove the try catch block) to fix it.
./build.sh --skip_submodule_sync --cuda_home /usr/local/cuda-11.4 --cudnn_home /usr/lib/x86_64-linux-gnu/ --nccl_home /usr/lib/x86_64-linux-gnu/ --use_cuda --config Release --build_wheel --update --build --parallel --build_wheel --cmake_extra_defines ONNXRUNTIME_VERSION=$BUILD_ONNXRUNTIME_RELEASE 'CMAKE_CUDA_ARCHITECTURES=35;37;50;52;60;61;70;75;80;86' --enable_training --mpi_home /usr/lib/x86_64-linux-gnu/openmpi
[ 21%] Linking CXX shared module libcustom_op_library.so [ 21%] Built target custom_op_library Checking python scripts for PEP8 conformance using flake8 [ 21%] Building CXX object external/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_lua.cpp.o [flake8 PEP8 ERROR] onnxruntime/init.py:36:1: E402 module level import not at top of file [flake8 PEP8 ERROR] onnxruntime/init.py:38:1: E402 module level import not at top of file [flake8 PEP8 ERROR] onnxruntime/init.py:46:1: E402 module level import not at top of file make[2]: [CMakeFiles/pep8_check.dir/build.make:84: CMakeFiles/pep8_check] Error 1 make[1]: [CMakeFiles/Makefile2:1738: CMakeFiles/pep8_check.dir/all] Error 2 make: ** [Makefile:166: all] Error 2 Traceback (most recent call last): File "onnxruntime/tools/ci_build/build.py", line 2162, in
sys.exit(main())
File "onnxruntime/tools/ci_build/build.py", line 2086, in main
build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
File "onnxruntime/tools/ci_build/build.py", line 1064, in build_targets
run_subprocess(cmd_args, env=env)
File "onnxruntime/tools/ci_build/build.py", line 579, in run_subprocess
return run( args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
File "onnxruntime/tools/python/util/run.py", line 41, in run
completed_process = subprocess.run(
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/cmake/bin/cmake', '--build', 'onnxruntime/build/Linux/Release', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
Editing .flake8 to: init.py:F401,E402
Allows the build to proceed.