dbcli / mycli

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

pip install mycli on linux error #102

Closed polaris1119 closed 8 years ago

polaris1119 commented 9 years ago

This error:

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/mycli/main.py', 174, 29, ' return {x: get(x) for x in keys}\n'))

amjith commented 9 years ago

My bad. I added a new feature last night that broke the app. Can you try downgrading?

If you installed via pip. Please run pip uninstall mycli and then reinstall it using pip install mycli==1.0.1.

If you installed it via debian package. Please run sudo apt-get remove mycli and sudo apt-get install mycli.

I'm terribly sorry about the bug. I'll add tavis ci to run the automated tests to make sure this doesn't happen again.

amjith commented 9 years ago

I've released a new version (1.1.1) to PyPI. Please upgrade to the latest version.

pip install -U mycli 
polaris1119 commented 9 years ago

Another Error:

pip install -U mycli

Downloading/unpacking mycli Running setup.py egg_info for package mycli Requirement already up-to-date: click>=4.1 in /usr/lib/python2.6/site-packages (from mycli) Requirement already up-to-date: Pygments>=2.0 in /usr/lib/python2.6/site-packages (from mycli) Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement prompt-toolkit==0.42 in /usr/lib/python2.6/site-packages (from mycli) Downloading/unpacking prompt-toolkit==0.42 (from mycli) Running setup.py egg_info for package prompt-toolkit Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement PyMySQL>=0.6.6 in /usr/lib/python2.6/site-packages (from mycli) Downloading/unpacking PyMySQL>=0.6.6 (from mycli) Running setup.py egg_info for package PyMySQL Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement sqlparse==0.1.14 in /usr/lib/python2.6/site-packages (from mycli) Downloading/unpacking sqlparse==0.1.14 (from mycli) Running setup.py egg_info for package sqlparse Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement configobj>=5.0.6 in /usr/lib/python2.6/site-packages (from mycli) Downloading/unpacking configobj>=5.0.6 (from mycli) Running setup.py egg_info for package configobj Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement six>=1.9.0 in /usr/lib/python2.6/site-packages (from prompt-toolkit==0.42->mycli) Downloading/unpacking six>=1.9.0 (from prompt-toolkit==0.42->mycli) Running setup.py egg_info for package six no previously-included directories found matching 'documentation/_build' Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement wcwidth in /usr/lib/python2.6/site-packages (from prompt-toolkit==0.42->mycli) Downloading/unpacking wcwidth (from prompt-toolkit==0.42->mycli) Running setup.py egg_info for package wcwidth Installing collected packages: mycli, prompt-toolkit, PyMySQL, sqlparse, configobj, six, wcwidth Running setup.py install for mycli SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/mycli/main.py', 174, 29, ' return {x: get(x) for x in keys}\n'))

Installing mycli script to /usr/bin

Found existing installation: prompt-toolkit 0.42 Uninstalling prompt-toolkit: Successfully uninstalled prompt-toolkit Running setup.py install for prompt-toolkit SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/prompt_toolkit/contrib/validators/base.py', 24, 43, ' self.sentences = {s.lower() for s in self.sentences}\n'))

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/prompt_toolkit/contrib/telnet/server.py', 350, 41, '                self.connections = {c for c in self.connections if not c.closed}\n'))

Found existing installation: PyMySQL 0.6.6 Uninstalling PyMySQL: Successfully uninstalled PyMySQL Running setup.py install for PyMySQL Found existing installation: sqlparse 0.1.14 Uninstalling sqlparse: Successfully uninstalled sqlparse Running setup.py install for sqlparse changing mode of /usr/bin/sqlformat to 755 Found existing installation: configobj 5.0.6 Uninstalling configobj: Successfully uninstalled configobj Running setup.py install for configobj Found existing installation: six 1.9.0 Uninstalling six: Successfully uninstalled six Running setup.py install for six no previously-included directories found matching 'documentation/_build' Found existing installation: wcwidth 0.1.4 Uninstalling wcwidth: Successfully uninstalled wcwidth Running setup.py install for wcwidth Successfully installed mycli prompt-toolkit PyMySQL sqlparse configobj six wcwidth Cleaning up...

amjith commented 9 years ago

I don't think that updated mycli correctly. You can check the current version of mycli by trying:

mycli --version

If it is not 1.1.1 then you don't have the latest released version.

Can you uninstall it completely and try installing again?

pip uninstall mycli 
pip install mycli

If that is still giving you trouble try installing directly from the git repo:

pip install https://github.com/dbcli/mycli/archive/master.zip
polaris1119 commented 9 years ago

[root@node001 ~]# pip uninstall mycli Cannot uninstall requirement mycli, not installed Storing complete log in /home/xxx/.pip/pip.log [root@node001 ~]# pip install mycli Downloading/unpacking mycli Running setup.py egg_info for package mycli Requirement already satisfied (use --upgrade to upgrade): click>=4.1 in /usr/lib/python2.6/site-packages (from mycli) Requirement already satisfied (use --upgrade to upgrade): Pygments>=2.0 in /usr/lib/python2.6/site-packages (from mycli) Requirement already satisfied (use --upgrade to upgrade): prompt-toolkit==0.42 in /usr/lib/python2.6/site-packages (from mycli) Requirement already satisfied (use --upgrade to upgrade): PyMySQL>=0.6.6 in /usr/lib/python2.6/site-packages (from mycli) Requirement already satisfied (use --upgrade to upgrade): sqlparse==0.1.14 in /usr/lib/python2.6/site-packages (from mycli) Requirement already satisfied (use --upgrade to upgrade): configobj>=5.0.6 in /usr/lib/python2.6/site-packages (from mycli) Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/lib/python2.6/site-packages (from prompt-toolkit==0.42->mycli) Requirement already satisfied (use --upgrade to upgrade): wcwidth in /usr/lib/python2.6/site-packages (from prompt-toolkit==0.42->mycli) Installing collected packages: mycli Running setup.py install for mycli SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/mycli/main.py', 174, 29, ' return {x: get(x) for x in keys}\n'))

Installing mycli script to /usr/bin

Successfully installed mycli Cleaning up...

I install from git repo,record:

[root@node001 ~]# pip uninstall mycli Uninstalling mycli: /usr/bin/mycli /usr/lib/python2.6/site-packages/AUTHORS /usr/lib/python2.6/site-packages/SPONSORS /usr/lib/python2.6/site-packages/mycli-1.1.0-py2.6.egg-info /usr/lib/python2.6/site-packages/mycli/init.py /usr/lib/python2.6/site-packages/mycli/init.pyc /usr/lib/python2.6/site-packages/mycli/clibuffer.py /usr/lib/python2.6/site-packages/mycli/clibuffer.pyc /usr/lib/python2.6/site-packages/mycli/clistyle.py /usr/lib/python2.6/site-packages/mycli/clistyle.pyc /usr/lib/python2.6/site-packages/mycli/clitoolbar.py /usr/lib/python2.6/site-packages/mycli/clitoolbar.pyc /usr/lib/python2.6/site-packages/mycli/config.py /usr/lib/python2.6/site-packages/mycli/config.pyc /usr/lib/python2.6/site-packages/mycli/encodingutils.py /usr/lib/python2.6/site-packages/mycli/encodingutils.pyc /usr/lib/python2.6/site-packages/mycli/key_bindings.py /usr/lib/python2.6/site-packages/mycli/key_bindings.pyc /usr/lib/python2.6/site-packages/mycli/lexer.py /usr/lib/python2.6/site-packages/mycli/lexer.pyc /usr/lib/python2.6/site-packages/mycli/magic.py /usr/lib/python2.6/site-packages/mycli/magic.pyc /usr/lib/python2.6/site-packages/mycli/main.py /usr/lib/python2.6/site-packages/mycli/myclirc /usr/lib/python2.6/site-packages/mycli/packages/init.py /usr/lib/python2.6/site-packages/mycli/packages/init.pyc /usr/lib/python2.6/site-packages/mycli/packages/completion_engine.py /usr/lib/python2.6/site-packages/mycli/packages/completion_engine.pyc /usr/lib/python2.6/site-packages/mycli/packages/counter.py /usr/lib/python2.6/site-packages/mycli/packages/counter.pyc /usr/lib/python2.6/site-packages/mycli/packages/expanded.py /usr/lib/python2.6/site-packages/mycli/packages/expanded.pyc /usr/lib/python2.6/site-packages/mycli/packages/parseutils.py /usr/lib/python2.6/site-packages/mycli/packages/parseutils.pyc /usr/lib/python2.6/site-packages/mycli/packages/special/init.py /usr/lib/python2.6/site-packages/mycli/packages/special/init.pyc /usr/lib/python2.6/site-packages/mycli/packages/special/dbcommands.py /usr/lib/python2.6/site-packages/mycli/packages/special/dbcommands.pyc /usr/lib/python2.6/site-packages/mycli/packages/special/favoritequeries.py /usr/lib/python2.6/site-packages/mycli/packages/special/favoritequeries.pyc /usr/lib/python2.6/site-packages/mycli/packages/special/iocommands.py /usr/lib/python2.6/site-packages/mycli/packages/special/iocommands.pyc /usr/lib/python2.6/site-packages/mycli/packages/special/main.py /usr/lib/python2.6/site-packages/mycli/packages/special/main.pyc /usr/lib/python2.6/site-packages/mycli/packages/tabulate.py /usr/lib/python2.6/site-packages/mycli/packages/tabulate.pyc /usr/lib/python2.6/site-packages/mycli/sqlcompleter.py /usr/lib/python2.6/site-packages/mycli/sqlcompleter.pyc /usr/lib/python2.6/site-packages/mycli/sqlexecute.py /usr/lib/python2.6/site-packages/mycli/sqlexecute.pyc Proceed (y/n)? y Successfully uninstalled mycli [root@node001 ~]# pip install https://github.com/dbcli/mycli/archive/master.zip Downloading/unpacking https://github.com/dbcli/mycli/archive/master.zip Downloading master.zip (260kB): 260kB downloaded Running setup.py egg_info for package from https://github.com/dbcli/mycli/archive/master.zip Requirement already satisfied (use --upgrade to upgrade): click>=4.1 in /usr/lib/python2.6/site-packages (from mycli==1.2.0) Requirement already satisfied (use --upgrade to upgrade): Pygments>=2.0 in /usr/lib/python2.6/site-packages (from mycli==1.2.0) Downloading/unpacking prompt-toolkit==0.45 (from mycli==1.2.0) Running setup.py egg_info for package prompt-toolkit Requested prompt-toolkit==0.45 (from mycli==1.2.0), but installing version 0.42 Requirement already satisfied (use --upgrade to upgrade): PyMySQL>=0.6.6 in /usr/lib/python2.6/site-packages (from mycli==1.2.0) Requirement already satisfied (use --upgrade to upgrade): sqlparse==0.1.14 in /usr/lib/python2.6/site-packages (from mycli==1.2.0) Requirement already satisfied (use --upgrade to upgrade): configobj>=5.0.6 in /usr/lib/python2.6/site-packages (from mycli==1.2.0) Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/lib/python2.6/site-packages (from prompt-toolkit==0.45->mycli==1.2.0) Requirement already satisfied (use --upgrade to upgrade): wcwidth in /usr/lib/python2.6/site-packages (from prompt-toolkit==0.45->mycli==1.2.0) Installing collected packages: prompt-toolkit, mycli Found existing installation: prompt-toolkit 0.42 Uninstalling prompt-toolkit: Successfully uninstalled prompt-toolkit Running setup.py install for prompt-toolkit SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/prompt_toolkit/contrib/validators/base.py', 24, 43, ' self.sentences = {s.lower() for s in self.sentences}\n'))

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/prompt_toolkit/contrib/telnet/server.py', 350, 41, '                self.connections = {c for c in self.connections if not c.closed}\n'))

Running setup.py install for mycli Installing mycli script to /usr/bin Successfully installed prompt-toolkit mycli Cleaning up...

amjith commented 9 years ago

Looks like prompt_toolkit is using a dictionary comprehension which is only available in Python 2.7 and above.

I'll have to send a PR to @jonathanslenders prompt_toolkit repo to fix it.

The weird thing is I can't seem to reproduce this issue when I try it on Python 2.6 on my machine.

Can you run pip freeze and paste the output here?

jonathanslenders commented 9 years ago

That Python 2.6 syntax bug has been fixed: https://github.com/jonathanslenders/python-prompt-toolkit/commit/53302297094283182557117f801b058abc937b49

I also added all of my source code files to the test suite, so that Travis at least will tell me when I write something that's not valid for 2.6: https://github.com/jonathanslenders/python-prompt-toolkit/commit/700807c3e958278f617d9e4b6d3e1486e141cfda

I'll make a new pull request later when I have a new release. Sorry for the inconvenience!

amjith commented 9 years ago

Thanks for fixing that Jonathan.

Once the new version of prompt_toolkit is out, I'll update the dependency for mycli.

amjith commented 9 years ago

The master branch is updated with the latest version of prompt_toolkit.

You can install directly from master as follows:

pip install -U https://github.com/dbcli/mycli/archive/master.zip
haughtynie commented 9 years ago

Help..............................

mycli --help

Traceback (most recent call last): File "/usr/bin/mycli", line 5, in from pkg_resources import load_entry_point File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in working_set.require(requires) File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: PyMySQL>=0.6.6

amjith commented 9 years ago

@haughtynie Can you try installing it via easy_install?

easy_install mycli 

There seems to be some problem with pip and Python 2.6.

haughtynie commented 9 years ago

I install directly from master as follows:pip install -U https://github.com/dbcli/mycli/archive/master.zip Are there some differences with using easy_install mycli ?

haughtynie commented 9 years ago

@amjith The problem has been solved according to your suggestion.thanks.

amjith commented 9 years ago

There is no different with installing mycli with easy_install but pip seems to have issues installing some packages in Python 2.6.

I'm glad you were able to resolve the issue.

haughtynie commented 9 years ago

thank you 这一版本好像不支持system操作。 it does not surpport the command 'system',such as system clear;system cat /home/mysql/mysql/data/test/haughty.txt;

amjith commented 9 years ago

You're right 'system' command is not yet available in mycli.

I've filed a new ticket to track that. https://github.com/dbcli/mycli/issues/130

lebe-dev commented 9 years ago

solution: easy_install mycli

env: CentOS 6.X+

silviabotros commented 8 years ago

As far as I can tell installation of mycli in centos is still broken.

[foo@bar ~]# easy_install mycli
Searching for mycli
Reading http://pypi.repo.sjc1.sendgrid.net/simple/mycli/
Best match: mycli 1.5.2
Downloading https://pypi.python.org/packages/source/m/mycli/mycli-1.5.2.tar.gz#md5=5649febe9f92c1f49d5efa605103d14c
Processing mycli-1.5.2.tar.gz
Running mycli-1.5.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-U6tT8g/mycli-1.5.2/egg-dist-tmp-Gl_yFw
zip_safe flag not set; analyzing archive contents...
mycli.main: module references __file__
mycli.packages.literals.main: module references __file__
Adding mycli 1.5.2 to easy-install.pth file
Installing mycli script to /usr/bin

