dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.45k stars 662 forks source link

mycli ubuntu install fails with "cannot import name 'CommandLineInterface'" #732

Open peterdutton opened 5 years ago

peterdutton commented 5 years ago

Hi - I'm on Ubuntu 16.04LTS. My terminal output shows the install and runtime error:

$ sudo apt-get install mycli
[sudo] password for peter:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  python3-click python3-colorama python3-configobj python3-crypto python3-prompt-toolkit python3-pygments
  python3-pymysql python3-sqlparse python3-wcwidth
Suggested packages:
  python-configobj-doc python3-crypto-dbg python-crypto-doc ttf-bitstream-vera python-pymysql-doc python-sqlparse-doc
The following NEW packages will be installed
  mycli python3-click python3-colorama python3-configobj python3-crypto python3-prompt-toolkit python3-pygments
  python3-pymysql python3-sqlparse python3-wcwidth
0 to upgrade, 10 to newly install, 0 to remove and 0 not to upgrade.
Need to get 1,140 kB of archives.
After this operation, 6,284 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python3-pymysql all 0.7.2-1ubuntu1 [56.5 kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-colorama all 0.3.7-1 [14.9 kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-click all 6.2-2ubuntu1 [56.2 kB]
Get:4 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 python3-configobj all 5.0.6-2 [34.2 kB]
Get:5 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 python3-pygments all 2.1+dfsg-1 [520 kB]
Get:6 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-wcwidth all 0.1.6+dfsg1-1 [13.8 kB]
Get:7 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-prompt-toolkit all 0.57-1 [127 kB]
Get:8 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 python3-sqlparse all 0.1.18-1 [28.0 kB]
Get:9 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3-crypto amd64 2.6.1-6ubuntu0.16.04.3 [246 kB]
Get:10 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 mycli all 1.5.2-4 [44.0 kB]
Fetched 1,140 kB in 0s (1,428 kB/s)
Selecting previously unselected package python3-pymysql.
(Reading database ... 238055 files and directories currently installed.)
Preparing to unpack .../python3-pymysql_0.7.2-1ubuntu1_all.deb ...
Unpacking python3-pymysql (0.7.2-1ubuntu1) ...
Selecting previously unselected package python3-colorama.
Preparing to unpack .../python3-colorama_0.3.7-1_all.deb ...
Unpacking python3-colorama (0.3.7-1) ...
Selecting previously unselected package python3-click.
Preparing to unpack .../python3-click_6.2-2ubuntu1_all.deb ...
Unpacking python3-click (6.2-2ubuntu1) ...
Selecting previously unselected package python3-configobj.
Preparing to unpack .../python3-configobj_5.0.6-2_all.deb ...
Unpacking python3-configobj (5.0.6-2) ...
Selecting previously unselected package python3-pygments.
Preparing to unpack .../python3-pygments_2.1+dfsg-1_all.deb ...
Unpacking python3-pygments (2.1+dfsg-1) ...
Selecting previously unselected package python3-wcwidth.
Preparing to unpack .../python3-wcwidth_0.1.6+dfsg1-1_all.deb ...
Unpacking python3-wcwidth (0.1.6+dfsg1-1) ...
Selecting previously unselected package python3-prompt-toolkit.
Preparing to unpack .../python3-prompt-toolkit_0.57-1_all.deb ...
Unpacking python3-prompt-toolkit (0.57-1) ...
Selecting previously unselected package python3-sqlparse.
Preparing to unpack .../python3-sqlparse_0.1.18-1_all.deb ...
Unpacking python3-sqlparse (0.1.18-1) ...
Selecting previously unselected package python3-crypto.
Preparing to unpack .../python3-crypto_2.6.1-6ubuntu0.16.04.3_amd64.deb ...
Unpacking python3-crypto (2.6.1-6ubuntu0.16.04.3) ...
Selecting previously unselected package mycli.
Preparing to unpack .../archives/mycli_1.5.2-4_all.deb ...
Unpacking mycli (1.5.2-4) ...
Setting up python3-pymysql (0.7.2-1ubuntu1) ...
Setting up python3-colorama (0.3.7-1) ...
Setting up python3-click (6.2-2ubuntu1) ...
Setting up python3-configobj (5.0.6-2) ...
Setting up python3-pygments (2.1+dfsg-1) ...
Setting up python3-wcwidth (0.1.6+dfsg1-1) ...
Setting up python3-prompt-toolkit (0.57-1) ...
Setting up python3-sqlparse (0.1.18-1) ...
Setting up python3-crypto (2.6.1-6ubuntu0.16.04.3) ...
Setting up mycli (1.5.2-4) ...

$ mycli
Traceback (most recent call last):
  File "/usr/bin/mycli", line 9, in <module>
    load_entry_point('mycli==1.5.2', 'console_scripts', 'console')()
  File "/home/peter/.local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/peter/.local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/home/peter/.local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/home/peter/.local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/share/mycli/mycli/main.py", line 17, in <module>
    from prompt_toolkit import CommandLineInterface, Application, AbortAction
ImportError: cannot import name 'CommandLineInterface'

Any suggestions on how I can get around this?

Thanks

foamzou commented 5 years ago

I Can not guess what makes the error. But u can try anther way to install it. remove your mycli. try to pip install mycli OR easy_install mycli

gorillamoe commented 5 years ago

I Can not guess what makes the error. But u can try anther way to install it. remove your mycli. try to pip install mycli OR easy_install mycli

Throws the same error message.

gorillamoe commented 5 years ago

I have to correct this statement: easy_install mycli works, whereas the pip install mycli or pip3 install mycli results in the same error message.

meeuw commented 5 years ago

It seems this is related to prompt_toolkit, mycli uses a newer version than ubuntu/debian has installed and that causes conflicts. I'd suggest to install mycli in a virtualenv: (as non-root user)

virtualenv ~/mycli
~/mycli/bin/pip install mycli
ln -s ~/mycli/bin/mycli ~/bin/mycli