Sanic: Error when installing on python 3.7

Created on 3 Mar 2019  ·  8Comments  ·  Source: sanic-org/sanic

I tried to install the library via pip en 3.7 after creating the virtual environment for 3.7 via venv

Requirement already satisfied: aiofiles==0.4.0 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: aiohttp==3.5.4 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: async-timeout==3.0.1 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied: attrs==18.2.0 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied: chardet==3.0.4 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 5))
Collecting httptools==0.0.13 (from -r requirements.txt (line 6))
  Using cached https://files.pythonhosted.org/packages/1b/03/215969db11abe8741e9c266a4cbe803a372bd86dd35fa0084c4df6d4bd00/httptools-0.0.13.tar.gz
Requirement already satisfied: idna==2.8 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 7))
Collecting idna-ssl==1.1.0 (from -r requirements.txt (line 8))
  Using cached https://files.pythonhosted.org/packages/46/03/07c4894aae38b0de52b52586b24bf189bb83e4ddabfe2e2c8f2419eec6f4/idna-ssl-1.1.0.tar.gz
Requirement already satisfied: multidict==4.5.2 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 9))
Requirement already satisfied: pkg-resources==0.0.0 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 10))
Collecting sanic==18.12.0 (from -r requirements.txt (line 11))
  Using cached https://files.pythonhosted.org/packages/11/b1/96424ff7d7d53b45adda69ac5306b58f349d1b7a937430aeb397f61452be/sanic-18.12.0-py3-none-any.whl
Collecting typing-extensions==3.7.2 (from -r requirements.txt (line 12))
  Using cached https://files.pythonhosted.org/packages/0f/62/c66e553258c37c33f9939abb2dd8d2481803d860ff68e635466f12aa7efa/typing_extensions-3.7.2-py3-none-any.whl
Collecting ujson==1.35 (from -r requirements.txt (line 13))
  Using cached https://files.pythonhosted.org/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz
Collecting uvloop==0.12.1 (from -r requirements.txt (line 14))
  Using cached https://files.pythonhosted.org/packages/a8/c3/88f82e2077a0af726e250bd2a1a62c12fecacb400a5011df09b9cbdc8e02/uvloop-0.12.1-cp37-cp37m-manylinux1_x86_64.whl
Collecting websockets==6.0 (from -r requirements.txt (line 15))
  Using cached https://files.pythonhosted.org/packages/0c/6a/d048dfe820fc956e57bb1115f5eda5a1bef320172811f72c9924c8d6ebb5/websockets-6.0-cp37-cp37m-manylinux1_x86_64.whl
Requirement already satisfied: yarl==1.3.0 in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 16))
Building wheels for collected packages: httptools, idna-ssl, ujson
  Running setup.py bdist_wheel for httptools: started
  Running setup.py bdist_wheel for httptools: finished with status 'error'
  Complete output from command /home/mrkaspa/code/py/ofer_bot/.venv/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zpws7gif/httptools/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/tmp_tfv8rc9pip-wheel- --python-tag cp37:
  /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Running setup.py clean for httptools
  Running setup.py bdist_wheel for idna-ssl: started
  Running setup.py bdist_wheel for idna-ssl: finished with status 'error'
  Complete output from command /home/mrkaspa/code/py/ofer_bot/.venv/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zpws7gif/idna-ssl/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/tmpg7cyiitepip-wheel- --python-tag cp37:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Running setup.py clean for idna-ssl
  Running setup.py bdist_wheel for ujson: started
  Running setup.py bdist_wheel for ujson: finished with status 'error'
  Complete output from command /home/mrkaspa/code/py/ofer_bot/.venv/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zpws7gif/ujson/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/tmpzes_nlgspip-wheel- --python-tag cp37:
  Warning: 'classifiers' should be a list, got type 'filter'
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Running setup.py clean for ujson
Failed to build httptools idna-ssl ujson
Installing collected packages: httptools, idna-ssl, uvloop, ujson, websockets, sanic, typing-extensions
  Running setup.py install for httptools: started
    Running setup.py install for httptools: finished with status 'error'
    Complete output from command /home/mrkaspa/code/py/ofer_bot/.venv/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zpws7gif/httptools/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-9fya3i4a-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/mrkaspa/code/py/ofer_bot/.venv/include/site/python3.7/httptools:
    /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/httptools
    copying httptools/__init__.py -> build/lib.linux-x86_64-3.7/httptools
    creating build/lib.linux-x86_64-3.7/httptools/parser
    copying httptools/parser/errors.py -> build/lib.linux-x86_64-3.7/httptools/parser
    copying httptools/parser/__init__.py -> build/lib.linux-x86_64-3.7/httptools/parser
    running egg_info
    writing httptools.egg-info/PKG-INFO
    writing dependency_links to httptools.egg-info/dependency_links.txt
    writing top-level names to httptools.egg-info/top_level.txt
    reading manifest file 'httptools.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'httptools.egg-info/SOURCES.txt'
    copying httptools/parser/parser.c -> build/lib.linux-x86_64-3.7/httptools/parser
    running build_ext
    building 'httptools.parser.parser' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/httptools
    creating build/temp.linux-x86_64-3.7/httptools/parser
    creating build/temp.linux-x86_64-3.7/vendor
    creating build/temp.linux-x86_64-3.7/vendor/http-parser
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/mrkaspa/code/py/ofer_bot/.venv/include -I/usr/include/python3.7m -c httptools/parser/parser.c -o build/temp.linux-x86_64-3.7/httptools/parser/parser.o -O2
    httptools/parser/parser.c:4:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------

Most helpful comment

I think works if I install libpython3.7-dev

All 8 comments

@mrkaspa Can you please make sure you have the python3-dev libraries installed before running pip install on sanic?

@harshanarayana yes it is already installed

I think works if I install libpython3.7-dev

I'm having similar issue on amazon IAM, no libpython3.7-dev or python3-dev available

@episodeyang can you open a new issue and include more details? Do you mean Amazon Linux?

yes! Haven’t ate all day had a workshop deadline. Will add issue soon.

On Sun, Mar 31, 2019 at 6:11 PM Stephen Sadowski notifications@github.com
wrote:

@episodeyang https://github.com/episodeyang can you open a new issue
and include more details? Do you mean Amazon Linux?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/huge-success/sanic/issues/1503#issuecomment-478404347,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAme2vEUoua_4hyQdoL2L9RCBVJOqj8Qks5vcVy0gaJpZM4bazVB
.

The bug was introduced by a mistake. I included "uvloop==0.8.1" in my dependency list.

Removing it fixed the installation problem.

https://github.com/episodeyang/ml_logger/pull/15

warning: the 'license_file' option is deprecated, use 'license_files' instead
adding license file 'LICENSE' (matched pattern 'LICENSE')
reading manifest file 'yarl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '
.cache' found anywhere in distribution
warning: no previously-included files found matching 'yarl/.html'
warning: no previously-included files found matching 'yarl/
.so'
warning: no previously-included files found matching 'yarl/*.pyd'
no previously-included directories found matching 'docs/_build'
writing manifest file 'yarl.egg-info/SOURCES.txt'
copying yarl/init.pyi -> build/lib.linux-armv7l-3.9/yarl
copying yarl/_quoting_c.c -> build/lib.linux-armv7l-3.9/yarl
copying yarl/_quoting_c.pyi -> build/lib.linux-armv7l-3.9/yarl
copying yarl/_quoting_c.pyx -> build/lib.linux-armv7l-3.9/yarl
copying yarl/py.typed -> build/lib.linux-armv7l-3.9/yarl
running build_ext
building 'yarl._quoting_c' extension
creating build/temp.linux-armv7l-3.9
creating build/temp.linux-armv7l-3.9/yarl
arm-linux-gnueabihf-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 -I/usr/include/python3.9 -c yarl/_quoting_c.c -o build/temp.linux-armv7l-3.9/yarl/_quoting_c.o
yarl/_quoting_c.c:4:10: fatal error: Python.h: No such file or directory
4 | #include "Python.h"
| ^~~~~~
compilation terminated.
error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for yarl
Failed to build multidict yarl
ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly

It works for me:

apt install python3.9-dev

MAKE SURE YOU INSTALL IT FOR RIGHT PYTHON VERSION! (python3.x-dev)

If you use python 3.x install python3.x-dev, and so on

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aiurlano picture aiurlano  ·  4Comments

sirex picture sirex  ·  4Comments

davidtgq picture davidtgq  ·  3Comments

misakar picture misakar  ·  4Comments

olalonde picture olalonde  ·  3Comments