Installed /usr/lib/python2.6/site-packages/mycli-1.5.2-py2.6.egg
Processing dependencies for mycli
Searching for pycrypto>=2.6.1
Reading http://pypi.repo.sjc1.sendgrid.net/simple/pycrypto/
Best match: pycrypto 2.6.1
Downloading https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz#md5=55a61a054aa66812daf5161a0d5d7eda
Processing pycrypto-2.6.1.tar.gz
Running pycrypto-2.6.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-uJDJNZ/pycrypto-2.6.1/egg-dist-tmp-znwPEW
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
src/MD2.c:31:20: error: Python.h: No such file or directory
src/MD2.c:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
In file included from src/MD2.c:147:
src/hash_template.c:48: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/hash_template.c:59: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
src/hash_template.c: In function ‘newALGobject’:
src/hash_template.c:69: warning: implicit declaration of function ‘PyObject_New’
src/hash_template.c:69: error: expected expression before ‘ALGobject’
src/hash_template.c: At top level:
src/hash_template.c:76: error: expected ‘)’ before ‘*’ token
src/hash_template.c:91: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:110: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:122: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:162: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:188: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:190: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALG_methods’
src/hash_template.c:199: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:225: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALGtype’
src/hash_template.c:271: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:304: error: array type has incomplete element type
src/hash_template.c:305: error: ‘PyCFunction’ undeclared here (not in a function)
src/hash_template.c:305: error: expected ‘}’ before ‘ALG_new’
src/hash_template.c: In function ‘init_MD2’:
src/hash_template.c:339: error: ‘PyObject’ undeclared (first use in this function)
src/hash_template.c:339: error: (Each undeclared identifier is reported only once
src/hash_template.c:339: error: for each function it appears in.)
src/hash_template.c:339: error: ‘m’ undeclared (first use in this function)
src/hash_template.c:351: error: ‘ALGtype’ undeclared (first use in this function)
src/hash_template.c:351: error: ‘PyType_Type’ undeclared (first use in this function)
src/hash_template.c:352: warning: implicit declaration of function ‘Py_InitModule’
src/hash_template.c:356: error: ‘o’ undeclared (first use in this function)
src/hash_template.c:356: warning: implicit declaration of function ‘PyInt_FromLong’
src/hash_template.c:356: warning: implicit declaration of function ‘PyDict_SetItemString’
src/hash_template.c:356: warning: implicit declaration of function ‘PyModule_GetDict’
src/hash_template.c:356: warning: implicit declaration of function ‘Py_DECREF’
src/hash_template.c:360: warning: implicit declaration of function ‘PyErr_Occurred’
src/hash_template.c:361: warning: implicit declaration of function ‘Py_FatalError’
error: Setup script exited with error: command 'gcc' failed with exit status 1

Cent release

cat /etc/centos-release
CentOS release 6.5 (Final)
silviabotros commented 8 years ago

It also just occured to me that maybe my error is because I am missing an expected developer headers package? Can we get more guidance on what the prerequisites for mycli are?

I am happy to create an RPM for the project if I get this working :)

amjith commented 8 years ago

@silviabotros Sorry about the late reply, I'm traveling a bit and internet is spotty.

pycrypto is a newly added dependency to mycli. Can you try installing pycrypto via yum?

You can try: yum install python-pycrypto.

I also found this bug report with a possible fix. https://bugs.launchpad.net/pycrypto/+bug/1294670

If you're still having trouble, let me know and I'll try to get a VM running locally to test it out.

silviabotros commented 8 years ago

No problem Amijith :)

I actually got past the issue above. I forgot to install the python-devel and that fixed it...I made an RPM from there but it doesnt work yet on centos6.x and that was why I hadn't come back with an RPM

lku commented 8 years ago

You can try: yum install python-pycrypto.

On fedora it is python-crypto package: dnf install python-crypto

amjith commented 8 years ago

Please reopen if the issue still persists.

Released a new version of mycli 1.6.0. Please upgrade:

pip install -U mycli 
romberli commented 7 years ago

i got the same error on RHEL6.2 with python 2.6, i tried both using pip and easy_install, the issue does not disappeared,waiting for your help,thanks in advance.

[root@hc09 yum.repos.d]# mycli --help
Traceback (most recent call last):
  File "/usr/bin/mycli", line 9, in <module>
    load_entry_point('mycli==1.9.0', 'console_scripts', 'mycli')()
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.6/site-packages/mycli/main.py", line 304
    return {x: get(x) for x in keys}
                        ^
SyntaxError: invalid syntax
j-bennet commented 7 years ago

We do not support python 2.6 anymore. Python core team ended support for it in 2013.

romberli commented 7 years ago

thanks for your answer,as we still use python 2.6 in production envirenment,it's hard to upgrade to the lastest version, may i install mycli in python virtualenv?

j-bennet commented 7 years ago

Yes, mycli works fine in a venv. Sorry about the inconvenience.

amjith commented 7 years ago

@romber2001 We discontinued support for 2.6 in the latest version of mycli. You can still use the older version of mycli (1.8.1) which will work in Python 2.6.

meeuw commented 7 years ago

@romber2001 you cannot use virtualenv to install a newer version of Python; virtualenv is bound to your system's Python version(s) so I don't think virtualenv will help you.

ordiy commented 4 years ago

os version: centos7. python version: 2.7.5 use this command install mycli

pip install mycli==1.16.0 --user