Aws cli in cygwin - how to clear differences in cygwin style windows and paths

I suspect that it is my inability to configure the path parameters, but I do not understand.

I installed aws cli using pip in cygwin.

pip install awscli 

I have two python environments ... anaconda windows distribution, and a version of cygwin can install for you.

 which python > /usr/bin/python where python > C:\cygwin64\bin\python > C:\windows-style-path-to-anaconda\python.exe 

when i try to run aws cli

 aws --version > C:\windows-style-path-to-anaconda\python.exe: can't open file > 'cygdrive/c/cygdrive-style-path-to-anaconda/Scripts/aws': > [Errno 2] No such file or directory' 

I tried adding the aws path to my windows path variable. Bad luck.

I tried adding this to my .bashrc

 export PATH="$PATH:/cygdrive/c/cygdrive-style-path-to-anaconda/Scripts" 

Bad luck.

I tried modifying "aws" which is trying to start python. First I changed #! to point to python cygwin instead of python windows.

 #!c:\cygwin64\bin\python 

then he could find the aws file to run ... but he could not find any of the files to import ... 'awscli.clidriver', 'botocore._', etc.

I tried changing my path variables to indicate the location of these ... anaconda / Lib / site-packages ... I even tried to make sys.path.insert (1, path) in the 'aws' file myself .... it fixed this problem, but each downloaded file looked in different places and couldnโ€™t find them, and there were too many things to merge with one at a time in aws.py files.

these are the jobs ... in cygwin ...

 cd /cygdrive/c/cygwin-path-to-anaconda/Scripts ./aws --version > aws-cli/1.10.26 Python/2.7.11 Windows/7 botocore/1.4.17 

but there must be a better way, right? or...

  • set my path variables correctly

  • get aws cli installed in python cygwin directory instead of windows anaconda environment

Unfortunately, deleting deleted files just freezes, trying to delete awscli, and I don't know how to get it to use cygwin python, if I can even uninstall / reinstall. And after several attempts to correct my variable paths, I am at a loss.

Any advice is appreciated.

+7
python cygwin aws-cli
source share
4 answers

Thanks to matzeri in the comments above for helping me fix it.

The problem was that cygwin had its own version of python ... but not pip ... so when I used "pip install" in cygwin to install awscli, it was a windows / anaconda file. the solution did not include the correction path, as Matseri pointed out, he would never resolve it using the paths ... these were these two lines ...

 python -m ensurepip # install a cygwin pip pip install awscli # to install awscli for cygwin 
0
source share

When running pip install awscli from cygwin, it can install awscli in the Window Anaconda Python installation, and not in Cygwin Python (this is what you want). Then, when you start aws , you get an error that the aws not found. The solution I found was to install python / pip inside cygwin, following the below bash commands from the cygwin shell:

 pip uninstall awscli wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg install apt-cyg /bin apt-cyg install python wget https://bootstrap.pypa.io/get-pip.py python get-pip.py pip install awscli 

Make sure wget is installed in cygwin.

+11
source share

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

The main problem is that cygwin does not come with python installed and does not know where to find the existing version of Windows Anaconda on your computer. This can be verified by running which python from cygwin - he could not find where the python is stored. Please note that this can be confusing since running pip install awscli probably does not cause an error message. Cygwin actually installs awscli in the Anaconda Window Python installation (I find this strange since we did not run conda install awscli ).

HOWEVER, instead of trying to point cygwin to an already installed version of python Anaconda on your computer, this will save you a ton of headache just to install a cygwin specific python instance. These steps are described here: http://wiki.fast.ai/index.php/Awscli_in_cygwin

  • pip uninstall awscli
  • wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
  • install apt-cyg /bin
  • apt-cyg install python
  • wget https://bootstrap.pypa.io/get-pip.py
  • python get-pip.py
  • pip install awscli

... Note, however, that the first pip uninstall awscli hung up for me. So just exit it with quit() and continue with the others in order.

You can verify that everything works if you run which python in cygwin and point to the version of cygin (i.e. / usr / bin / python, unlike: / users /.../ Anaconda2 /).

In addition, if you ask about this in connection with watching the installation video for the fast.ai course ( http://course.fast.ai/lessons/aws.html ), then the next CRITICAL step for Windows users: when you download all the scripts shell from the Github installation folder ( https://github.com/fastai/courses/tree/master/setup ), Windows automatically adds CRLF line terminators! Therefore, run the following commands in cygwin to complete the following lines:

  • apt-cyg install dos2unix
  • dos2unix setup_p2.sh
  • dos2unix setup_instance.sh
  • then finally bash setup_p2.sh

That should do the trick.

+4
source share

Adding my fix for people facing this issue in Anacond2

After installing anaconda2, run this command in cygwin (suppose you installed it in c: \ anaconda2)

 echo "PATH=\$PATH:/cygdrive/c/anaconda2" >> .bash_profile echo "PATH=\$PATH:/cygdrive/c/anaconda2/Scripts" >> .bash_profile source .bash_profile 

Further information is available at https://www.davidbaumgold.com/tutorials/set-up-python-windows/#installing-cygwin

+1
source share