Skip to content

import asyncpg locally with compilation error #543

@rickcoup

Description

@rickcoup
  • asyncpg version:
    Forked the code to local a few months back. Couldn't find the version number.

  • PostgreSQL version:
    11

  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :

  • Python version:
    3.6.5

  • Platform:
    Mac 10.13

  • Do you use pgbouncer?:
    No

  • Did you install asyncpg with pip?:
    No

  • If you built asyncpg locally, which version of Cython did you use?:
    0.29.15

  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

Trying to import asyncpg locally on my Mac. But have the compilation error. I have the below ```
import statements.
import sys
print(sys.path)
sys.path.append(".")
import asyncio
from aiohttp import web
import pyximport
pyximport.install()
import asyncpg.asyncpg
os.environ['PYTHONASYNCIODEBUG'] = '1'
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
import logging
import time


But get the error.

> Compiler crash traceback from this point on:
 

> File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/Cython/Compiler/ExprNodes.py", line 6832, in infer_type
>    return node.entry.type
> AttributeError: 'NoneType' object has no attribute 'type'
> /Users/i3ye/.pyxbld/temp.macosx-10.6-intel-3.6/pyrex/asyncpg/asyncpg/protocol/protocol.c:1:2: error: Do not use this file, it is the result of a
>      failed Cython compilation.
> #error Do not use this file, it is the result of a failed Cython compilation.
> ^
> 1 error generated.
> Traceback (most recent call last):
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
>    extra_postargs)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
>    spawn(cmd, dry_run=self.dry_run)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/spawn.py", line 36, in spawn
>    _spawn_posix(cmd, search_path, dry_run=dry_run)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
>    % (cmd, exit_status))
> distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 215, in load_module
>    inplace=build_inplace, language_level=language_level)
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 191, in build_module
>    reload_support=pyxargs.reload_support)
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
>    dist.run_commands()
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
>    self.run_command(cmd)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
>    cmd_obj.run()
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
>    _build_ext.build_ext.run(self)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 339, in run
>    self.build_extensions()
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
>    _build_ext.build_ext.build_extensions(self)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
>    self._build_extensions_serial()
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
>    self.build_extension(ext)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
>    depends=ext.depends)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/ccompiler.py", line 574, in compile
>    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
>    raise CompileError(msg)
> distutils.errors.CompileError: command 'gcc' failed with exit status 1
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>  File "nowebpool.py", line 8, in <module>
>    import asyncpg.asyncpg
>  File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/__init__.py", line 8, in <module>
>    from .connection import connect, Connection  # NOQA
>  File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/connection.py", line 20, in <module>
>    from . import connect_utils
>  File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/connect_utils.py", line 27, in <module>
>    from . import protocol
>  File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/protocol/__init__.py", line 8, in <module>
>    from .protocol import Protocol, Record, NO_TIMEOUT  # NOQA
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 462, in load_module
>    language_level=self.language_level)
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 231, in load_module
>    raise exc.with_traceback(tb)
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 215, in load_module
>    inplace=build_inplace, language_level=language_level)
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyximport.py", line 191, in build_module
>    reload_support=pyxargs.reload_support)
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
>    dist.run_commands()
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
>    self.run_command(cmd)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
>    cmd_obj.run()
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
>    _build_ext.build_ext.run(self)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 339, in run
>    self.build_extensions()
>  File "/Users/i3ye/Programming/vsc/ppx-git/venv/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
>    _build_ext.build_ext.build_extensions(self)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
>    self._build_extensions_serial()
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
>    self.build_extension(ext)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
>    depends=ext.depends)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/ccompiler.py", line 574, in compile
>    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
>  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
>    raise CompileError(msg)
> ImportError: Building module asyncpg.asyncpg.protocol.protocol failed: ["distutils.errors.CompileError: command 'gcc' failed with exit status 1\n"]
> 
> 
> gcc --version
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
> Apple clang version 11.0.0 (clang-1100.0.33.17)
> Target: x86_64-apple-darwin18.7.0
> Thread model: posix
> InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions