awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.15k stars 770 forks source link

No module named prompt_toolkit.completion #167

Closed emptyr1 closed 7 years ago

emptyr1 commented 7 years ago

Suddenly getting this error. Wasn't getting this before. Using .zsh

➜  ~ aws-shell
Traceback (most recent call last):
  File "//anaconda/bin/aws-shell", line 9, in <module>
    load_entry_point('aws-shell==0.1.1', 'console_scripts', 'aws-shell')()
  File "//anaconda/lib/python2.7/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "//anaconda/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "//anaconda/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "//anaconda/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "//anaconda/lib/python2.7/site-packages/awsshell/__init__.py", line 7, in <module>
    from awsshell import shellcomplete
  File "//anaconda/lib/python2.7/site-packages/awsshell/shellcomplete.py", line 16, in <module>
    from prompt_toolkit.completion import Completer, Completion
ImportError: No module named prompt_toolkit.completion

&& if I do

➜  ~ pip install prompt_toolkit
Requirement already satisfied: prompt_toolkit in /anaconda/lib/python2.7/site-packages
Requirement already satisfied: wcwidth in /anaconda/lib/python2.7/site-packages (from prompt_toolkit)
Requirement already satisfied: six>=1.9.0 in /anaconda/lib/python2.7/site-packages/six-1.10.0-py2.7.egg (from prompt_toolkit)`
donnemartin commented 7 years ago

Hi @modqhx, I don't see this on a fresh install on Python 2.7, although I'm not a zsh user.

What's the output of your pip freeze?

Here's my output on a fresh install macOS 10.12:

$ pip freeze
aws-shell==0.1.1
awscli==1.11.36
boto3==1.4.3
botocore==1.4.93
colorama==0.3.7
configobj==5.0.6
docutils==0.13.1
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
PyYAML==3.12
rsa==3.4.2
s3transfer==0.1.10
six==1.10.0
wcwidth==0.1.7
wheel==0.24.0
emptyr1 commented 7 years ago

@donnemartin I tried again on a new virtual env, still having the same error. pip list gives me:

aws-shell (0.1.1)
awscli (1.11.36)
biopython (1.68)
boto3 (1.4.3)
botocore (1.4.93)
colorama (0.3.7)
configobj (5.0.6)
docutils (0.13.1)
futures (3.0.5)
GDAL (1.11.3)
jmespath (0.9.0)
numpy (1.11.2)
pip (9.0.1)
prompt-toolkit (1.0.9)
protobuf (3.0.0b2)
pyasn1 (0.1.9)
Pygments (2.1.3)
python-dateutil (2.6.0)
PyYAML (3.12)
rsa (3.4.2)
s3transfer (0.1.10)
setuptools (27.2.0)
six (1.10.0)
wcwidth (0.1.7)
wheel (0.29.0)

UPDATE: just tried again, getting different error:

➜  ~ aws-shell
Creating doc index in the background. It will be a few minutes before all documentation is available.
aws> Exception in thread Thread-1:
Traceback (most recent call last):
  File "//anaconda/envs/aws/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "//anaconda/envs/aws/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "//anaconda/envs/aws/lib/python2.7/site-packages/awsshell/makeindex.py", line 88, in write_doc_index
    do_write_doc_index(db, help_command, close_db_on_finish=should_close)
  File "//anaconda/envs/aws/lib/python2.7/site-packages/awsshell/makeindex.py", line 93, in do_write_doc_index
    _index_docs(db, help_command)
  File "//anaconda/envs/aws/lib/python2.7/site-packages/awsshell/makeindex.py", line 110, in _index_docs
    db[dotted_name] = text_docs
  File "//anaconda/envs/aws/lib/python2.7/site-packages/awsshell/db.py", line 43, in __setitem__
    {'key': key, 'value': value})
OperationalError: attempt to write a readonly database

UPDATE2: If I run the command with sudo, it seems to run fine. Any idea on how to solve this? sudo aws-shell

donnemartin commented 7 years ago

It sounds like your permissions for where the sql db is stored might be incorrect. Does running something like this help?

chown -R user-name:user-name ~/.aws