donnemartin / saws

A supercharged AWS command line interface (CLI).
Other
5.25k stars 283 forks source link

Error `/bin/sh: ec2: command not found` after new saws installation into virtualenv #97

Closed lancelakey closed 7 years ago

lancelakey commented 7 years ago

I just installed saw into a virtualenv using the steps below. When I enter commands into saw it's like they're being sent directly to /bin/sh Any idea what might cause this?

16:37 $ python -V
Python 2.7.13
16:37 $ pip -V
pip 9.0.1 from /Users/lance/virtualenvs/saws/lib/python2.7/site-packages (python 2.7)

16:37 $ virtualenv saws
New python executable in /Users/lance/virtualenvs/saws/bin/python2.7
Also creating executable in /Users/lance/virtualenvs/saws/bin/python
Installing setuptools, pip, wheel...done.
16:42 $ cd saws/
✔ ~/virtualenvs/saws 
16:42 $ source bin/activate
16:42 $ pip install saws
Collecting saws
Collecting awscli<2.0.0,>=1.7.46 (from saws)
  Using cached awscli-1.11.39-py2.py3-none-any.whl
Collecting pygments<3.0.0,>=2.0.2 (from saws)
  Using cached Pygments-2.1.3-py2.py3-none-any.whl
Collecting enum34>=1.0.4 (from saws)
  Using cached enum34-1.1.6-py2-none-any.whl
Collecting configobj<6.0.0,>=5.0.6 (from saws)
Collecting click<7.0,>=4.0 (from saws)
  Using cached click-6.7-py2.py3-none-any.whl
Collecting prompt-toolkit<1.1.0,>=1.0.0 (from saws)
  Using cached prompt_toolkit-1.0.9-py2-none-any.whl
Collecting six<2.0.0,>=1.9.0 (from saws)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting PyYAML<=3.12,>=3.10 (from awscli<2.0.0,>=1.7.46->saws)
Collecting rsa<=3.5.0,>=3.1.2 (from awscli<2.0.0,>=1.7.46->saws)
  Using cached rsa-3.4.2-py2.py3-none-any.whl
Collecting docutils>=0.10 (from awscli<2.0.0,>=1.7.46->saws)
  Using cached docutils-0.13.1-py2-none-any.whl
Collecting botocore==1.5.2 (from awscli<2.0.0,>=1.7.46->saws)
  Using cached botocore-1.5.2-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.9 (from awscli<2.0.0,>=1.7.46->saws)
  Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting colorama<=0.3.7,>=0.2.5 (from awscli<2.0.0,>=1.7.46->saws)
  Using cached colorama-0.3.7-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<1.1.0,>=1.0.0->saws)
  Using cached wcwidth-0.1.7-py2.py3-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli<2.0.0,>=1.7.46->saws)
  Using cached pyasn1-0.1.9-py2.py3-none-any.whl
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.5.2->awscli<2.0.0,>=1.7.46->saws)
  Using cached jmespath-0.9.0-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.5.2->awscli<2.0.0,>=1.7.46->saws)
  Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" (from s3transfer<0.2.0,>=0.1.9->awscli<2.0.0,>=1.7.46->saws)
  Using cached futures-3.0.5-py2-none-any.whl
Installing collected packages: PyYAML, pyasn1, rsa, docutils, jmespath, six, python-dateutil, botocore, futures, s3transfer, colorama, awscli, pygments, enum34, configobj, click, wcwidth, prompt-toolkit, saws
Successfully installed PyYAML-3.12 awscli-1.11.39 botocore-1.5.2 click-6.7 colorama-0.3.7 configobj-5.0.6 docutils-0.13.1 enum34-1.1.6 futures-3.0.5 jmespath-0.9.0 prompt-toolkit-1.0.9 pyasn1-0.1.9 pygments-2.1.3 python-dateutil-2.6.0 rsa-3.4.2 s3transfer-0.1.10 saws-0.4.1 six-1.10.0 wcwidth-0.1.7
(saws) ✔ ~/virtualenvs/saws 
16:42 $ saws
No resource cache found
Refreshing resources...
  Refreshing instance ids...
  Refreshing instance tag keys...
  Refreshing instance tag values...
  Refreshing bucket names...
  Refreshing bucket uris...
Done refreshing
Version: 0.4.1
Theme: vim
saws> ec2
/bin/sh: ec2: command not found

saws> ec2 describe-instances
/bin/sh: ec2: command not found

saws> help
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

 JOB_SPEC [&]                       (( expression ))
 . filename [arguments]             :
 [ arg... ]                         [[ expression ]]
 alias [-p] [name[=value] ... ]     bg [job_spec ...]
 bind [-lpvsPVS] [-m keymap] [-f fi break [n]
 builtin [shell-builtin [arg ...]]  caller [EXPR]
 case WORD in [PATTERN [| PATTERN]. cd [-L|-P] [dir]
 command [-pVv] command [arg ...]   compgen [-abcdefgjksuv] [-o option
 complete [-abcdefgjksuv] [-pr] [-o continue [n]
 declare [-afFirtx] [-p] [name[=val dirs [-clpv] [+N] [-N]
 disown [-h] [-ar] [jobspec ...]    echo [-neE] [arg ...]
 enable [-pnds] [-a] [-f filename]  eval [arg ...]
 exec [-cl] [-a name] file [redirec exit [n]
 export [-nf] [name[=value] ...] or false
 fc [-e ename] [-nlr] [first] [last fg [job_spec]
 for NAME [in WORDS ... ;] do COMMA for (( exp1; exp2; exp3 )); do COM
 function NAME { COMMANDS ; } or NA getopts optstring name [arg]
 hash [-lr] [-p pathname] [-dt] [na help [-s] [pattern ...]
 history [-c] [-d offset] [n] or hi if COMMANDS; then COMMANDS; [ elif
 jobs [-lnprs] [jobspec ...] or job kill [-s sigspec | -n signum | -si
 let arg [arg ...]                  local name[=value] ...
 logout                             popd [+N | -N] [-n]
 printf [-v var] format [arguments] pushd [dir | +N | -N] [-n]
 pwd [-LP]                          read [-ers] [-u fd] [-t timeout] [
 readonly [-af] [name[=value] ...]  return [n]
 select NAME [in WORDS ... ;] do CO set [--abefhkmnptuvxBCHP] [-o opti
 shift [n]                          shopt [-pqsu] [-o long-option] opt
 source filename [arguments]        suspend [-f]
 test [expr]                        time [-p] PIPELINE
 times                              trap [-lp] [arg signal_spec ...]
 true                               type [-afptP] name [name ...]
 typeset [-afFirtx] [-p] name[=valu ulimit [-SHacdfilmnpqstuvx] [limit
 umask [-p] [-S] [mode]             unalias [-a] name [name ...]
 unset [-f] [-v] [name ...]         until COMMANDS; do COMMANDS; done
 variables - Some variable names an wait [n]
 while COMMANDS; do COMMANDS; done  { COMMANDS ; }
donnemartin commented 7 years ago

Hi @lancelakey

saws> ec2
/bin/sh: ec2: command not found

saws> ec2 describe-instances
/bin/sh: ec2: command not found

Looking at the info you posted, it seems you are not including the aws command.

saws requires you to prefix your commands with aws just like with the aws-cli.

Does running this work?

saws> aws ec2 describe-instances
lancelakey commented 7 years ago

Ha! I missed that. Yes, that works perfectly. Thanks!

saws> aws ec2 describe-regions --region-names us-east-1
{
    "Regions": [
        {
            "Endpoint": "ec2.us-east-1.amazonaws.com", 
            "RegionName": "us-east-1"
        }
    ]
}