Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh installation result in prompt-toolkit ImportError #254

Open
mmciver opened this issue Nov 5, 2020 · 5 comments
Open

Fresh installation result in prompt-toolkit ImportError #254

mmciver opened this issue Nov 5, 2020 · 5 comments

Comments

@mmciver
Copy link

mmciver commented Nov 5, 2020

This is blocking me, and I haven't been able to find a reference to this elsewhere, or a solution. I suspect a version conflict, but even completely cleaning and reinstalling produces the same error every time.
File "/usr/lib/python3/dist-packages/awsshell/app.py", line 13, in <module> from prompt_toolkit.shortcuts import create_eventloop ImportError: cannot import name 'create_eventloop' from 'prompt_toolkit.shortcuts' (/usr/lib/python3/dist-packages/prompt_toolkit/shortcuts/__init__.py)

Even digging into the current versions of both aws-shell and prompt-toolkit, there appears to be a wildcard import in the past for the shortcuts/init.py, which was changed to an explicit list, and it no longer includes the create_eventloop that the awsshell/app.py is looking for.

Further puzzling is that on my prior system (Ubuntu 16.10) prompt-toolkit isn't even installed, and aws-shell works perfectly. Removing prompt-toolkit from the current system only moves the error to looking for it.

Possibly relevant system and versions:
Pop_OS 20.10

 $ aws --version
aws-cli/2.0.45 Python/3.7.3 Linux/5.8.0-7625-generic exe/x86_64.pop.20

(note, this was all also failing identically with aws-cli/1.18.170 Python/3.8.6 Linux/5.8.0-7625-generic botocore/1.19.10)

Install -> error sequence

 $ sudo apt-get install aws-shell
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  awscli docutils-common libimagequant0 python3-boto3 python3-botocore python3-configobj python3-dateutil python3-docutils python3-jmespath python3-olefile python3-pil python3-prompt-toolkit
  python3-pyasn1 python3-roman python3-rsa python3-s3transfer python3-wcwidth
Suggested packages:
  python-configobj-doc docutils-doc fonts-linuxlibertine | ttf-linux-libertine texlive-lang-french texlive-latex-base texlive-latex-recommended python-pil-doc python3-pil-dbg
The following NEW packages will be installed:
  aws-shell awscli docutils-common libimagequant0 python3-boto3 python3-botocore python3-configobj python3-dateutil python3-docutils python3-jmespath python3-olefile python3-pil
  python3-prompt-toolkit python3-pyasn1 python3-roman python3-rsa python3-s3transfer python3-wcwidth
