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

Traceback on first run #27

Closed
treystout opened this issue Jan 6, 2015 · 24 comments
Closed

Traceback on first run #27

treystout opened this issue Jan 6, 2015 · 24 comments
Labels

Comments

@treystout
Copy link

Ubuntu 14.04, Python 2.7.3 (inside an activated virtualenv)
pgcli==0.10.0 (installed inside activated virtualenv)

I get the following...

665 18:30:11 [~/code/ottoman] J:0 venv λ customcart ▼ pgcli ottoman
Traceback (most recent call last):
  File "/home/vagrant/code/ottoman/venv/bin/pgcli", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/home/vagrant/code/ottoman/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2603, in <module>
  File "/home/vagrant/code/ottoman/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 666, in require
  File "/home/vagrant/code/ottoman/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: Click
668 18:31:29 [~/code/ottoman] J:0 venv λ customcart ▼ psql ottoman
psql (9.3.5)
Type "help" for help.

ottoman=# \q
@treystout
Copy link
Author

Forgot to say thank you for this project. If there's 2 things I love, they're powerful CLIs and Postgres!

@amjith
Copy link
Member

amjith commented Jan 6, 2015

@treystout Can you tell me how you installed pgcli?

This error message: pkg_resources.DistributionNotFound: Click says that Click is not installed which is a dependency for pgcli.

That dependency should be automatically installed when you pip install pgcli.

@treystout
Copy link
Author

Sure thing, I saved the install log, inline below...

654 17:32:50 [~/code/ottoman] J:0 venv λ customcart ▼ pip install pgcli
Downloading/unpacking pgcli
  Downloading pgcli-0.10.0.tar.gz
  Running setup.py (path:/home/vagrant/code/ottoman/venv/build/pgcli/setup.py) egg_info for package pgcli

Downloading/unpacking Click (from pgcli)
  Downloading click-3.3-py2.py3-none-any.whl (58kB): 58kB downloaded
Downloading/unpacking prompt-toolkit (from pgcli)
  Downloading prompt_toolkit-0.25.tar.gz (93kB): 93kB downloaded
  Running setup.py (path:/home/vagrant/code/ottoman/venv/build/prompt-toolkit/setup.py) egg_info for package prompt-toolkit

Requirement already satisfied (use --upgrade to upgrade): psycopg2 in ./venv/lib/python2.7/site-packages (from pgcli)
Downloading/unpacking sqlparse (from pgcli)
  Downloading sqlparse-0.1.14.tar.gz (55kB): 55kB downloaded
  Running setup.py (path:/home/vagrant/code/ottoman/venv/build/sqlparse/setup.py) egg_info for package sqlparse

Requirement already satisfied (use --upgrade to upgrade): docopt in ./venv/lib/python2.7/site-packages (from prompt-toolkit->pgcli)
Downloading/unpacking jedi>=0.8.1 (from prompt-toolkit->pgcli)
  Downloading jedi-0.8.1-final0.tar.gz (298kB): 298kB downloaded
  Running setup.py (path:/home/vagrant/code/ottoman/venv/build/jedi/setup.py) egg_info for package jedi

    warning: no previously-included files matching '*.pyc' found under directory '*'
Requirement already satisfied (use --upgrade to upgrade): pygments in ./venv/lib/python2.7/site-packages (from prompt-toolkit->pgcli)
Downloading/unpacking six>=1.8.0 (from prompt-toolkit->pgcli)
  Downloading six-1.9.0-py2.py3-none-any.whl
Downloading/unpacking wcwidth (from prompt-toolkit->pgcli)
  Downloading wcwidth-0.1.4-py2.py3-none-any.whl
Installing collected packages: pgcli, Click, prompt-toolkit, sqlparse, jedi, six, wcwidth
  Running setup.py install for pgcli

    Installing pgcli script to /home/vagrant/code/ottoman/venv/bin
  Running setup.py install for prompt-toolkit

    Installing ptpython script to /home/vagrant/code/ottoman/venv/bin
    Installing ptipython script to /home/vagrant/code/ottoman/venv/bin
  Running setup.py install for sqlparse
    changing mode of build/scripts-2.7/sqlformat from 664 to 775

    changing mode of /home/vagrant/code/ottoman/venv/bin/sqlformat to 775
  Running setup.py install for jedi

    warning: no previously-included files matching '*.pyc' found under directory '*'
Successfully installed pgcli Click prompt-toolkit sqlparse jedi six wcwidth
Cleaning up...
670 18:43:55 [~/code/ottoman] J:0 venv λ customcart ▼ pip freeze | grep click
click==3.3

@duffytilleman
Copy link

I'm seeing the same issue. Mac OS, system python 2.7.5, pip 1.5.6

$ pip show pgcli
---
Name: pgcli
Version: 0.10.0
Location: /Library/Python/2.7/site-packages
Requires: Click, prompt-toolkit, psycopg2, sqlparse

$ pip show click
---
Name: click
Version: 3.3
Location: /Library/Python/2.7/site-packages
Requires:

@amjith
Copy link
Member

amjith commented Jan 6, 2015

Let's try a couple of things.

  1. What shell are you using? If you're using zsh, can you issue a hash -r before trying?
  2. Can you try: python -c 'import click; print (click.__version__)'. This will check if click is successfully imported by python.

@macobo
Copy link
Contributor

macobo commented Jan 6, 2015

Something to try is case-sensitivity - what happens if you clone pgcli and change Click to click in setup.py.

Would check myself, but don't have a mac to test it with.

@amjith
Copy link
Member

amjith commented Jan 7, 2015

I think @macobo might be right in pointing out that this is a case-sensitivity issue in setup.py.

Although I haven't been able to reproduce it I've changed the requirement from 'Click' to 'click'. Hopefully this will fix the issue.

https://github.com/amjith/pgcli/blob/master/setup.py#L26

@amjith amjith added the bug label Jan 7, 2015
@amjith
Copy link
Member

amjith commented Jan 7, 2015

Version 0.10.1 released to PyPI. https://pypi.python.org/pypi/pgcli/0.10.1

Can you please try this new version to see if it fixes the issue?

@thiagophx
Copy link

Hi @amjith the changes you made definitely fixed the problem with click dependency.
However, the same issue is now happening to pygments, I believe it's the exact same problem, so I tried to do what @macobo said, I tried to change dependency name in setup.py, but it didn't work.

I'm pretty sure I'm doing something wrong, because I'm not really sure what the steps are to make this change.

Here's what I did:

Can you tell me what are the steps I need to go through in order to make this change?
Then, I'll be able to make sure that all dependencies are working fine.

UPDATE

After changing setup.py from pygments to Pygments and run python setup.py install, it worked. 👍

Thanks.

@treystout
Copy link
Author

0.10.1 fixed the Click dependency issue originally reported, otherwise I had the exact same experience as @thiagophx.

There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton

@amjith
Copy link
Member

amjith commented Jan 7, 2015

@thiagophx Can you paste the snippet of code in setup.py that made it finally work?

If I understand you correctly, click has to be all lowercase and Pygments has to be capital case? This is nuts.

@treystout Did you also have to change pygments to Pygments in setup.py? I'm starting to think that cache invalidation might be an easier problem to deal with. :P

@thiagophx
Copy link

That's right, @amjith, it seems that click has to be all lowercase and Pygments has to be capital case 😭
Here's my current setup.py:

import re
import ast
from setuptools import setup, find_packages

_version_re = re.compile(r'__version__\s+=\s+(.*)')

with open('pgcli/__init__.py', 'rb') as f:
    version = str(ast.literal_eval(_version_re.search(
        f.read().decode('utf-8')).group(1)))

description = 'CLI for Postgres Database. With auto-completion and syntax highlighting.'


setup(
        name='pgcli',
        author='Amjith Ramanujam',
        author_email='amjith[dot]r[at]gmail.com',
        version=version,
        license='LICENSE.txt',
        url='http://pgcli.com',
        packages=find_packages(),
        package_data={'pgcli': ['pgclirc']},
        description=description,
        long_description=open('README.rst').read(),
        install_requires=[
            'click >= 3.2',
            'prompt_toolkit==0.25',  # Need to pin this to 0.25 since APIs change quite a bit after this.
            'psycopg2 >= 2.5.4',
            'sqlparse >= 0.1.14',
            'Pygments >= 2.0'
            ],
        entry_points='''
            [console_scripts]
            pgcli=pgcli.main:cli
        ''',
        classifiers=[
            'Intended Audience :: Developers',
            'License :: OSI Approved :: BSD License',
            'Operating System :: Unix',
            'Programming Language :: Python',
            'Programming Language :: Python :: 2.6',
            'Programming Language :: Python :: 2.7',
            'Programming Language :: Python :: 3',
            'Programming Language :: Python :: 3.3',
            'Programming Language :: Python :: 3.4',
            'Programming Language :: SQL',
            'Topic :: Database',
            'Topic :: Database :: Front-Ends',
            'Topic :: Software Development',
            'Topic :: Software Development :: Libraries :: Python Modules',
            ],
        )

@amjith
Copy link
Member

amjith commented Jan 7, 2015

New version in PyPI to address this issue. https://pypi.python.org/pypi/pgcli/0.10.2

Thank you for reporting it.

@amjith amjith closed this as completed Jan 7, 2015
@duffytilleman
Copy link

In case this helps someone else: I still had issues with pkg_resources.DistributionNotFound: Pygments after installing version 0.10.2 with pip, but it worked after using pip install --download, then directly running python setup.py install in the downloaded pgcli directory.

Thanks for your help, and after trying it out, I love it, it's going to be a part of my workflow for sure.

@treystout
Copy link
Author

Would recommend re-opening this til pip can install it cleanly.

Here's a log on my machine of making a brand-new virtual env, install pgcli, and then seeing the pygments error on first run (0.10.2)

02 20:39:59 [~] J:1 !  ▼ mkdir test
803 20:40:06 [~] J:1 !cd test/
804 20:40:08 [~/test] J:1 !  ▼ ll
total 8
drwxrwxr-x  2 vagrant vagrant 4096 Jan  7 20:40 ./
drwxr-xr-x 18 vagrant vagrant 4096 Jan  7 20:40 ../
805 20:40:08 [~/test] J:1 !  ▼ virtualenv venv
New python executable in venv/bin/python
Installing setuptools...............................done.
Installing pip............................done.
806 20:40:24 [~/test] J:1 !. venv/bin/activate
807 20:40:28 [~/test] J:1 venv  ▼ pip install pgcli
Collecting pgcli
  Downloading pgcli-0.10.2.tar.gz
Collecting click>=3.2 (from pgcli)
  Downloading click-3.3-py2.py3-none-any.whl (58kB)
    100% |################################| 61kB 957kB/s
Collecting Pygments>=2.0 (from pgcli)
  Downloading Pygments-2.0.1-py2-none-any.whl (672kB)
    100% |################################| 675kB 1.7MB/s
Collecting jedi==0.8.1 (from pgcli)
  Downloading jedi-0.8.1.tar.gz (304kB)
    100% |################################| 307kB 1.6MB/s
Collecting prompt-toolkit==0.25 (from pgcli)
  Downloading prompt_toolkit-0.25.tar.gz (93kB)
    100% |################################| 94kB 1.1MB/s
Collecting psycopg2>=2.5.4 (from pgcli)
  Downloading psycopg2-2.5.4.tar.gz (682kB)
    100% |################################| 684kB 1.4MB/s
Collecting sqlparse>=0.1.14 (from pgcli)
  Downloading sqlparse-0.1.14.tar.gz (55kB)
    100% |################################| 57kB 1.7MB/s
Collecting docopt (from prompt-toolkit==0.25->pgcli)
  Downloading docopt-0.6.2.tar.gz
Collecting six>=1.8.0 (from prompt-toolkit==0.25->pgcli)
  Downloading six-1.9.0-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit==0.25->pgcli)
  Downloading wcwidth-0.1.4-py2.py3-none-any.whl
Installing collected packages: wcwidth, six, docopt, sqlparse, psycopg2, prompt-toolkit, jedi, Pygments, click, pgcli


  Running setup.py install for docopt
  Running setup.py install for sqlparse
    changing mode of build/scripts-2.7/sqlformat from 664 to 775
    changing mode of /home/vagrant/test/venv/bin/sqlformat to 775
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/green.c -o build/temp.linux-x86_64-2.7/psycopg/green.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/pqpath.c -o build/temp.linux-x86_64-2.7/psycopg/pqpath.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/utils.c -o build/temp.linux-x86_64-2.7/psycopg/utils.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/bytes_format.c -o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/connection_int.c -o build/temp.linux-x86_64-2.7/psycopg/connection_int.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/connection_type.c -o build/temp.linux-x86_64-2.7/psycopg/connection_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/cursor_int.c -o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/cursor_type.c -o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/diagnostics_type.c -o build/temp.linux-x86_64-2.7/psycopg/diagnostics_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/error_type.c -o build/temp.linux-x86_64-2.7/psycopg/error_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/lobject_int.c -o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/lobject_type.c -o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/notify_type.c -o build/temp.linux-x86_64-2.7/psycopg/notify_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/xid_type.c -o build/temp.linux-x86_64-2.7/psycopg/xid_type.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_binary.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_datetime.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_list.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_pboolean.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_pdecimal.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_pint.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pint.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_pfloat.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/adapter_qstring.c -o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/microprotocols.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/microprotocols_proto.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o -Wdeclaration-after-statement
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090305 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/typecast.c -o build/temp.linux-x86_64-2.7/psycopg/typecast.o -Wdeclaration-after-statement
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o build/temp.linux-x86_64-2.7/psycopg/green.o build/temp.linux-x86_64-2.7/psycopg/pqpath.o build/temp.linux-x86_64-2.7/psycopg/utils.o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o build/temp.linux-x86_64-2.7/psycopg/connection_int.o build/temp.linux-x86_64-2.7/psycopg/connection_type.o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o build/temp.linux-x86_64-2.7/psycopg/diagnostics_type.o build/temp.linux-x86_64-2.7/psycopg/error_type.o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o build/temp.linux-x86_64-2.7/psycopg/notify_type.o build/temp.linux-x86_64-2.7/psycopg/xid_type.o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o build/temp.linux-x86_64-2.7/psycopg/adapter_pint.o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o build/temp.linux-x86_64-2.7/psycopg/typecast.o -L/usr/lib/x86_64-linux-gnu -lpq -o build/lib.linux-x86_64-2.7/psycopg2/_psycopg.so
  Running setup.py install for prompt-toolkit
    Installing ptpython script to /home/vagrant/test/venv/bin
    Installing ptipython script to /home/vagrant/test/venv/bin
  Running setup.py install for jedi


  Running setup.py install for pgcli
    Installing pgcli script to /home/vagrant/test/venv/bin
Successfully installed Pygments-2.0.1 click-3.3 docopt-0.6.2 jedi-0.8.1 pgcli-0.10.2 prompt-toolkit-0.25 psycopg2-2.5.4 six-1.9.0 sqlparse-0.1.14 wcwidth-0.1.4
808 20:40:41 [~/test] J:1 venv  ▼ pgcli
Traceback (most recent call last):
  File "/home/vagrant/test/venv/bin/pgcli", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/home/vagrant/test/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2603, in <module>
  File "/home/vagrant/test/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 666, in require
  File "/home/vagrant/test/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: Pygments>=2.0

