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

ERROR: Failed building wheel for psycopg2-binary #34

Open
khalidrehan opened this issue May 3, 2021 · 2 comments
Open

ERROR: Failed building wheel for psycopg2-binary #34

khalidrehan opened this issue May 3, 2021 · 2 comments

Comments

@khalidrehan
Copy link

khalidrehan commented May 3, 2021

Hello,
I'm install PatrOwl on Ubuntu:
| Ubuntu Version | 20.04 |
| Python Version | 3.8 |

I'm getting an error on installing the requirements:

Requirement already satisfied: setuptools>=3.0 in ./env3/lib/python3.8/site-packages (from gunicorn==20.0.4->-r requirements.txt (line 24)) (56.0.0)
Building wheels for collected packages: psycopg2-binary
  Building wheel for psycopg2-binary (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/krehan/PatrowlManager/env3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-cdw9bs_j
       cwd: /tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/
  Complete output (72 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/psycopg1.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
  creating build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_async_keyword.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_transaction.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_lobject.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_errcodes.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_sql.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_replication.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_async.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_with.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_dates.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_copy.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_cursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/testconfig.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_connection.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/testutils.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_quote.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_cancel.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_module.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_green.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_notify.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_fast_executemany.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  Skipping optional fixer: buffer
  Skipping optional fixer: idioms
  Skipping optional fixer: set_literal
  Skipping optional fixer: ws_comma
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/psycopg
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=2.7.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=130002 -DHAVE_LO64=1 -I/home/krehan/PatrowlManager/env3/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/13/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
  psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
  psycopg/psycopgmodule.c:689:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
    689 |     while (interp->next)
        |                  ^~

  It appears you are missing some prerequisite to build the package from source.

  You may install a binary package by installing 'psycopg2-binary' from PyPI.
  If you want to install psycopg2 from source, please install the packages
  required for the build and try again.

  For further information please check the 'doc/src/install.rst' file (also at
  <http://initd.org/psycopg/docs/install.html>).

  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psycopg2-binary
  Running setup.py clean for psycopg2-binary
Failed to build psycopg2-binary
Installing collected packages: psycopg2-binary, psutil, netaddr, meld3, libmagic, jsonfield, gunicorn, futures, flower, djangorestframework-simplejwt, django-rest-swagger, django-reset-migrations, django-organizations, django-health-check, django-filter, django-extensions, django-debug-toolbar, django-dbconn-retry, django-datetime-widget, django-cursor-pagination, django-cors-headers, django-celery-results, django-celery-beat, django-annoying, backports-abc
    Running setup.py install for psycopg2-binary ... error
    ERROR: Command errored out with exit status 1:
     command: /home/krehan/PatrowlManager/env3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8bu3vpl3/install-record.txt --single-version-externally-managed --compile --install-headers /home/krehan/PatrowlManager/env3/include/site/python3.8/psycopg2-binary
         cwd: /tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/
    Complete output (72 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/psycopg2
    copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/psycopg1.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
    creating build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_async_keyword.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_transaction.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_lobject.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_errcodes.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_sql.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_replication.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_async.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_with.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_dates.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_copy.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_cursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/testconfig.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_connection.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/testutils.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_quote.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_cancel.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_module.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_green.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_notify.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_fast_executemany.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/psycopg
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=2.7.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=130002 -DHAVE_LO64=1 -I/home/krehan/PatrowlManager/env3/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/13/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
    psycopg/psycopgmodule.c:689:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
      689 |     while (interp->next)
          |                  ^~

    It appears you are missing some prerequisite to build the package from source.

    You may install a binary package by installing 'psycopg2-binary' from PyPI.
    If you want to install psycopg2 from source, please install the packages
    required for the build and try again.

    For further information please check the 'doc/src/install.rst' file (also at
    <http://initd.org/psycopg/docs/install.html>).

    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/krehan/PatrowlManager/env3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0xfgj_zy/psycopg2-binary_a90dbb947c954168bb4ca70555a95c68/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8bu3vpl3/install-record.txt --single-version-externally-managed --compile --install-headers /home/krehan/PatrowlManager/env3/include/site/python3.8/psycopg2-binary Check the logs for full command output.

@MaKyOtOx , Where to look?

Regrds,
Khalid

@khalidrehan
Copy link
Author

I had to switch in the requirements.txt file:

psycopg2-binary==2.8.6
#psycopg2-binary==2.7.5 

@fredrickwampamba
Copy link

Thanks

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

2 participants