Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such file or directory error when configuring aws on cygwin

I downloaded Cygwin and Python version 2.5. Now I am about to set up an deep learning computer at aws (following this tutorial: https://www.youtube.com/watch?v=8rjRfW4JM2I)

If i run pip install awscli I get this (which is good)

 $ pip install awscli 
 Requirement already satisfied: awscli in c:\users\marc\anaconda2    \lib\site-packages
 Requirement already satisfied: s3transfer<0.2.0,>=0.1.9 in c:\users\marc\anaconda2\lib\site-packages (from awscli)
 Requirement already satisfied: rsa<=3.5.0,>=3.1.2 in c:\users\marc\anaconda2\lib\site-packages (from awscli)
 Requirement already satisfied: PyYAML<=3.12,>=3.10 in c:\users\marc\anaconda2\lib\site-packages (from awscli)
 Requirement already satisfied: docutils>=0.10 in c:\users\marc\anaconda2\lib\site-packages (from awscli)
Requirement already satisfied: botocore==1.4.92 in c:\users\marc\anaconda2\lib\site-packages (from awscli)
Requirement already satisfied: colorama<=0.3.7,>=0.2.5 in c:\users\marc\anaconda2\lib\site-packages (from awscli)
Requirement already satisfied: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in c:\users\marc\anaconda2\lib\site- packages (from s3transfer<0.2.0,>=0.1.9->awscli)
Requirement already satisfied: pyasn1>=0.1.3 in c:\users\marc\anaconda2\lib\site-packages (from rsa<=3.5.0,>=3.1.2->awscli)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in c:\users\marc\anaconda2\lib\site-packages (from botocore==1.4.92->awscli)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in c:\users\marc\anaconda2\lib\site-packages (from botocore==1.4.92->awscli)
Requirement already satisfied: six>=1.5 in c:\users\marc\anaconda2\lib\site-packages (from python-dateutil<3.0.0,>=2.1->botocore==1.4.92->awscli)

However when I want to configure everything and type aws I get:

$ aws
C:\Users\Marc\Anaconda2\python.exe: can't open file '/cygdrive/c/Users/Marc/Anaconda2/Scripts/aws': [Errno 2] No such file or directory
like image 747
Frits Verstraten Avatar asked Jan 04 '17 12:01

Frits Verstraten


People also ask

Where is AWS CLI config file on Windows?

The config file is located at ~/. aws/config on Linux or macOS, or at C:\Users\ USERNAME \. aws\config on Windows. This file contains the configuration settings for the default profile and any named profiles.

Where do I put AWS config file?

The shared AWS config and credentials files are plaintext files that reside by default in a folder named . aws that is placed in the " home " folder on your computer. On Linux and macOS, this is typically shown as ~/. aws .

How do I create a .AWS folder in Windows?

Just so you know, you can create a folder that starts with ".". You just can't do it from Explorer. If you open a command prompt, cd to the directory you want it created in, and run "mkdir . aws" then it will create it.

Where is .AWS folder?

aws folder create a file named credentials . The full path should be like this: C:\Users\USERNAME\. aws\credentials .


2 Answers

I got on track with the answer by Ryan Chase (however I can't comment on his answer due to insufficient credit on stackoverflow)

after step 4: apt-cyg install python, which python would return the desired usr/bin/python. However, running python -i from cygwin still opened up my local anaconda python instead of the cygwin python.

I ended up using this workflow:

  1. pip uninstall awscli
  2. wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
  3. install apt-cyg /bin
  4. apt-cyg install python
  5. wget https://bootstrap.pypa.io/get-pip.py
  6. /bin/python ~/get-pip.py
  7. /bin/pip install awscli
  8. /bin/aws

etc. so each time, use /bin/... to force cygwin to use it's local version of the program. It's pretty cumbersome, maybe I'll look into better ways of getting cygwin to prefer it's own version of python over the anaconda version.

I also needed to change the setup files from windows to unix style, so:

  1. apt-cyg install dos2unix
  2. dos2unix setup_p2.sh
  3. dos2unix setup_instance.sh
  4. then finally, bash setup_p2.sh
like image 183
Wouter van Amsterdam Avatar answered Sep 27 '22 23:09

Wouter van Amsterdam


After a LOT of time spent on this, I found a solution that works.

The primary issue is that the cygwin didn't come with python installed, and doesn't know where to find the existing Windows Anaconda version on your machine. This can be verified by running which python from within cygwin - it couldn't find where python is saved. Note that this can be confusing because running pip install awscli likely doesn'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).

HOWEVER, rather than try to point cygwin to the already installed version of Anaconda python on your machine it will save you a ton of headache to just install a cygwin-specific instance of python. The steps to do so are documented here: http://wiki.fast.ai/index.php/Awscli_in_cygwin)

  1. pip uninstall awscli
  2. wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
  3. install apt-cyg /bin
  4. apt-cyg install python
  5. wget https://bootstrap.pypa.io/get-pip.py
  6. python get-pip.py
  7. pip install awscli

...Note, however, that the first command pip uninstall awscli "hung up" for me. So just escape out of it using quit() and continue with the others in order.

You can check that everything worked if you run which python in cygwin and it points to the cygin version (i.e. /usr/bin/python , as opposed to: /users/.../Anaconda2/).

Additionally, if you happen to be asking this in conjunction with watching the setup video for the fast.ai course (http://course.fast.ai/lessons/aws.html), then the next step is CRITICAL for Windows users: when you download all the shell scripts from Github setup folder (https://github.com/fastai/courses/tree/master/setup), Windows automatically adds CRLF line terminators! Therefore, in cygwin, run the following commands to remove these line endings:

  1. apt-cyg install dos2unix
  2. dos2unix setup_p2.sh
  3. dos2unix setup_instance.sh
  4. then finally, bash setup_p2.sh

This should do the trick.

like image 44
Ryan Chase Avatar answered Sep 27 '22 22:09

Ryan Chase