0 upgraded, 18 newly installed, 0 to remove and 14 not upgraded.
Need to get 0 B/5,886 kB of archives.
After this operation, 64.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package python3-dateutil.
(Reading database ... 283601 files and directories currently installed.)
Preparing to unpack .../00-python3-dateutil_2.8.1-4_all.deb ...
Unpacking python3-dateutil (2.8.1-4) ...
Selecting previously unselected package docutils-common.
Preparing to unpack .../01-docutils-common_0.16+dfsg-3_all.deb ...
Unpacking docutils-common (0.16+dfsg-3) ...
Selecting previously unselected package python3-roman.
Preparing to unpack .../02-python3-roman_2.0.0-5_all.deb ...
Unpacking python3-roman (2.0.0-5) ...
Selecting previously unselected package python3-docutils.
Preparing to unpack .../03-python3-docutils_0.16+dfsg-3_all.deb ...
Unpacking python3-docutils (0.16+dfsg-3) ...
Selecting previously unselected package python3-jmespath.
Preparing to unpack .../04-python3-jmespath_0.10.0-1_all.deb ...
Unpacking python3-jmespath (0.10.0-1) ...
Selecting previously unselected package python3-botocore.
Preparing to unpack .../05-python3-botocore_1.17.22+repack-1_all.deb ...
Unpacking python3-botocore (1.17.22+repack-1) ...
Selecting previously unselected package python3-pyasn1.
Preparing to unpack .../06-python3-pyasn1_0.4.8-1_all.deb ...
Unpacking python3-pyasn1 (0.4.8-1) ...
Selecting previously unselected package python3-rsa.
Preparing to unpack .../07-python3-rsa_4.0-4_all.deb ...
Unpacking python3-rsa (4.0-4) ...
Selecting previously unselected package python3-s3transfer.
Preparing to unpack .../08-python3-s3transfer_0.3.3-1_all.deb ...
Unpacking python3-s3transfer (0.3.3-1) ...
Selecting previously unselected package awscli.
Preparing to unpack .../09-awscli_1.18.111-1_all.deb ...
Unpacking awscli (1.18.111-1) ...
Selecting previously unselected package python3-boto3.
Preparing to unpack .../10-python3-boto3_1.13.14-1_all.deb ...
Unpacking python3-boto3 (1.13.14-1) ...
Selecting previously unselected package python3-configobj.
Preparing to unpack .../11-python3-configobj_5.0.6-4_all.deb ...
Unpacking python3-configobj (5.0.6-4) ...
Selecting previously unselected package python3-wcwidth.
Preparing to unpack .../12-python3-wcwidth_0.1.9+dfsg1-2_all.deb ...
Unpacking python3-wcwidth (0.1.9+dfsg1-2) ...
Selecting previously unselected package python3-prompt-toolkit.
Preparing to unpack .../13-python3-prompt-toolkit_3.0.6-1_all.deb ...
Unpacking python3-prompt-toolkit (3.0.6-1) ...
Selecting previously unselected package aws-shell.
Preparing to unpack .../14-aws-shell_0.2.1-1_all.deb ...
Unpacking aws-shell (0.2.1-1) ...
Selecting previously unselected package libimagequant0:amd64.
Preparing to unpack .../15-libimagequant0_2.12.2-1.1_amd64.deb ...
Unpacking libimagequant0:amd64 (2.12.2-1.1) ...
Selecting previously unselected package python3-olefile.
Preparing to unpack .../16-python3-olefile_0.46-2_all.deb ...
Unpacking python3-olefile (0.46-2) ...
Selecting previously unselected package python3-pil:amd64.
Preparing to unpack .../17-python3-pil_7.2.0-1_amd64.deb ...
Unpacking python3-pil:amd64 (7.2.0-1) ...
Setting up python3-olefile (0.46-2) ...
Setting up python3-roman (2.0.0-5) ...
Setting up python3-configobj (5.0.6-4) ...
Setting up python3-wcwidth (0.1.9+dfsg1-2) ...
Setting up python3-jmespath (0.10.0-1) ...
Setting up libimagequant0:amd64 (2.12.2-1.1) ...
Setting up docutils-common (0.16+dfsg-3) ...
Setting up python3-pyasn1 (0.4.8-1) ...
Setting up python3-dateutil (2.8.1-4) ...
Setting up python3-prompt-toolkit (3.0.6-1) ...
Setting up python3-pil:amd64 (7.2.0-1) ...
Setting up python3-rsa (4.0-4) ...
Processing triggers for libc-bin (2.32-0ubuntu3) ...
Processing triggers for man-db (2.9.3-2) ...
Processing triggers for shared-mime-info (2.0-1) ...
Processing triggers for sgml-base (1.30) ...
Setting up python3-docutils (0.16+dfsg-3) ...
update-alternatives: using /usr/share/docutils/scripts/python3/rst-buildhtml to provide /usr/bin/rst-buildhtml (rst-buildhtml) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2html to provide /usr/bin/rst2html (rst2html) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2html4 to provide /usr/bin/rst2html4 (rst2html4) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2html5 to provide /usr/bin/rst2html5 (rst2html5) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2latex to provide /usr/bin/rst2latex (rst2latex) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2man to provide /usr/bin/rst2man (rst2man) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2odt to provide /usr/bin/rst2odt (rst2odt) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2odt_prepstyles to provide /usr/bin/rst2odt_prepstyles (rst2odt_prepstyles) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2pseudoxml to provide /usr/bin/rst2pseudoxml (rst2pseudoxml) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2s5 to provide /usr/bin/rst2s5 (rst2s5) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2xetex to provide /usr/bin/rst2xetex (rst2xetex) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rst2xml to provide /usr/bin/rst2xml (rst2xml) in auto mode
update-alternatives: using /usr/share/docutils/scripts/python3/rstpep2html to provide /usr/bin/rstpep2html (rstpep2html) in auto mode
Setting up python3-botocore (1.17.22+repack-1) ...
Setting up python3-s3transfer (0.3.3-1) ...
Setting up awscli (1.18.111-1) ...
Setting up python3-boto3 (1.13.14-1) ...
Setting up aws-shell (0.2.1-1) ...

 $ aws-shell
Traceback (most recent call last):
  File "/usr/bin/aws-shell", line 11, in <module>
    load_entry_point('aws-shell==0.2.1', 'console_scripts', 'aws-shell')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 488, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2861, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2461, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2467, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/awsshell/__init__.py", line 9, in <module>
    from awsshell import app
  File "/usr/lib/python3/dist-packages/awsshell/app.py", line 13, in <module>
    from prompt_toolkit.shortcuts import create_eventloop
ImportError: cannot import name 'create_eventloop' from 'prompt_toolkit.shortcuts' (/usr/lib/python3/dist-packages/prompt_toolkit/shortcuts/__init__.py)
 $ 
@amit-tewari-gelatoab
Copy link

https://stackoverflow.com/a/52019820 worked for me.

@EtricKombat
Copy link

Using ubuntu 18.04 , getting the listed error . The above mentioned steps has been tried out but still not working.

image

@lewis-matthews-uk
Copy link

Also same issue for me in Ubuntu 20.04. Tried all the solutions suggested in stack overflow link, but not worked.

@EtricKombat
Copy link

Can perform CLI tasking using CloudShell going forward ... (just an update)

@Dark-Alex-17
Copy link

I've managed to get it to work on Ubuntu 20.04 by uninstalling, and reinstalling from scratch with

pip install aws-shell --user

or

sudo pip install aws-shell --user

If you use the latter method, you might have to update your path to also include /root/.local/bin since that's where the scripts are installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants