fast.ai AWS Setup p2 error : syntax error near unexpected token `newline’ setup_p2.sh

I am currently doing setup of AWS for fast.ai course part 1 , I  managed to get to some place but, I kept on getting this error when I try to execute the bash, below is the error. I manged to fix it, hence below is the solution for everyone’s benefit.

bash setup_p2.sh 
setup_p2.sh:line 7: syntax error near unexpected token `newline' setup_p2.sh: line 7: `<!DOCTYPE html>'

Why the ” error near unexpected token `newline’ ” ?

The simple reason is that when you do the wget, it is downlading the HTML file that has the <!Doctype html>, so thats the error. When you try to the below with wget, the wget is downloading the html of the github or the other place, so it keeps giving this error.

wget https://github.com/fastai/courses/blob/master/setup/setup_p2.sh

How to fix the error ?

It is simple, you download the setup_p2.sh file and the entire folder of the setup (https://github.com/fastai/courses/tree/master/setup)  as there are dependent files and then run them locally. Meaning you just type bash and drag the file in the terminal of mac, it will work.

That’s it folks, did you had any issues ?

2 Comments

  1. jMe

    I was having the same problem, I ended up deleting the downloaded setup_p2 and setup_instance files then downloaded (wget) the raw files from github, then ran setup_p2 again – this seemed to work

    Also best wait til you have the p2 permissions from Amazon before running it

    Reply
  2. I’m sorry but this doesn’t speak to running this on a windows machine. I pulled all of the files down from github into the same directory in which setup_p2.sh is saved, but I still get the newline error.

    Reply

Leave a Comment