poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
961 stars 121 forks source link

pip install -r requirements.txt: Python.h: No such file or directory #310

Closed foxyseta closed 2 years ago

foxyseta commented 2 years ago

Hi! Python 3.10.1 user here. I correctly installed olm 3.2.4 from XBPS on Void Linux, but now I am unable to run pip install -r requirements.txt without errors. Here's the output I'm getting:

pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Ignoring typing: markers 'python_version < "3.5"' don't match your environment
Ignoring future: markers 'python_version < "3.2"' don't match your environment
Collecting pyOpenSSL
  Downloading pyOpenSSL-21.0.0-py2.py3-none-any.whl (55 kB)
     |████████████████████████████████| 55 kB 798 kB/s
Collecting webcolors
  Downloading webcolors-1.11.1-py3-none-any.whl (9.9 kB)
Collecting atomicwrites
  Downloading atomicwrites-1.4.0-py2.py3-none-any.whl (6.8 kB)
Requirement already satisfied: attrs in /usr/lib/python3.10/site-packages (from -r requirements.txt (line 6)) (21.2.0)
Collecting logbook
  Downloading Logbook-1.5.3.tar.gz (85 kB)
     |████████████████████████████████| 85 kB 846 kB/s
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pygments in /usr/lib/python3.10/site-packages (from -r requirements.txt (line 8)) (2.10.0)
Collecting matrix-nio[e2e]>=0.18.7
  Downloading matrix_nio-0.18.7-py3-none-any.whl (183 kB)
     |████████████████████████████████| 183 kB 1.4 MB/s
Collecting aiohttp
  Downloading aiohttp-3.8.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.2 MB)
     |████████████████████████████████| 1.2 MB 1.5 MB/s
Collecting python-magic
  Downloading python_magic-0.4.24-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: requests in /usr/lib/python3.10/site-packages (from -r requirements.txt (line 12)) (2.26.0)
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3.10/site-packages (from pyOpenSSL->-r requirements.txt (line 1)) (1.16.0)
Requirement already satisfied: cryptography>=3.3 in /usr/lib/python3.10/site-packages (from pyOpenSSL->-r requirements.txt (line 1)) (36.0.0)
Collecting pycryptodome<4.0.0,>=3.10.1
  Downloading pycryptodome-3.12.0-cp35-abi3-manylinux2010_x86_64.whl (2.0 MB)
     |████████████████████████████████| 2.0 MB 1.5 MB/s
Collecting aiohttp-socks<0.7.0,>=0.6.0
  Downloading aiohttp_socks-0.6.1-py3-none-any.whl (9.3 kB)
Collecting h11<0.13.0,>=0.12.0
  Downloading h11-0.12.0-py3-none-any.whl (54 kB)
     |████████████████████████████████| 54 kB 756 kB/s
Collecting future<0.19.0,>=0.18.2
  Downloading future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 1.3 MB/s
  Preparing metadata (setup.py) ... done
Collecting aiofiles<0.7.0,>=0.6.0
  Downloading aiofiles-0.6.0-py3-none-any.whl (11 kB)
Collecting jsonschema<4.0.0,>=3.2.0
  Downloading jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 830 kB/s
Collecting h2<5.0.0,>=4.0.0
  Downloading h2-4.1.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 960 kB/s
Collecting unpaddedbase64<3.0.0,>=2.1.0
  Downloading unpaddedbase64-2.1.0-py3-none-any.whl (6.1 kB)
Collecting python-olm<4.0.0,>=3.1.3
  Downloading python-olm-3.1.3.tar.gz (27 kB)
  Preparing metadata (setup.py) ... done
Collecting cachetools<5.0.0,>=4.2.1
  Downloading cachetools-4.2.4-py3-none-any.whl (10 kB)
Collecting peewee<4.0.0,>=3.14.4
  Downloading peewee-3.14.8.tar.gz (850 kB)
     |████████████████████████████████| 850 kB 1.4 MB/s
  Preparing metadata (setup.py) ... done
Collecting multidict<7.0,>=4.5
  Downloading multidict-5.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (175 kB)
     |████████████████████████████████| 175 kB 1.4 MB/s
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/lib/python3.10/site-packages (from aiohttp->-r requirements.txt (line 10)) (2.0.9)
Collecting yarl<2.0,>=1.0
  Downloading yarl-1.7.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (305 kB)
     |████████████████████████████████| 305 kB 1.4 MB/s
Collecting async-timeout<5.0,>=4.0.0a3
  Downloading async_timeout-4.0.1-py3-none-any.whl (5.7 kB)
Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.2.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (205 kB)
     |████████████████████████████████| 205 kB 1.5 MB/s
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3.10/site-packages (from requests->-r requirements.txt (line 12)) (1.26.6)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3.10/site-packages (from requests->-r requirements.txt (line 12)) (3.2)
Collecting python-socks[asyncio]<2.0.0,>=1.2.4
  Downloading python_socks-1.2.4-py3-none-any.whl (35 kB)
Collecting typing-extensions>=3.6.5
  Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Requirement already satisfied: cffi>=1.12 in /usr/lib/python3.10/site-packages (from cryptography>=3.3->pyOpenSSL->-r requirements.txt (line 1)) (1.15.0)
Collecting hyperframe<7,>=6.0
  Downloading hyperframe-6.0.1-py3-none-any.whl (12 kB)
Collecting hpack<5,>=4.0
  Downloading hpack-4.0.0-py3-none-any.whl (32 kB)
Requirement already satisfied: setuptools in /usr/lib/python3.10/site-packages (from jsonschema<4.0.0,>=3.2.0->matrix-nio[e2e]>=0.18.7->-r requirements.txt (line 9)) (58.1.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/lib/python3.10/site-packages (from jsonschema<4.0.0,>=3.2.0->matrix-nio[e2e]>=0.18.7->-r requirements.txt (line 9)) (0.18.0)
Requirement already satisfied: pycparser in /usr/lib/python3.10/site-packages (from cffi>=1.12->cryptography>=3.3->pyOpenSSL->-r requirements.txt (line 1)) (2.20)
Using legacy 'setup.py install' for logbook, since package 'wheel' is not installed.
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Using legacy 'setup.py install' for peewee, since package 'wheel' is not installed.
Using legacy 'setup.py install' for python-olm, since package 'wheel' is not installed.
Installing collected packages: typing-extensions, multidict, frozenlist, yarl, python-socks, async-timeout, aiosignal, hyperframe, hpack, aiohttp, unpaddedbase64, pycryptodome, logbook, jsonschema, h2, h11, future, aiohttp-socks, aiofiles, python-olm, peewee, matrix-nio, cachetools, atomicwrites, webcolors, python-magic, pyOpenSSL
    Running setup.py install for logbook ... done
  WARNING: The script jsonschema is installed in '/home/stefano/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    Running setup.py install for future ... done
    Running setup.py install for python-olm ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1vfajgjl/python-olm_9869d3fd2c5d4474a9ac5b110e03e3c1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1vfajgjl/python-olm_9869d3fd2c5d4474a9ac5b110e03e3c1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wert5wvh/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/stefano/.local/include/python3.10/python-olm
         cwd: /tmp/pip-install-1vfajgjl/python-olm_9869d3fd2c5d4474a9ac5b110e03e3c1/
    Complete output (29 lines):
    make: *** No rule to make target '../include/olm/olm.h', needed by 'include/olm/olm.h'.  Stop.
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.10
    creating build/lib.linux-x86_64-3.10/olm
    copying olm/utility.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/session.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/sas.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/pk.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/group_session.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/account.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/_finalize.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/_compat.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/__version__.py -> build/lib.linux-x86_64-3.10/olm
    copying olm/__init__.py -> build/lib.linux-x86_64-3.10/olm
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.10/_libolm.c'
    creating build/temp.linux-x86_64-3.10
    building '_libolm' extension
    creating build/temp.linux-x86_64-3.10/build
    creating build/temp.linux-x86_64-3.10/build/temp.linux-x86_64-3.10
    x86_64-unknown-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe -g -fdebug-prefix-map=/builddir/Python-3.10.1=. -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe -g -fdebug-prefix-map=/builddir/Python-3.10.1=. -fPIC -I/usr/include/python3.10 -c build/temp.linux-x86_64-3.10/_libolm.c -o build/temp.linux-x86_64-3.10/build/temp.linux-x86_64-3.10/_libolm.o -I../include
    build/temp.linux-x86_64-3.10/_libolm.c:57:10: fatal error: Python.h: No such file or directory
       57 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/bin/x86_64-unknown-linux-gnu-gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1vfajgjl/python-olm_9869d3fd2c5d4474a9ac5b110e03e3c1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1vfajgjl/python-olm_9869d3fd2c5d4474a9ac5b110e03e3c1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wert5wvh/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/stefano/.local/include/python3.10/python-olm Check the logs for full command output.

Seems like I'm missing a C header named Python.h(?)

jee-r commented 2 years ago

I've had the same issue on debian bullseye python 3.9 installing python3-dev package solved the issue.

foxyseta commented 2 years ago

Thanks! In fact, both python3-devel and olm-devel (as development packages) were needed in my case.