-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Cannot load local file from Windows path #3173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think it is an already known issue with Sagemaker package. Here is the fix #3051 (2.84.1) |
I can make the changes following the contribution doc and making a PR from a forked repo, but before that I would like that someone from AWS answer to me first to check if they will approve it, and if there are any guidelines for coding style to follow or constant variables to know the OS in which is running. Thanks on advance |
Sorry for the late response. Officially, the SageMaker Python SDK only supports POSIX compliant operating systems. For that reason we're unlikely to accept a PR that provides work-arounds for Windows -- even if the change works, all of our integration testing happens on Linux distros so we can't reliably maintain this code. You'll find that there are dozens of places in the SDK where you'll run into an issue similar to this one. I'm curious though, have you tried changing the path you're passing? This Wiki article explains that Windows does support file URIs, but in a particular format: |
Closing this issue for now. Feel free to reopen if there is any more feedback. Thanks |
Describe the bug
When I am trying to create a workflow step for deployment with a script from a local path in a Windows OS the code will fail saying
ValueError: is not a valid file
Step config used:
Example,
'code'
value looks like:'file://C:\\Users\\user1\\....\\deployment.py'
Because of being a Windows path I get the following errors:
Screens or logs
If I remove the
'file://'
then I get the following error:But this file actually exists, if I put this path in a browser or the file explorer
To reproduce
Create a workflow step and try to upload a local script from a Windows system.
Or more simple call the method with a Windows path as parameter and the Hash class used by default:
sagemaker-python-sdk/src/sagemaker/workflow/utilities.py
Line 117 in 325214f
Expected behavior
That the following lines of code can parse a file path for Windows.
System information
numpy>=1.16.4
pandas>=1.3.0
boto3>=1,.17.101
sagemaker>=2.72.0
protbuf==3.17.3
Python version: 3.8
CPU or GPU: CPU
Custom Docker image (Y/N): N
Addiotional context
The method _hash_file expects a string to start by
'file://'
but if a Windows path starts by that is wrongly recognize as a file because of the'//'
and then having'\\'
in the rest of the folders.Even I tried ussing the preffix
'file:///...'
but then it doesn't recognize it as the path is like'\\C:\\...'
.Solution
I would suggest to fix it by just checking in which OS this is running, for example:
sagemaker-python-sdk/src/sagemaker/workflow/utilities.py
Line 117 in 325214f
The text was updated successfully, but these errors were encountered: