Issue
I am trying to install async-sqlalchemy
in virtual environment but get an error during the installation of asyncpg
package.
I have reinstalled python, made homebrew upgrade, but it did not helped.
Other inputs:
- macOS Monterey 12.4
- Apple M1 Max
- python was installed using homebrew
- headers location:
/opt/homebrew/Frameworks/Python.framework/Headers/Python.h
- Python 3.8.9 installed in virtual environment
Text of error:
(venv) ➜ project1 git:(main) ✗ pip install async-sqlalchemy
pip install async-sqlalchemy
Collecting async-sqlalchemy
Using cached async_sqlalchemy-1.0.0-py3-none-any.whl (2.1 kB)
Collecting sqlalchemy
Using cached SQLAlchemy-1.4.40.tar.gz (8.3 MB)
Preparing metadata (setup.py) ... done
Collecting asyncpg
Using cached asyncpg-0.26.0.tar.gz (809 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting aiomysql
Using cached aiomysql-0.1.1-py3-none-any.whl (43 kB)
Collecting PyMySQL>=1.0
Using cached PyMySQL-1.0.2-py3-none-any.whl (43 kB)
Building wheels for collected packages: asyncpg, sqlalchemy
Building wheel for asyncpg (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for asyncpg (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
building 'asyncpg.pgproto.pgproto' extension
asyncpg/pgproto/pgproto.c:31:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for asyncpg
Building wheel for sqlalchemy (setup.py) ... done
Created wheel for sqlalchemy: filename=SQLAlchemy-1.4.40-cp38-cp38-macosx_10_14_arm64.whl size=1563095 sha256=dec89820eeaacf37173105593f3bd9762e66d86bec9d058b6e16a2a6b0905467
Stored in directory: /Users/[user_name deleted_intentionally]/Library/Caches/pip/wheels/b6/24/79/b40cf000cb96fbda45242a556ce18006f8ca34712487c09a90
Successfully built sqlalchemy
Failed to build asyncpg
Solution
I was facing the same issue and had a lot of research. Finally found the problem in my other python project
source venv/bin/activate
was active. So I have deactivated from another project and then re-run the installation again.
Answered By - Manish
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.