Python: error when installing lxml on OS X - python-2.7

For whatever I'm installing with pip, I got this:
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip-0wnEw6-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml
Storing debug log for failure in /Users/youweizhu/Library/Logs/pip.log
For example:
$ pip install lxml
I got
Downloading/unpacking lxml
Downloading lxml-3.4.1.tar.gz (3.5MB): 3.5MB downloaded
Running setup.py (path:/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/setup.py) egg_info for package lxml
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
Running setup.py install for lxml
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
building 'lxml.etree' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -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 x86_64 -arch i386 -pipe -I/usr/include/libxml2 -I/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.9-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
In file included from src/lxml/lxml.etree.c:239:
/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip-0wnEw6-record/install-record.txt --single-version-externally-managed --compile:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
creating build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/_elementpath.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/builder.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/cssselect.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/sax.py -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/usedoctest.py -> build/lib.macosx-10.9-intel-2.7/lxml
creating build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml/includes
creating build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.9-intel-2.7/lxml/html
creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.macosx-10.9-intel-2.7/lxml
copying src/lxml/includes/c14n.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.macosx-10.9-intel-2.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.9-intel-2.7/lxml/includes
creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources
creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/rng
creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl
creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.macosx-10.9-intel-2.7
creating build/temp.macosx-10.9-intel-2.7/src
creating build/temp.macosx-10.9-intel-2.7/src/lxml
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -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 x86_64 -arch i386 -pipe -I/usr/include/libxml2 -I/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.9-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
In file included from src/lxml/lxml.etree.c:239:
/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip-0wnEw6-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/kn/mmhj7w0n54s4b2jr08sx46kr0000gn/T/pip_build_youweizhu/lxml
Storing debug log for failure in /Users/youweizhu/Library/Logs/pip.log
I'm crying...

try this command:
STATIC_DEPS=true pip install lxml
from doc:
http://lxml.de/installation.html#using-lxml-with-python-libxml2
or Try:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2/libxml/ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml

Andre Augusto pointed out
If you want to use lxml together with the official libxml2 Python
bindings (maybe because one of your dependencies uses it), you must
build lxml statically. Otherwise, the two packages will interfere in
places where the libxml2 library requires global configuration, which
can have any kind of effect from disappearing functionality to crashes
in either of the two.
To get a static build, either pass the --static-deps option to the
setup.py script, or run pip with the STATIC_DEPS or STATICBUILD
environment variable set to true, i.e.
STATIC_DEPS=true pip install lxml
The STATICBUILD environment variable is handled equivalently to the
STATIC_DEPS variable, but is used by some other extension packages,
too.
from the lxml docs here..
http://lxml.de/installation.html#using-lxml-with-python-libxml2
his original post is here:
Cannot install Lxml on Mac os x 10.9
There's some other ios related fixes there as well.

Here is a line that works
STATIC_DEPS=true LIBXML2_VERSION=2.9.2 pip install lxml
I had the same problem myself, and I found this answer at http://louistiao.me/posts/installing-lxml-on-mac-osx-1011-inside-a-virtualenv-with-pip/
I also raise a bug at https://bugs.launchpad.net/lxml/+bug/1546046 and I recommend you to add a comment there, otherwise it will be ignored and the lxml user experience will continue to suck.

Related

How can I install flask-mysqldb on Python 3.9 on Linux? [duplicate]

This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed last year.
I tried installing the package flask-mysqldb on Pop!_OS 20.04. Below is the command I ran and the error I got:
[user]#[host]:~$ python3.9 -m pip install flask-mysqldb
Defaulting to user installation because normal site-packages is not writeable
Collecting flask-mysqldb
Using cached Flask-MySQLdb-0.2.0.tar.gz (2.1 kB)
Preparing metadata (setup.py) ... done
Collecting Flask>=0.10
Using cached Flask-2.0.2-py3-none-any.whl (95 kB)
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-f1mmzpvw/mysqlclient_315e946d2fe0466f8d910fe1dc97be53/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-f1mmzpvw/mysqlclient_315e946d2fe0466f8d910fe1dc97be53/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-f1mmzpvw/mysqlclient_315e946d2fe0466f8d910fe1dc97be53/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
P.S. My system comes with Python 3.8.10, but after reading that flask-mysqldb isn't compatible with that version on a forum, I've manually installed Python 3.9.
Edit: I've tried again after running sudo apt install libmariadb-dev-compat, and below is the error I got:
musti#pop-os:~$ pip install flask-mysqldb
Defaulting to user installation because normal site-packages is not writeable
Collecting flask-mysqldb
Using cached Flask-MySQLdb-0.2.0.tar.gz (2.1 kB)
Preparing metadata (setup.py) ... done
Collecting Flask>=0.10
Using cached Flask-2.0.2-py3-none-any.whl (95 kB)
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Preparing metadata (setup.py) ... done
Collecting click>=7.1.2
Downloading click-8.0.3-py3-none-any.whl (97 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.5/97.5 KB 604.1 kB/s eta 0:00:00
Collecting Jinja2>=3.0
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.6/133.6 KB 965.6 kB/s eta 0:00:00
Collecting itsdangerous>=2.0
Using cached itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting Werkzeug>=2.0
Downloading Werkzeug-2.0.2-py3-none-any.whl (288 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 288.9/288.9 KB 791.8 kB/s eta 0:00:00
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Building wheels for collected packages: flask-mysqldb, mysqlclient
Building wheel for flask-mysqldb (setup.py) ... done
Created wheel for flask-mysqldb: filename=Flask_MySQLdb-0.2.0-py3-none-any.whl size=2666 sha256=953b45d216c21c9f1abe115e74c1f1181126194f1d121bcf274c0b67c47938ea
Stored in directory: /home/musti/.cache/pip/wheels/41/ab/e5/ac1bfe8e719b0c95880c23643ce001363e8240f615f260755e
Building wheel for mysqlclient (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
mysql_config --version
['10.3.32']
mysql_config --libs
['-L/usr/lib/x86_64-linux-gnu/', '-lmariadb']
mysql_config --cflags
['-I/usr/include/mariadb', '-I/usr/include/mariadb/mysql']
ext_options:
library_dirs: ['/usr/lib/x86_64-linux-gnu/']
libraries: ['mariadb']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/include/mariadb', '/usr/include/mariadb/mysql']
extra_objects: []
define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.9/MySQLdb
creating build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/MySQLdb
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 -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I/usr/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.9/MySQLdb/_mysql.o -std=c99
MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory
46 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' 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 mysqlclient
Running setup.py clean for mysqlclient
Successfully built flask-mysqldb
Failed to build mysqlclient
Installing collected packages: Werkzeug, mysqlclient, MarkupSafe, itsdangerous, click, Jinja2, Flask, flask-mysqldb
Running setup.py install for mysqlclient ... error
error: subprocess-exited-with-error
× Running setup.py install for mysqlclient did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
mysql_config --version
['10.3.32']
mysql_config --libs
['-L/usr/lib/x86_64-linux-gnu/', '-lmariadb']
mysql_config --cflags
['-I/usr/include/mariadb', '-I/usr/include/mariadb/mysql']
ext_options:
library_dirs: ['/usr/lib/x86_64-linux-gnu/']
libraries: ['mariadb']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/include/mariadb', '/usr/include/mariadb/mysql']
extra_objects: []
define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.9/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.9/MySQLdb
creating build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.9/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/MySQLdb
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 -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I/usr/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.9/MySQLdb/_mysql.o -std=c99
MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory
46 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mysqlclient
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
It seems like the python-dev package is missing. Try to install it with apt install python-dev or apt install python3-dev

Error installing psycopg2 python 3.7 on macos 10.15

I tried pip3 install psycopg2
Got these errors, unable to understand what I need to do.
Please help.
Collecting psycopg2==2.7.3.1 Using cached https://files.pythonhosted.org/packages/6b/fb/15c687eda2f925f0ff59373063fdb408471b4284714a7761daaa65c01f15/psycopg2-2.7.3.1.tar.gz Installing collected packages: psycopg2
Running setup.py install for psycopg2: started
Running setup.py install for psycopg2: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /Users/amolchakane/Desktop/Projects/kisanoauth/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/psycopg2/setup.py'"'"';
__file__='"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/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/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pip-record-f050z4mz/install-record.txt
--single-version-externally-managed --compile --install-headers /Users/amolchakane/Desktop/Projects/kisanoauth/venv/include/site/python3.7/psycopg2
cwd: /private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/psycopg2/
Complete output (61 lines):
running install
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/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/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
copying lib/psycopg1.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/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
creating build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_transaction.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/dbapi20.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_extras_dictcursor.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_with.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_types_basic.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_bug_gc.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_module.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_async.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_dates.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_async_keyword.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/testutils.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_connection.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_copy.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_bugX000.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_cursor.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_types_extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_fast_executemany.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_green.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_cancel.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_quote.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/testconfig.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_errcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_replication.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_lobject.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/test_notify.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
warning: build_py: byte-compiling is disabled, skipping.
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_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.1 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=110500 -DHAVE_LO64=1
-I/Users/amolchakane/Desktop/Projects/kisanoauth/venv/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/11.5_1/include -I/usr/local/Cellar/postgresql/11.5_1/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
---------------------------------------- ERROR: Command errored out with exit status 1: /Users/amolchakane/Desktop/Projects/kisanoauth/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/psycopg2/setup.py'"'"';
__file__='"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/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/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pip-record-f050z4mz/install-record.txt
--single-version-externally-managed --compile --install-headers /Users/amolchakane/Desktop/Projects/kisanoauth/venv/include/site/python3.7/psycopg2 Check the logs for full command output.
I could solve this problem by installing the binary library which is indicated in the comment above. (It just has a typo error)
pip install psycopg2-binary
The error from Amol Chakane refers but to a PIP error referring to a package that wasn't found because of misspelling.
Make sure also that your pip command is referring to the right Python version. In my case, I'm using an environment with Python 3 and I don't need to specify pip3 but just pip
If you're new to Django (as I am), you may want to try psycopg2-binary instead. It's meant for developers and testing, but not production use. I'm using the same version of Python (3.7), Django version 2.2.6 in a virtual environment on Mac OS Mojave. I couldn't install pyscopg2 on my system either.
pip install pyscopg2-binary
These are the docs that I used to help me figure this out: http://initd.org/psycopg/docs/install.html#install-from-source
https://pypi.org/project/psycopg2-binary/

fatal error C1083 while installing Odoo prerequisites

I am facing an error while installing Odoo 11.0 community edition. The prerequisite process is ending up with fatal error C1083. I already tried these things.
Installed pip separately
Installed OpenLDAP through https://www.userbooster.de/en/download/openldap-for-windows.aspx
Installed Pyldap a fork of python-ldap https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyldap
Nothing worked. I have Python27 64 bit on my windows10 machine.
This is the error which I am getting while running pip install -r C:\unifiedexpert\odoo-11.0\requirements.txt
The error trace which I am getting is:
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
reading manifest file 'Lib\pyldap.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile'
warning: no files found matching 'Modules\LICENSE'
writing manifest file 'Lib\pyldap.egg-info\SOURCES.txt'
running build_ext
building '_ldap' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\Modules
C:\Users\Nayyer\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.28 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -IC:\Python27\include -IC:\Python27\PC /TcModules/LDAPObject.c /Fobuild\temp.win-amd64-2.7\Release\Modules/LDAPObject.obj
LDAPObject.c
c:\users\nayyer\appdata\local\temp\pip-build-5aaqii\pyldap\modules\errors.h(8) : fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
error: command 'C:\\Users\\Nayyer\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for pyldap
Running setup.py clean for pyldap
Failed to build pyldap
Installing collected packages: pyldap, PyPDF2, pyserial, six, python-dateutil, pytz, pyusb, PyYAML, qrcode, reportlab, requests, suds-jurko, python-stdnum, vatnumber, vobject, Werkzeug, XlsxWriter, xlrd, pypiwin32, xlwt, funcsigs, pbr, beautifulsoup4
Found existing installation: pyldap 2.4.37
Uninstalling pyldap-2.4.37:
Successfully uninstalled pyldap-2.4.37
Running setup.py install for pyldap ... error
Complete output from command C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\nayyer\\appdata\\local\\temp\\pip-build-5aaqii\\pyldap\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\nayyer\appdata\local\temp\pip-qyihid-record\install-record.txt --single-version-externally-managed --compile:
defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
extra_compile_args:
extra_objects:
include_dirs: /usr/include /usr/include/sasl /usr/local/include /usr/local/include/sasl
library_dirs: /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64
libs: ldap_r
running install
running build
running build_py
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
creating build\lib.win-amd64-2.7
copying Lib\ldapurl.py -> build\lib.win-amd64-2.7
copying Lib\ldif.py -> build\lib.win-amd64-2.7
copying Lib\dsml.py -> build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\ldap
copying Lib\ldap\__init__.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\async.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\compat.py -> build\lib.win-amd64-2.7\ldap
creating build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\__init__.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\deref.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\libldap.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\openldap.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\ppolicy.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\psearch.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\pwdpolicy.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\readentry.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\sessiontrack.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\simple.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\controls\sss.py -> build\lib.win-amd64-2.7\ldap\controls
copying Lib\ldap\cidict.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\dn.py -> build\lib.win-amd64-2.7\ldap
creating build\lib.win-amd64-2.7\ldap\extop
copying Lib\ldap\extop\__init__.py -> build\lib.win-amd64-2.7\ldap\extop
copying Lib\ldap\extop\dds.py -> build\lib.win-amd64-2.7\ldap\extop
copying Lib\ldap\filter.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\functions.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\ldapobject.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\logger.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\modlist.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\resiter.py -> build\lib.win-amd64-2.7\ldap
copying Lib\ldap\sasl.py -> build\lib.win-amd64-2.7\ldap
creating build\lib.win-amd64-2.7\ldap\schema
copying Lib\ldap\schema\__init__.py -> build\lib.win-amd64-2.7\ldap\schema
copying Lib\ldap\schema\models.py -> build\lib.win-amd64-2.7\ldap\schema
copying Lib\ldap\schema\subentry.py -> build\lib.win-amd64-2.7\ldap\schema
copying Lib\ldap\schema\tokenizer.py -> build\lib.win-amd64-2.7\ldap\schema
copying Lib\ldap\syncrepl.py -> build\lib.win-amd64-2.7\ldap
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
running egg_info
writing requirements to Lib\pyldap.egg-info\requires.txt
writing Lib\pyldap.egg-info\PKG-INFO
writing top-level names to Lib\pyldap.egg-info\top_level.txt
writing dependency_links to Lib\pyldap.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
reading manifest file 'Lib\pyldap.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile'
warning: no files found matching 'Modules\LICENSE'
writing manifest file 'Lib\pyldap.egg-info\SOURCES.txt'
running build_ext
building '_ldap' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\Modules
C:\Users\Nayyer\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.28 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -IC:\Python27\include -IC:\Python27\PC /TcModules/LDAPObject.c /Fobuild\temp.win-amd64-2.7\Release\Modules/LDAPObject.obj
LDAPObject.c
c:\users\nayyer\appdata\local\temp\pip-build-5aaqii\pyldap\modules\errors.h(8) : fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
error: command 'C:\\Users\\Nayyer\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Rolling back uninstall of pyldap
Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\nayyer\\appdata\\local\\temp\\pip-build-5aaqii\\pyldap\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\nayyer\appdata\local\temp\pip-qyihid-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\nayyer\appdata\local\temp\pip-build-5aaqii\pyldap\
$ sudo apt-get install libsasl2-dev libldap2-dev libssl-dev

error: command 'gcc' failed with exit status 1 Fedora psycopg2

I tried to start using virtualenv but I haven't got much luch. I have been facing a LOT of problems and one of them is this one:
(houenv)[user#localhost project]$ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Installing collected packages: psycopg2
Running setup.py install for psycopg2
Complete output from command /home/user/environments/houenv/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-sp_ab5gw/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-aiybv08u-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/environments/houenv/include/site/python3.4/psycopg2:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/psycopg1.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.4/psycopg2
creating build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_connection.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_with.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_module.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_transaction.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/psycopg
gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090405 -DHAVE_LO64=1 -I/usr/include/python3.4m -I. -I/usr/include -I/usr/include/pgsql/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.4/psycopg/psycopgmodule.o -Wdeclaration-after-statement
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/user/environments/houenv/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-sp_ab5gw/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-aiybv08u-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/environments/houenv/include/site/python3.4/psycopg2" failed with error code 1 in /tmp/pip-build-sp_ab5gw/psycopg2
I have already installed:
sudo yum install postgresql-libs
python3-devel
sudo yum install gcc
Solution
sudo apt-get install libpq-dev python3-dev
or for Fedora
sudo yum install python3-devel postgresql-devel
You are using pip verison python2.7 and you installed python3-dev instead python-dev. Either you install pip3 with python3-dev or you install python-dev and use the default pip.

Failed to install MySQLdB in virtual environment

After source into the virtual environment.
I have done the following:
pip install django
pip install mysql-python
Then I run into the followign error
Collecting MYSQL-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 110kB 387kB/s
Installing collected packages: MYSQL-python
Running setup.py install for MYSQL-python
Complete output from command /Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-CEs0Af/MYSQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xUvIl_-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/include/site/python2.7/MYSQL-python:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.5-x86_64-2.7
gcc -fno-strict-aliasing -I/Users/hainingwang/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.24/include/mysql -I/Users/hainingwang/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64-2.7/_mysql.o -g -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.24/include/mysql/my_config.h:348:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
#define SIZEOF_SIZE_T SIZEOF_LONG
^
/Users/hainingwang/anaconda/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
# define SIZEOF_SIZE_T 8
^
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.24/include/mysql/my_config.h:442:9: warning: 'HAVE_WCSCOLL' macro redefined [-Wmacro-redefined]
#define HAVE_WCSCOLL
^
/Users/hainingwang/anaconda/include/python2.7/pyconfig.h:917:9: note: previous definition is here
#define HAVE_WCSCOLL 1
^
_mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
3 warnings generated.
gcc -bundle -undefined dynamic_lookup -L/Users/hainingwang/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.6.24/lib -L/Users/hainingwang/anaconda/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.5-x86_64-2.7/_mysql.so
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-CEs0Af/MYSQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xUvIl_-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/include/site/python2.7/MYSQL-python" failed with error code 1 in /private/tmp/pip-build-CEs0Af/MYSQL-python
The installation will work outside the virtual environment.
I have python 2.7.10 and Django 1.8.4 installed on OSX 10.10.5.
Thanks.
Try update the last XCode, and then install the Command Line Tools