amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

scikit bring your own - error in training model

Open arjunpn90 opened this issue 7 years ago • 6 comments

Hello @djarpin

I am trying to run the scikit BYO without changing anything and I get this error when I am trying to fit the model. Cloudwatch logs show just "/usr/bin/env: 'python\r': No such file or directory"

image

Can you please help?

arjunpn90 avatar Jan 17 '19 19:01 arjunpn90

I downloaded the code from sagemaker examples and that worked!

arjunpn90 avatar Jan 22 '19 04:01 arjunpn90

@arjunpn90 - Hi, I'm facing the same issue, can you please elaborate your above solution.

madhurkgp avatar Jun 25 '19 12:06 madhurkgp

Hi @madhurkgp , The python version of the pickled code and python version in docker image should be same. I built the model using python 3.6 and version in docker image was 2.7 and the issue was resolved when the python version in docker image was changed to 3.6 as well.

arjunpn90 avatar Jul 27 '19 14:07 arjunpn90

Hello, I am facing the same issue. I tried a different docker file, and even the image used in the sci-kit learn tutorial:

Can anyone provide any help? I used a different docker file recently (based on Amazon Linux 1) and it worked properly. So I really don't know what is going on

jamerico avatar May 25 '22 14:05 jamerico

To any people that may be suffering in the future:

The problem is that the python script that contains the shelbeg command #!/usr/bin/env python

Was written with the Windows end of life configuration (CRLF) and is being executed with the Unix end of life configuration (LF) in Sagemaker.

Convert that file to the LF format and everything will work.

Thank me later.

jamerico avatar May 25 '22 21:05 jamerico

@jamerico Thank you so much. It happened to me, and I followed your solution. Here iss what I've done:

  1. Install dos2unix.
  2. Convert wsgi.py, train, serve, predictor.py from CRLF to LF.

herley-shaori avatar Dec 30 '23 11:12 herley-shaori