Hello @tekmen0
Thanks for reaching out to us. Based on the error message you provided, it seems like the user running the code does not have the necessary permissions to create the 'inputs' directory. To fix this issue, you can try specifying the absolute path of the directories you want to create, rather than using relative paths. This will ensure that the directories are created in a location where the user running the code has the necessary permissions.
For example, you can try replacing the inputs_root
and outputs_root
variables with absolute paths like this:
luaCopy code
inputs_root = os.path.join(os.environ['AZUREML_MODEL_DIR'], 'inputs')
outputs_root = os.path.join(os.environ['AZUREML_MODEL_DIR'], 'outputs')
This will create the inputs
and outputs
directories inside the AZUREML_MODEL_DIR
directory, which is a location where the user running the code should have the necessary permissions to create files and directories.
Alternatively, you can try running the container with elevated privileges (i.e., as an administrator or root user) to ensure that the user running the code has the necessary permissions to create files and directories.
Note that if you are using Azure Machine Learning to deploy your model, you can also use the os.makedirs()
function instead of os.mkdir()
to create the directories recursively, along with any necessary parent directories. This can be done by replacing the if not os.path.exists()
statements with the following code:
graphqlCopy code
os.makedirs(inputs_root, exist_ok=True)
os.makedirs(outputs_root, exist_ok=True)
The exist_ok=True
argument ensures that the function does not raise an error if the directory already exists.
Please have a try and let me know how it works, I am happy to help further, a similar Python issue here - https://stackoverflow.com/questions/67851446/why-is-os-mkdir-returning-error-when-it-shouldnt-beginner-question
I hope this helps.Thanks!
Regards, Yutong -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.