mimblewimble / grin-explorer

Blockchain explorer for grin
GNU Affero General Public License v3.0
59 stars 53 forks source link

ERROR: Failed building wheel for psycopg2 #69

Closed noobvie closed 3 years ago

noobvie commented 3 years ago

Hello,

When I tried to execute command 'pip install -r requirements.txt' I got error: Do you have any ideas? Can psycopg2-binary be replaced for psycopg2?

`grinviet@bangnode1:~$ cd grin-explorer grinviet@bangnode1:~/grin-explorer$ python3 -m venv venv grinviet@bangnode1:~/grin-explorer$ source venv/bin/activate (venv) grinviet@bangnode1:~/grin-explorer$ pip install -r requirements.txt Requirement already satisfied: Django==2.2.24 in ./venv/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (2.2.24) Collecting psycopg2==2.8.6 Using cached psycopg2-2.8.6.tar.gz (383 kB) Requirement already satisfied: requests==2.20.0 in ./venv/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (2.20.0) Requirement already satisfied: django_chartit==0.2.9 in ./venv/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (0.2.9) Requirement already satisfied: sqlparse>=0.2.2 in ./venv/lib/python3.8/site-packages (from Django==2.2.24->-r requirements.txt (line 1)) (0.4.1) Requirement already satisfied: pytz in ./venv/lib/python3.8/site-packages (from Django==2.2.24->-r requirements.txt (line 1)) (2021.1) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (2021.5.30) Requirement already satisfied: idna<2.8,>=2.5 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (2.7) Requirement already satisfied: urllib3<1.25,>=1.21.1 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (1.24.3) Building wheels for collected packages: psycopg2 Building wheel for psycopg2 (setup.py) ... error ERROR: Command errored out with exit status 1: command: /home/grinviet/grin-explorer/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"'; file='"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/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'"'"'))' bdist_wheel -d /tmp/pip-wheel-4j97i64s cwd: /tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/ Complete output (40 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/psycopg2 copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/init.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2 running build_ext building 'psycopg2._psycopg' extension creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/psycopg x86_64-linux-gnu-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 -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120007 -DHAVE_LO64=1 -I/home/grinviet/grin-explorer/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement In file included from psycopg/psycopgmodule.c:28: ./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory 36 | #include | ^~~~ compilation terminated.

It appears you are missing some prerequisite to build the package from source.

You may install a binary package by installing 'psycopg2-binary' from PyPI. If you want to install psycopg2 from source, please install the packages required for the build and try again.

For further information please check the 'doc/src/install.rst' file (also at https://www.psycopg.org/docs/install.html).

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Failed building wheel for psycopg2 Running setup.py clean for psycopg2 Failed to build psycopg2 Installing collected packages: psycopg2 Running setup.py install for psycopg2 ... error ERROR: Command errored out with exit status 1: command: /home/grinviet/grin-explorer/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"'; file='"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/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-i_iae1wj/install-record.txt --single-version-externally-managed --compile --install-headers /home/grinviet/grin-explorer/venv/include/site/python3.8/psycopg2 cwd: /tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/ Complete output (40 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/psycopg2 copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/init.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2 running build_ext building 'psycopg2._psycopg' extension creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/psycopg x86_64-linux-gnu-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 -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120007 -DHAVE_LO64=1 -I/home/grinviet/grin-explorer/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement In file included from psycopg/psycopgmodule.c:28: ./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory 36 | #include | ^~~~ compilation terminated.

It appears you are missing some prerequisite to build the package from source.

You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.

For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /home/grinviet/grin-explorer/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"'; file='"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/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-i_iae1wj/install-record.txt --single-version-externally-managed --compile --install-headers /home/grinviet/grin-explorer/venv/include/site/python3.8/psycopg2 Check the logs for full command output. `

hendi commented 3 years ago

Yes!

noobvie commented 3 years ago

Thanks for your comment. I also tried to search around and finally passed the error by additional commands:

sudo apt install python3.8-venv
sudo apt install python3.8-dev
sudo apt install libpq-dev