install psycopg2 failing python 3.7 - python

I am following this tutorial - https://medium.com/#qazi/how-to-deploy-a-django-app-to-heroku-in-2018-the-easy-way-48a528d97f9c
so far I've:
built my Django app and ran locally - works perfectly
wrote Procfile with content
web: gunicorn project_name.wsgi
imported django_heroku to settings
I need to install psycopg2 so I ran pip install psycopg2
but getting the error
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/niamhtohill/ios_dev/vf_api/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-install-q5q1ago2/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-install-q5q1ago2/psycopg2/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 /private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-wheel-3u2cfbpc --python-tag cp37
cwd: /private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-install-q5q1ago2/psycopg2/
Complete output (144 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/psycopg
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=100005 -DHAVE_LO64=1 -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/10.5/include -I/usr/local/Cellar/postgresql/10.5/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=100005 -DHAVE_LO64=1 -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/10.5/include -I/usr/local/Cellar/postgresql/10.5/include/server -c psycopg/green.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/green.o
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=100005 -DHAVE_LO64=1 -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/10.5/include -I/usr/local/Cellar/postgresql/10.5/include/server -c psycopg/pqpath.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/pqpath.o
psycopg/pqpath.c:135:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(conn->pgconn) : PQresultStatus(*pgres)));
^~~~~~~~~~~~~~~~~~~~~~
psycopg/pqpath.c:1712:11: warning: code will never be executed [-Wunreachable-code]
ret = 1;
^
psycopg/pqpath.c:1817:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(curs->conn->pgconn) : PQresultStatus(curs->pgres)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
....
...
...
...
...
...
...
/adapter_qstring.o build/temp.macosx-10.9-x86_64-3.7/psycopg/microprotocols.o build/temp.macosx-10.9-x86_64-3.7/psycopg/microprotocols_proto.o build/temp.macosx-10.9-x86_64-3.7/psycopg/typecast.o -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/psycopg2/_psycopg.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/niamhtohill/ios_dev/vf_api/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-install-q5q1ago2/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-install-q5q1ago2/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/kk/0xnrjqj950qdky6pkv1dws4r0000gn/T/pip-record-t0kpmijs/install-record.txt --single-version-externally-managed --compile --install-headers /Users/niamhtohill/ios_dev/vf_api/venv/bin/../include/site/python3.7/psycopg2 Check the logs for full command output.
really feel like im going round in circles! have retried the steps out 10 times
any help would be greatly appreciated

Instead of pip install psycopg2 try to run pip install psycopg2-binary.

psycopg2 is a wrapper around the libpq C library, and so it requires that library (plus other pre-requisites) to be installed before you can successfully run pip install psycopg2. The errors you see is probably related to that.
There's an alternative, which is to use the psycopg2-binary wheel package, which comes pre-packaged with its own version of C libraries (including libpq), meaning you don't need to go through all the pre-requisite steps.
$ pip install psycopg2-binary
The only cavaet is that psycopg2-binary is not recommended to be used in production environments.

This works for me:
pip install psycopg2-binary --user

Related

Error install requirements.txt Django project Mac M1

I got my Django project via gitlab and put it on my Macbook M1 but when I put myself in the virtual environment and I install the requirements I have a long error message that appears, I don't don't know how to fix this.
Could it be because of the apple silicon chip?
Here is the error message:
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /Users/pierro/Documents/permacool/api_permacool/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/f2/r4cvtlb53hb3r3bvpzkmqnyr0000gn/T/pip-install-zdiid0g3/mysqlclient_87a039d3b25c4c3f8c32778ba1e13516/setup.py'"'"'; __file__='"'"'/private/var/folders/f2/r4cvtlb53hb3r3bvpzkmqnyr0000gn/T/pip-install-zdiid0g3/mysqlclient_87a039d3b25c4c3f8c32778ba1e13516/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 /private/var/folders/f2/r4cvtlb53hb3r3bvpzkmqnyr0000gn/T/pip-record-bh773nfm/install-record.txt --single-version-externally-managed --compile --install-headers /Users/pierro/Documents/permacool/api_permacool/include/site/python3.8/mysqlclient
cwd: /private/var/folders/f2/r4cvtlb53hb3r3bvpzkmqnyr0000gn/T/pip-install-zdiid0g3/mysqlclient_87a039d3b25c4c3f8c32778ba1e13516/
Complete output (43 lines):
mysql_config --version
['8.0.28']
mysql_config --libs
['-L/opt/homebrew/opt/mysql-client/lib', '-lmysqlclient', '-lz', '-lzstd', '-lssl', '-lcrypto', '-lresolv']
mysql_config --cflags
['-I/opt/homebrew/opt/mysql-client/include/mysql']
ext_options:
library_dirs: ['/opt/homebrew/opt/mysql-client/lib']
libraries: ['mysqlclient', 'zstd', 'resolv']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/opt/homebrew/opt/mysql-client/include/mysql']
extra_objects: []
define_macros: [('version_info', "(2,0,3,'final',0)"), ('__version__', '2.0.3')]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-arm64-3.8
creating build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb
creating build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.14-arm64-3.8/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.14-arm64-3.8
creating build/temp.macosx-10.14-arm64-3.8/MySQLdb
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Dversion_info=(2,0,3,'final',0) -D__version__=2.0.3 -I/opt/homebrew/opt/mysql-client/include/mysql -I/Users/pierro/Documents/permacool/api_permacool/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.macosx-10.14-arm64-3.8/MySQLdb/_mysql.o -std=c99
clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -Wl,-headerpad,0x1000 build/temp.macosx-10.14-arm64-3.8/MySQLdb/_mysql.o -L/opt/homebrew/opt/mysql-client/lib -lmysqlclient -lzstd -lresolv -o build/lib.macosx-10.14-arm64-3.8/MySQLdb/_mysql.cpython-38-darwin.so
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
It is all good. I just changed the version of mysql-client in the requirements.txt because the version I downloaded with Brew was older

GDAL (CentOS 8) Install Failing

For the best part of today, I've been trying to get my head around how to install GDAL on my CentOS 8 server.
I've researched on many different answers and solutions across different sites and across StackOverflow and nothing seems to be working! (I'm probably missing something obvious somewhere)
I'm trying to install GDAL using the command pip3 install gdal
Which in return, produces the following error:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/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-wx20mgo0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/gdal
cwd: /tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/
Complete output (28 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying gdal.py -> build/lib.linux-x86_64-3.6
copying ogr.py -> build/lib.linux-x86_64-3.6
copying osr.py -> build/lib.linux-x86_64-3.6
copying gdalconst.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdal.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/osr.py -> build/lib.linux-x86_64-3.6/osgeo
running build_ext
Could not run gdal-config!!!!
building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/extensions
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/include/python3.6m -I. -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o
extensions/gdal_wrap.cpp:2813:10: fatal error: cpl_port.h: No such file or directory
#include "cpl_port.h"
^~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/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-wx20mgo0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/gdal Check the logs for full command output.
So far, I've installed:
Proj 6
GEOS
epel-release (For CentOS 8)
gdal-libs
PowerTools (I've also enabled powertools)
The error I've spotted within the output from above is cpl_port.h: No such file or directory and I have crosschecked this error across other forums, who have advised to run the following command:
sudo apt-get install libgdal-dev
and
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
And finally, running the pip3 install gdal command.
Although, since I'm running CentOS 8, I don't have access to "apt-get" and instead have tried using "Yum" but haven't had any luck with getting the above proposed solution to work.
Would anyone be able to suggest or recommend any methods of resolving the cpl_port.h: No such file or directory error on a CentOS 8 server?
Many thanks! :-)
It seems to be a bug with CentOS
https://bugs.centos.org/view.php?id=18213
gdal requires poppler-0.67, which is missing from official repositories.
It is however present in the raven-extras repo:
https://centos.pkgs.org/8/raven-extras-x86_64/poppler-0.67.0-22.el8.x86_64.rpm.html
Or you can download it as is (arbitrarily named poppler0.67.rpm here) and use it when installing gdal.
curl -o poppler0.67.rpm https://pkgs.dyn.su/el8/extras/x86_64/poppler-0.67.0-22.el8.x86_64.rpm
yum install -y gdal poppler0.67.rpm
Update: the bug seems to be resolved https://bugzilla.redhat.com/show_bug.cgi?id=1950024

Error when running a python file (unable to import psycopg2)

I have a python script, and keep running into an error when trying to install a package.
I'm using pip 20.2.4 and python 3.7.7, on a MacOS Pro Catalina 10.15.7.
When I run pip install -r requirements.txt, it gets the below error. Any ideas on how to fix this?
Using legacy 'setup.py install' for psycopg2, since package 'wheel' is not installed.
Installing collected packages: psycopg2, psycopg2-binary
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Users/me/IdeaProjects/up/grafana/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-install-z1c97jsm/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-install-z1c97jsm/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-record-984vc1rq/install-record.txt --single-version-externally-managed --compile --install-headers /Users/me/IdeaProjects/up/grafana/env/include/site/python3.7/psycopg2
cwd: /private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-install-z1c97jsm/psycopg2/
Complete output (151 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-x86_64-3.7
creating build/lib.macosx-10.14-x86_64-3.7/psycopg2
...
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/psycopg
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework
...
I/usr/local/opt/sqlite/include -I/Users/me/IdeaProjects/up/grafana/env/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/pqpath.c -o build/temp.macosx-10.14-x86_64-3.7/psycopg/pqpath.o
psycopg/pqpath.c:138:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(conn->pgconn) : PQresultStatus(*pgres)));
^~~~~~~~~~~~~~~~~~~~~~
psycopg/pqpath.c:1717:11: warning: code will never be executed [-Wunreachable-code]
ret = 1;
^
psycopg/pqpath.c:1822:17: warning: implicit conversion from enumeration type 'ConnStatusType' to different enumeration type 'ExecStatusType' [-Wenum-conversion]
PQstatus(curs->conn->pgconn) : PQresultStatus(curs->pgres)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=130001 -DHAVE_LO64=1 -I/usr/local/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/sqlite/include -I/Users/me/IdeaProjects/up/grafana/env/include -
...
I/usr/local/opt/sqlite/include -I/Users/me/IdeaProjects/up/grafana/env/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/microprotocols_proto.c -o build/temp.macosx-10.14-x86_64-3.7/psycopg/microprotocols_proto.o
In file included from psycopg/microprotocols_proto.c:28:
In file included from ./psycopg/psycopg.h:38:
./psycopg/config.h:82:13: warning: unused function 'Dprintf' [-Wunused-function]
static void Dprintf(const char *fmt, ...) {}
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g ...
L/usr/local/opt/sqlite/lib -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/psycopg2/_psycopg.cpython-37m-darwin.so
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/me/IdeaProjects/up/grafana/env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-install-z1c97jsm/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-install-z1c97jsm/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tv/xmlxs5hd45s0n4r0qs5jtlhnbgpkgq/T/pip-record-984vc1rq/install-record.txt --single-version-externally-managed --compile --install-headers /Users/me/IdeaProjects/up/grafana/env/include/site/python3.7/psycopg2 Check the logs for full command output.

Issue with psutil package deployment in Python 3.6 virtual environment for Apache Airflow ML framework setup

I am trying to install an Apache Airflow based Machine Learning framework in a Python Virtual Environment in Mac OS. This ML framework is based on Apache Airflow version 1.9. I have configured a Python 3.6 virtual environment for this purpose. However, the ML framework installation and setup are failing due to the following error. Has anyone of you faced similar errors in Apache Airflow setup or Python 3.6 based virtual environments?
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /Users/gokulalex/airflow/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-install-ye9ohe71/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-install-ye9ohe71/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-record-anu_rweq/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gokulalex/airflow/bin/../include/site/python3.6/psutil
cwd: /private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-install-ye9ohe71/psutil/
Complete output (45 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.6
creating build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_common.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/__init__.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_compat.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.6-intel-3.6/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.6-intel-3.6/psutil
creating build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.6-intel-3.6/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.6-intel-3.6
creating build/temp.macosx-10.6-intel-3.6/psutil
creating build/temp.macosx-10.6-intel-3.6/psutil/arch
creating build/temp.macosx-10.6-intel-3.6/psutil/arch/osx
/usr/local/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=442 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_osx.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_osx.o
/usr/local/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=442 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/_psutil_common.c -o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_common.o
/usr/local/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=442 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c psutil/arch/osx/process_info.c -o build/temp.macosx-10.6-intel-3.6/psutil/arch/osx/process_info.o
/usr/local/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.6/psutil/_psutil_osx.o build/temp.macosx-10.6-intel-3.6/psutil/_psutil_common.o build/temp.macosx-10.6-intel-3.6/psutil/arch/osx/process_info.o -o build/lib.macosx-10.6-intel-3.6/psutil/_psutil_osx.cpython-36m-darwin.so -framework CoreFoundation -framework IOKit
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /usr/local/Cellar/llvm#4/4.0.1_1/bin/../lib/clang/4.0.1/lib/darwin/libclang_rt.osx.a, missing required architecture i386 in file /usr/local/Cellar/llvm#4/4.0.1_1/bin/../lib/clang/4.0.1/lib/darwin/libclang_rt.osx.a (2 slices)
ld: in '/usr/local/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libunwind.dylib for architecture i386
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/local/bin/clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/gokulalex/airflow/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-install-ye9ohe71/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-install-ye9ohe71/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/79/sh378bcd1n15fyw44lvjnml40000gn/T/pip-record-anu_rweq/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gokulalex/airflow/bin/../include/site/python3.6/psutil Check the logs for full command output.
Though I haven't gotten this error before, it looks like you might be missing some c headers which are important for this. Also please check your airflow installation to see if you are missing. From going through your debug log this error doesn't seem to be related to Python

Why is pip installation of pyOpenSSL 0.13 failing?

I'm on Mac OSX El-Capitan version 10.11.5.
When I try to install pyopenssl via pip, it fails with fatal error: 'openssl/ssl.h' file not found. See below.
Why is this file not there? And how can I get this pip install to work?
$ pip install pyopenssl==0.13.1
Collecting pyopenssl==0.13.1
Using cached pyOpenSSL-0.13.1.tar.gz
Building wheels for collected packages: pyopenssl
Running setup.py bdist_wheel for pyopenssl ... error
Complete output from command /Users/my_user/test-env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/tmpUgU3gIpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.11-intel-2.7
creating build/lib.macosx-10.11-intel-2.7/OpenSSL
copying OpenSSL/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
copying OpenSSL/tsafe.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
copying OpenSSL/version.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
creating build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/util.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/test_crypto.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/test_rand.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/test_ssl.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
running build_ext
building 'OpenSSL.crypto' extension
creating build/temp.macosx-10.11-intel-2.7
creating build/temp.macosx-10.11-intel-2.7/OpenSSL
creating build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto/crypto.o
In file included from OpenSSL/crypto/crypto.c:16:
In file included from OpenSSL/crypto/crypto.h:30:
OpenSSL/crypto/x509.h:17:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Failed building wheel for pyopenssl
Running setup.py clean for pyopenssl
Failed to build pyopenssl
Installing collected packages: pyopenssl
Running setup.py install for pyopenssl ... error
Complete output from command /Users/my_user/test-env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-G7av9L-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/my_user/test-env/include/site/python2.7/pyopenssl:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.11-intel-2.7
creating build/lib.macosx-10.11-intel-2.7/OpenSSL
copying OpenSSL/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
copying OpenSSL/tsafe.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
copying OpenSSL/version.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
creating build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/util.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/test_crypto.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/test_rand.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
copying OpenSSL/test/test_ssl.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
running build_ext
building 'OpenSSL.crypto' extension
creating build/temp.macosx-10.11-intel-2.7
creating build/temp.macosx-10.11-intel-2.7/OpenSSL
creating build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto/crypto.o
In file included from OpenSSL/crypto/crypto.c:16:
In file included from OpenSSL/crypto/crypto.h:30:
OpenSSL/crypto/x509.h:17:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/Users/my_user/test-env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-G7av9L-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/my_user/test-env/include/site/python2.7/pyopenssl" failed with error code 1 in /private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/

Categories