Issues with setting up AWS Server using Windows machine in lecture 0

UPDATED:

I’ve solved a few of the installation issues I had when trying to set up AWS in lecture 0: http://course.fast.ai/lessons/aws.html. See below for a description of the issues and some advice as to what worked for me in the end:

The primary issue was that the cygwin didn’t come with python installed, and didn’t know where to find the existing Windows Anaconda version on my machine. This was verified by running which python from within cygwin - it couldn’t find where python is saved. Note that when I ran pip install awscli though, cygwin didn’t throw an error message. Cygwin actually installs awscli in the Window’s Anaconda installation of Python (I find this odd since we didn’t run conda install awscli).

Here are two posts explain the issue and offer different solutions:

  1. the course wiki: (http://wiki.fast.ai/index.php/Awscli_in_cygwin

    1. From my understanding, this post recommends installing a cygwin-specific version of python, then reinstalling awscli using pip.
    2. For some reason though when I ran the first command, pip uninstall awscli it “hung up” my cygwin (Therefore, I switched to approach 2 below which worked)
  2. this site: https://www.davidbaumgold.com/tutorials/set-up-python-windows/#installing-cygwin

    1. This post worked for me. It recommends telling cygwin where to find your already installed version of python by running echo "PATH=\$PATH:/cygdrive/c/Python32" >> .bash_profile within cygwin (note for this to work you need to cd all the way to your user directory).
    2. In my case my python was saved in my Anaconda file (which can be confirmed by running which python in the terminal), so I ran echo "PATH=\$PATH:/cygdrive/C:/Users/rchase/AppData/Local/Continuum/Anaconda2/python.exe" >> .bash_profile
    3. Notice that “/cygdrive/” is inserted before the C: drive. This is normal behavior when using a Unix-based terminal such as cygwin
    4. The next step is to confirm that cygwin can now find the python.exe by typing which python in cygwin.
    5. If cygwin is able to locate python, then using cygwin just cd to the Anaconda Scripts directory where aws should be saved, i.e. cd c:/Users/rchase/AppData/Local/Continuum/Anaconda2/Scripts
    6. From in the scripts file, as long as aws is in there (in my case I had already run pip install awscli before), you should be able to run python aws in cygwin to run the aws python script (or type ./aws which locates the appropriate executable to run aws, in this case it’s python).

This seems to have solved the immediate issue. However, in order for the python aws command to work, I actually need to be in the Scripts directory (so that it knows where to find aws), or I need to keep using the full path directory every time: i.e. python C:/Users/rchase/AppData/Local/Continuum/Anaconda2/Scripts/aws. However, now I’m not sure where to save or how to run the setup_p2.sh script…

Hello There
I am also having problems running setup_p2.sh
I have 2 versions of the script, one that I downloaded via the terminal and one that I from from the github page.
I am running them from the Linux terminal.
Neither of them seem to work.
The first looks as follows:

#!/bin/bash
#
# Configure a p2.xlarge instance
# get the correct ami
export region=$(aws configure get region)
if [ $region = "us-west-2" ]; then
   export ami="ami-bc508adc" # Oregon
elif [ $region = "eu-west-1" ]; then
export ami="ami-b43d1ec7" # Ireland 
elif [ $region = "us-east-1" ]; then
export ami="ami-31ecfb26" # Virginia
else
  echo "Only us-west-2 (Oregon), eu-west-1 (Ireland), and us-east-1 (Virginia) are currently supported"
  exit 1
fi

export instanceType="p2.xlarge"

. $(dirname "$0")/setup_instance.sh

The output I get when running the above is:

bash setup_p2.sh
setup_p2.sh: line 4: $'\r': command not found
setup_p2.sh: line 9: syntax error near unexpected token `elif'
'etup_p2.sh: line 9: `elif [ $region = "eu-west-1" ]; then

The other version that I have is much longer and starts with:

<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
  <meta content="width=300, initial-scale=1" name="viewport">
 ....

and also fails when running, with the following output:

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

I’m very new to shell script. Any help/suggestions would be greatly appreciated.

I am not sure that I can help, but I also experienced a lot of problems using cygwin. I am on a windows 10 machine. I remebered that windows 10 is offering the ubuntu bash shell, which I tried and it made most things better. After following the advice to start from zero in aws everything worked as expected. Starting_Over

I am also getting errors

..... It appears that this file downloaded is an HTML and not the shell script. I downloaded the file using "wget http://www.platform.ai/file/setup_p2.sh". Please help resolve this issue. Thanks Bill

Hi,
I am having the same problem too…
If you can help me i will be glad…
thanks

Please help in this regards. Even i am stuck at this phase!!!

Did anyone ever figure out how to get past this part? I’m running into the same problem