awslabs / aws-shell

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

Cannot import "words" #113

Closed czardoz closed 8 years ago

czardoz commented 8 years ago

I installed aws-shell globally (not in a virtual env), and I get this error in the first run (as well as any subsequent runs):

aniket [~] -> aws-shell             
Creating doc index in the background. It will be a few minutes before all documentation is available.
Traceback (most recent call last):
  File "/usr/local/bin/aws-shell", line 9, in <module>
    load_entry_point('aws-shell==0.1.0', 'console_scripts', 'aws-shell')()
  File "/usr/local/lib/python2.7/dist-packages/awsshell/__init__.py", line 70, in main
    shell.run()
  File "/usr/local/lib/python2.7/dist-packages/awsshell/app.py", line 275, in run
    document = self.cli.run()
  File "/usr/local/lib/python2.7/dist-packages/awsshell/app.py", line 268, in cli
    self._cli = self.create_cli_interface(self.show_completion_columns)
  File "/usr/local/lib/python2.7/dist-packages/awsshell/app.py", line 452, in create_cli_interface
    display_completions_in_columns)
  File "/usr/local/lib/python2.7/dist-packages/awsshell/app.py", line 412, in create_application
    layout=self.create_layout(display_completions_in_columns, toolbar),
  File "/usr/local/lib/python2.7/dist-packages/awsshell/app.py", line 320, in create_layout
    from awsshell.lexer import ShellLexer
  File "/usr/local/lib/python2.7/dist-packages/awsshell/lexer.py", line 14, in <module>
    from pygments.lexer import words
ImportError: cannot import name words
sparticus414 commented 8 years ago

I'm doing an install in a very similar manner and can confirm the exact same error.

donnemartin commented 8 years ago

@czardoz @sparticus414 I just tried installing in a fresh virtualenv Python 2.7.10 on OS X 10.10.5, I could not reproduce.

Can you provide the following info?

Also, can you post the output of the following command?

pip freeze

I wonder if your version of pygments might be causing an issue.

Does running the following command fix the problem?

pip install pygments --upgrade
tomercagan commented 8 years ago

Hi, I had the same issue - I installed AWS CLI on Windows 10 using the installer. Then I installed aws-shell using pip comment (pip install aws-shell). Following that, when trying to run aws-shell I got the error above.

After running pip install pygments --upgrade as suggested above it upgraded from 1.6 to 2.1.3 and then aws-shell loaded without an issue.

Let me know if further details can help "globally" resolve this issue.

donnemartin commented 8 years ago

@tomercagan thanks for confirming upgrading pygments fixes the issue.

I can duplicate the issue with these steps:

aws-shell has a requirement on prompt-toolkit which just specifies a pygments dependency with no version, so Pygments 1.6 is not upgraded and we see the startup issue.

Short term solution is probably to explicitly add the Pygments>=2.1.3 dependency to aws-shell.

As for the medium term, note the latest prompt-toolkit 0.60 has actually removed the Pygments dependency entirely: https://github.com/jonathanslenders/python-prompt-toolkit/commit/401cbbb96685431abe8ecee033740c9a180badf0#diff-2eeaed663bd0d25b7e608891384b7298.

We might want to get https://github.com/awslabs/aws-shell/pull/109 wrapped up first then move to 0.60.

markstos commented 8 years ago

It still happened today. Perhaps the new version with the fix is not released. I tried to check my current version, but none of these worked to show what version I was using:

aws-shell -v
aws-shell -V
aws-shell --version
aws-shell -h
aws-shell --help

The lack of ability to find the version easily is a separate issue, but is mentioned here since it relates to the bug fix confirmation.

donnemartin commented 8 years ago

@markstos the version on PyPI seems to be from 2015-12-31:

https://pypi.python.org/pypi/aws-shell

@jamesls are we planning on releasing a new version soon?

The lack of ability to find the version easily is a separate issue

Please feel free to file an issue, I'm not sure this is currently supported. It might help to show the version on startup of aws-shell.