@amjith
Copy link
Member

amjith commented Jan 8, 2015

Damn! I have no idea why this is happening. :(

@duffytilleman and @treystout Can you tell me what version of pip you're using?

I'm reopening this issue.

@amjith amjith reopened this Jan 8, 2015
@treystout
Copy link
Author

I'm on pip version 1.5.6, just noticed they appear to have jumped up to 6.x series

@duffytilleman
Copy link

pip 1.5.6

@amjith
Copy link
Member

amjith commented Jan 10, 2015

My one suggestion is try upgrading both setuptools and pip.

I suspect that there is a mismatch between setuptools and pip which is causing this behavior.

Another suggestion is try using easy_install (I know that sounds terrible), but I've heard from someone that when they couldn't get it to install via pip they tried it via easy_install and it worked.

So those are the two options.

@bbrdaric
Copy link

Hello,

just for information; I was also getting traceback on first run on Debian 7 stable (Wheezy)

borisko@sandbox:~$ pgcli test
Traceback (most recent call last):
  File "/usr/local/bin/pgcli", line 9, in <module>
    load_entry_point('pgcli==0.10.3', 'console_scripts', 'pgcli')()
  File "/usr/local/lib/python3.2/dist-packages/pkg_resources.py", line 339, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.2/dist-packages/pkg_resources.py", line 2470, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.2/dist-packages/pkg_resources.py", line 2184, in load
    ['__name__'])
  File "/usr/local/lib/python3.2/dist-packages/pgcli/main.py", line 11, in <module>
    from prompt_toolkit import CommandLineInterface, AbortAction, Exit
  File "/usr/local/lib/python3.2/dist-packages/prompt_toolkit/__init__.py", line 20, in <module>
    from .layout import Layout
  File "/usr/local/lib/python3.2/dist-packages/prompt_toolkit/layout/__init__.py", line 6, in <module>
    from pygments.token import Token
  File "/usr/local/lib/python3.2/dist-packages/pygments/__init__.py", line 37, in <module>
    from pygments.util import StringIO, BytesIO
  File "/usr/local/lib/python3.2/dist-packages/pygments/util.py", line 222
    return u'[%s-%s]' % (unichr(a), unichr(b))
                    ^
SyntaxError: invalid syntax

Thanks @amjith , problem solved by installing using easy_install!

@amjith
Copy link
Member

amjith commented Jan 12, 2015

@borissamardzija Did you try upgrading setuptools and pip.

I've heard from someone else that after they did

pip install -U setuptools pip

they were able to install pgcli and get it to work without problems.

But if easy_install works for you then more power. :)

Thanks for letting me know.

@bbrdaric
Copy link

Now I tried to update setuptools and pip, but the problem is still here.

borisko@sandbox:~$ sudo pip install -U setuptools pip
Downloading/unpacking setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-11.3.1-py2.py3-none-any.whl#md5=59cd761f2f2b926313bed7f83337e4d7
  Downloading setuptools-11.3.1-py2.py3-none-any.whl (500kB): 500kB downloaded
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.0.6-py2.py3-none-any.whl#md5=0472d9dc76a0df6cc6ab545e40aef832
  Downloading pip-6.0.6-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: setuptools, pip
  Found existing installation: setuptools 7.0
    Uninstalling setuptools:
      Successfully uninstalled setuptools
  Found existing installation: pip 1.5.6
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed setuptools pip
Cleaning up...

Installed again with easy_install and works great ;)

Please let me know if I can do anything else to help you with this, if needed.

@treystout
Copy link
Author

updating pip and setuptools worked for me.

@amjith
Copy link
Member

amjith commented May 31, 2015

Cleaning out old issues.

@amjith amjith closed this as completed May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants