MagicStack / MagicStack/asyncpg

import asyncpg locally with compilation error

Open
#543 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

* **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](https://github.com/magicstack/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
> import asyncpg.asyncpg
> File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/__init__.py", line 8, in
> from .connection import connect, Connection # NOQA
> File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/connection.py", line 20, in
> from . import connect_utils
> File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/connect_utils.py", line 27, in
> from . import protocol
> File "/Users/i3ye/Programming/vsc/ppx-git/asyncpg/asyncpg/protocol/__init__.py", line 8, in
> 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

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the import from nowebpool.py using Python 3.6.5, macOS 10.13, PostgreSQL 11, and Cython 0.29.15. Start with asyncpg/protocol/__init__.py and the compiler traceback for the protocol module; done means asyncpg imports locally without the Cython or gcc failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.