How do I install mysql-python for python2.7 - python

How do I install mysql-python for python2.7. The following script seems to use -I/usr/include/mysql which is empty, but I do have other folders like /usr/include/mysql51 and /usr/include/mysql55 which seem to contain header files.
sudo pip install MYSQL-python --allow-all-external
I got the following error:
Collecting MYSQL-python
Using cached MySQL-python-1.2.5.zip
Installing collected packages: MYSQL-python
Running setup.py install for MYSQL-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-i686-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX
_mysql.c:44:23: fatal error: my_config.h: No such file or directory
#include "my_config.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vXN9gu/MYSQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dKaHt3-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
copying _mysql_exceptions.py -> build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.7/MySQLdb
creating build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-i686-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX
_mysql.c:44:23: fatal error: my_config.h: No such file or directory
#include "my_config.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vXN9gu/MYSQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dKaHt3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vXN9gu/MYSQL-python

Why you wanted to face all those problems yourself? This was already resolved by package maintainers. Do:
yum install MySQL-python

Consider installing devel package
sudo yum install mysql-devel
Then install mysql-python using pip or yum:
pip install mysql-python OR sudo yum install MySQL-python

Related

why pymqi won't install if MQ client is installed on centos 7?

I am trying to install pymqi using docker. The mq client is installed on /opt/mqm.
The output I get is the following one. It says there is a library missing, called cmqc.h
Can you tell me what is wrong ?
This is a linux CENTOS 7. The mq client is version 9.x
First the confirmation I've the libs:
ls /opt/mqm/lib64
---> Running in 7590f44ed84d
amqlcelp
amqlcelp_r
libimqb23gl_r.so.4.1
libimqc23gl.so
libimqc23gl.so.4.1
libimqc23gl_r.so
libimqc23gl_r.so.4.1
libmqcxa.so
libmqcxa64.so
libmqcxa64_r.so
libmqcxa_r.so
libmqdc.so
libmqdc_r.so
libmqe.so
libmqe_r.so
libmqecs.so
libmqecs_r.so
libmqic.so
libmqic_r.so
libmqicb.so
libmqicb_r.so
libmqiz.so
libmqiz_r.so
libmqjx_r.so
libmqjxx_r.so
libmqm.so
libmqm_r.so
libmqmcs.so
libmqmcs_r.so
libmqmzse.so
libmqxzu.so
libmqxzu_r.so
libmqz.so
libmqz_r.so
libmqzsd.so
libmqzsd_r.so
and then the error log:
Step 14/14 : RUN pip install pymqi
---> Running in b3fe8af64752
Collecting pymqi
Downloading https://files.pythonhosted.org/packages/55/33/c567a624e7c09a5ab50352dc2aa586fbdf75fbe185d55a2d1d027fe685b2/pymqi-1.12.0.tar.gz (75kB)
Installing collected packages: pymqi
Running setup.py install for pymqi: started
Running setup.py install for pymqi: finished with status 'error'
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-P1MQ9K/pymqi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zRYa70-record/install-record.txt --single-version-externally-managed --compile:
Building PyMQI client mode 64bits
Using library_dirs:`['/opt/mqm/lib64']`, include:`['/opt/mqm/inc']`, libraries:`['mqic_r']`
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pymqi
copying code/pymqi/__init__.py -> build/lib.linux-x86_64-2.7/pymqi
copying code/pymqi/CMQC.py -> build/lib.linux-x86_64-2.7/pymqi
copying code/pymqi/CMQCFC.py -> build/lib.linux-x86_64-2.7/pymqi
copying code/pymqi/CMQXC.py -> build/lib.linux-x86_64-2.7/pymqi
copying code/pymqi/CMQZC.py -> build/lib.linux-x86_64-2.7/pymqi
copying code/pymqi/const.py -> build/lib.linux-x86_64-2.7/pymqi
running build_ext
building 'pymqi.pymqe' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/code
creating build/temp.linux-x86_64-2.7/code/pymqi
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_BINDINGS_MODE_BUILD=0 -I/opt/mqm/inc -I/usr/include/python2.7 -c code/pymqi/pymqe.c -o build/temp.linux-x86_64-2.7/code/pymqi/pymqe.o
code/pymqi/pymqe.c:78:18: fatal error: cmqc.h: No such file or directory
#include <cmqc.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1

MariaDB Connector/Python installation issue on Ubuntu 20.04 (

I ran into an issue installing mariadb connector for python on Ubuntu 20.04.
I did installed mariadb server and connector for C as they say in the docs:
sudo apt-get update
sudo apt-get install mariadb-server
sudo apt-get install libmariadb3
sudo apt-get install libmariadb-dev
Also installed:
sudo apt-get install libmariadbclient-dev
Then:
$ pip3 install mariadb
Collecting mariadb Using cached mariadb-1.0.3.tar.gz (66 kB) Building wheels for collected packages: mariadb Building wheel for mariadb (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-01wak5oz/mariadb/setup.py'"'"';
__file__='"'"'/tmp/pip-install-01wak5oz/mariadb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-oazbv39u
cwd: /tmp/pip-install-01wak5oz/mariadb/ 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/mariadb copying mariadb/__init__.py -> build/lib.linux-x86_64-3.8/mariadb creating build/lib.linux-x86_64-3.8/mariadb/constants copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-3.8/mariadb/constants copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/mariadb/constants copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-3.8/mariadb/constants copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-3.8/mariadb/constants copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/mariadb/constants running build_ext building 'mariadb._mariadb' extension creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/mariadb 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 -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=3 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/usr/include/python3.8 -c mariadb/mariadb.c -o build/temp.linux-x86_64-3.8/mariadb/mariadb.o
-DDEFAULT_PLUGINS_SUBDIR="/usr/lib/x86_64-linux-gnu/mariadb19/plugin" 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 -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=3 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/usr/include/python3.8 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-3.8/mariadb/mariadb_connection.o
-DDEFAULT_PLUGINS_SUBDIR="/usr/lib/x86_64-linux-gnu/mariadb19/plugin" 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 -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=3 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/usr/include/python3.8 -c mariadb/mariadb_exception.c -o build/temp.linux-x86_64-3.8/mariadb/mariadb_exception.o
-DDEFAULT_PLUGINS_SUBDIR="/usr/lib/x86_64-linux-gnu/mariadb19/plugin" 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 -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=3 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/usr/include/python3.8 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-3.8/mariadb/mariadb_cursor.o
-DDEFAULT_PLUGINS_SUBDIR="/usr/lib/x86_64-linux-gnu/mariadb19/plugin" 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 -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=3 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/usr/include/python3.8 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-3.8/mariadb/mariadb_codecs.o
-DDEFAULT_PLUGINS_SUBDIR="/usr/lib/x86_64-linux-gnu/mariadb19/plugin" mariadb/mariadb_codecs.c: In function ‘mariadb_extended_field_type’: mariadb/mariadb_codecs.c:64:5: error: unknown type name ‘MARIADB_CONST_STRING’
64 | MARIADB_CONST_STRING str;
| ^~~~~~~~~~~~~~~~~~~~ mariadb/mariadb_codecs.c:66:10: warning: implicit declaration of function ‘mariadb_field_attr’ [-Wimplicit-function-declaration]
66 | if (!mariadb_field_attr(&str, field, MARIADB_FIELD_ATTR_FORMAT_NAME))
| ^~~~~~~~~~~~~~~~~~ mariadb/mariadb_codecs.c:66:42: error: ‘MARIADB_FIELD_ATTR_FORMAT_NAME’ undeclared (first use in this function)
66 | if (!mariadb_field_attr(&str, field, MARIADB_FIELD_ATTR_FORMAT_NAME))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mariadb/mariadb_codecs.c:66:42: note: each undeclared identifier is reported only once for each function it appears in mariadb/mariadb_codecs.c:68:14: error: request for member ‘length’ in something not a structure or union
68 | if (str.length == 4 && !strncmp(str.str, "json", 4))
| ^ mariadb/mariadb_codecs.c:68:42: error: request for member ‘str’ in something not a structure or union
68 | if (str.length == 4 && !strncmp(str.str, "json", 4))
| ^ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
---------------------------------------- ERROR: Failed building wheel for mariadb Running setup.py clean for mariadb Failed to build mariadb
It seems that issue comes from:
mariadb/mariadb_codecs.c: In function ‘mariadb_extended_field_type’:
mariadb/mariadb_codecs.c:64:5: error: unknown type name ‘MARIADB_CONST_STRING’
But I'm not good in C and unable to investigate this right away.
Tried googling, but no results for issues caused by MARIADB_CONST_STRING type.
It is my first time installing mariadb connector for python on ubuntu.
Did anyone seen this error before? How should I proceed?
Appreciate your advise.
I went through more docs: https://mariadb.com/kb/en/installing-mariadb-deb-files/
What helped was:
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
Then again:
$ sudo apt-get update
$ sudo apt-get install libmariadb3
Now lets try to install Python mariadb lib:
$ pip3 install mariadb
Collecting mariadb
Using cached mariadb-1.0.3.tar.gz (66 kB)
Building wheels for collected packages: mariadb
Building wheel for mariadb (setup.py) ... done
Created wheel for mariadb: filename=mariadb-1.0.3-cp38-cp38-linux_x86_64.whl size=233300 sha256=607a788847d8d023a8921f7fc8fa9a5450b0e7f0625416de86d26cedfe202e73
Stored in directory: /home/sergey/.cache/pip/wheels/c5/56/1d/ade90f725a5f6a15b505bebc461ebfc573223e9836c5bf5603
Successfully built mariadb
Installing collected packages: mariadb
Successfully installed mariadb-1.0.3

Failing to 'pip3 install apex' down to failure to build cryptacular (installed)

Problem: pip3 install apex fails because of failure to build cryptacular, errors as below.
cryptacular was successfully installed (before attempts of installing apex) using this one-liner: pip3 install -e hg+https://bitbucket.org/dholth/cryptacular#cb96fb3#egg=cryptacular
Somehow it would not install with plain pip/pip3 install cryptacular, so the only way I found to successfully install this package is following these instructions, equivalent to these instructions.
However once I run pip3 install apex I receive the exact same error again.
It doesn't seem to be pip/pip3 issue - I've tried both with the same result.
Any ideas on what I am doing wrong?
Collecting apex
Collecting requests (from apex)
Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
----------------------- loads of "collecting" messages -------------------------
Collecting PasteDeploy>=2.0 (from plaster-pastedeploy->pyramid>1.1.2->apex)
Using cached https://files.pythonhosted.org/packages/67/0c/faa9971b2e5e048b3b30008d04c72e4d5f63b42f48937c169acce2c5e70a/PasteDeploy-2.0.1-py2.py3-none-any.whl
Building wheels for collected packages: cryptacular
Running setup.py bdist_wheel for cryptacular ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d8_sob/cryptacular/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp7vBhDEpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cryptacular
copying cryptacular/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular
creating build/lib.linux-x86_64-2.7/cryptacular/bcrypt
copying cryptacular/bcrypt/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
copying cryptacular/bcrypt/test_bcrypt.py -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
creating build/lib.linux-x86_64-2.7/cryptacular/core
copying cryptacular/core/test_core.py -> build/lib.linux-x86_64-2.7/cryptacular/core
...
creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
In file included from /usr/include/python2.7/Python.h:47:0,
from cryptacular/bcrypt/_bcrypt.c:26:
crypt_blowfish-1.2/crypt.h:17:10: fatal error: gnu-crypt.h: No such file or directory
#include <gnu-crypt.h>
^~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for cryptacular
Running setup.py clean for cryptacular
Failed to build cryptacular
Installing collected packages: urllib3, certifi, chardet, idna, requests, wtforms, wtforms-recaptcha, setuptools, zope.interface, repoze.lru, PasteDeploy, plaster, plaster-pastedeploy, webob, venusian, zope.deprecation, translationstring, hupper, pyramid, oauthlib, requests-oauthlib, python-openid, anykeystore, velruse, transaction, repoze.sendmail, pyramid-mailer, SQLAlchemy, zope.sqlalchemy, pbkdf2, cryptacular, apex
Running setup.py install for cryptacular ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d8_sob/cryptacular/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Br1FfW-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cryptacular
copying cryptacular/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular
creating build/lib.linux-x86_64-2.7/cryptacular/bcrypt
copying cryptacular/bcrypt/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
...
creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
In file included from /usr/include/python2.7/Python.h:47:0,
from cryptacular/bcrypt/_bcrypt.c:26:
crypt_blowfish-1.2/crypt.h:17:10: fatal error: gnu-crypt.h: No such file or directory
#include <gnu-crypt.h>
^~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d8_sob/cryptacular/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Br1FfW-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-d8_sob/cryptacular/
UPDATE:
Once I force gnu-crypt.h into required place: cd /usr/include && sudo mv crypt.h gnu-crypt.h I get a new but similar error:
...
creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
In file included from cryptacular/bcrypt/_bcrypt.c:27:0:
crypt_blowfish-1.2/ow-crypt.h:27:14: error: conflicting types for ‘crypt_r’
extern char *crypt_r(__const char *key, __const char *setting, void *data);
^~~~~~~
In file included from crypt_blowfish-1.2/crypt.h:17:0,
from /usr/include/python2.7/Python.h:47,
from cryptacular/bcrypt/_bcrypt.c:26:
/usr/include/gnu-crypt.h:60:14: note: previous declaration of ‘crypt_r’ was here
extern char *crypt_r (const char *__key, const char *__salt,
^~~~~~~
cryptacular/bcrypt/_bcrypt.c: In function ‘init_bcrypt’:
cryptacular/bcrypt/_bcrypt.c:129:19: warning: unused variable ‘module’ [-Wunused-variable]
PyObject *module = Py_InitModule("_bcrypt", _bcrypt_methods);
^~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for cryptacular
Running setup.py clean for cryptacular
Failed to build cryptacular
Installing collected packages: urllib3, certifi, chardet, idna, requests, wtforms, wtforms-recaptcha, setuptools, zope.interface, repoze.lru, PasteDeploy, plaster, plaster-pastedeploy, webob, venusian, zope.deprecation, translationstring, hupper, pyramid, oauthlib, requests-oauthlib, python-openid, anykeystore, velruse, transaction, repoze.sendmail, pyramid-mailer, SQLAlchemy, zope.sqlalchemy, pbkdf2, cryptacular, apex
Running setup.py install for cryptacular ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqj6l9/cryptacular/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-CRC3Cz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cryptacular
...
writing manifest file 'cryptacular.egg-info/SOURCES.txt'
copying cryptacular/bcrypt/_bcrypt.c -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
running build_ext
building 'cryptacular.bcrypt._bcrypt' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/crypt_blowfish-1.2
creating build/temp.linux-x86_64-2.7/cryptacular
creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
In file included from cryptacular/bcrypt/_bcrypt.c:27:0:
crypt_blowfish-1.2/ow-crypt.h:27:14: error: conflicting types for ‘crypt_r’
extern char *crypt_r(__const char *key, __const char *setting, void *data);
^~~~~~~
In file included from crypt_blowfish-1.2/crypt.h:17:0,
from /usr/include/python2.7/Python.h:47,
from cryptacular/bcrypt/_bcrypt.c:26:
/usr/include/gnu-crypt.h:60:14: note: previous declaration of ‘crypt_r’ was here
extern char *crypt_r (const char *__key, const char *__salt,
^~~~~~~
cryptacular/bcrypt/_bcrypt.c: In function ‘init_bcrypt’:
cryptacular/bcrypt/_bcrypt.c:129:19: warning: unused variable ‘module’ [-Wunused-variable]
PyObject *module = Py_InitModule("_bcrypt", _bcrypt_methods);
^~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqj6l9/cryptacular/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-CRC3Cz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-pqj6l9/cryptacular/
Uninstall the previous versions of apex. Then do these steps:
git clone https://www.github.com/nvidia/apex
cd apex
python setup.py install
worked like charm for me

How to install GDAL in Ubuntu?

I've got Ubuntu 17.04 version installed and I want to install GDAL. I have tried several ways to install it, but always I've got an error. I have installed Python 2.7 and Python 3.6 but I want to do the install for Python 2.7
I have tried to do the installation following these steps:
sudo apt-get install libgdal-dev export
CPLUS_INCLUDE_PATH=/usr/include/gdal export
C_INCLUDE_PATH=/usr/include/gdal pip install GDAL
And I've got this error:
Collecting GDAL
Using cached GDAL-2.2.3.tar.gz
Installing collected packages: GDAL
Running setup.py install for GDAL ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-iebgcn_u/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-x3vhb2t4-record/install-record.txt --single-version-externally-managed --compile:
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
copying gnm.py -> build/lib.linux-x86_64-3.6
creating 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/osr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gnm.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
Fixing build/lib.linux-x86_64-3.6/gdal.py build/lib.linux-x86_64-3.6/ogr.py build/lib.linux-x86_64-3.6/osr.py build/lib.linux-x86_64-3.6/gdalconst.py build/lib.linux-x86_64-3.6/gnm.py build/lib.linux-x86_64-3.6/osgeo/gdal.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py
Skipping optional fixer: ws_comma
Fixing build/lib.linux-x86_64-3.6/gdal.py build/lib.linux-x86_64-3.6/ogr.py build/lib.linux-x86_64-3.6/osr.py build/lib.linux-x86_64-3.6/gdalconst.py build/lib.linux-x86_64-3.6/gnm.py build/lib.linux-x86_64-3.6/osgeo/gdal.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py
Skipping optional fixer: ws_comma
running build_ext
building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/extensions
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.6m -I. -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o -L../../.libs -L../../ -lgdal -o build/lib.linux-x86_64-3.6/osgeo/_gdal.cpython-36m-x86_64-linux-gnu.so
building 'osgeo._gdalconst' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.6m -I. -I/usr/include -c extensions/gdalconst_wrap.c -o build/temp.linux-x86_64-3.6/extensions/gdalconst_wrap.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/extensions/gdalconst_wrap.o -L../../.libs -L../../ -lgdal -o build/lib.linux-x86_64-3.6/osgeo/_gdalconst.cpython-36m-x86_64-linux-gnu.so
building 'osgeo._osr' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.6m -I. -I/usr/include -c extensions/osr_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/osr_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
extensions/osr_wrap.cpp:3339:13: warning: ‘void GDALPythonFreeCStr(void*, int)’ defined but not used [-Wunused-function]
static void GDALPythonFreeCStr(void* ptr, int bToFree)
^~~~~~~~~~~~~~~~~~
extensions/osr_wrap.cpp:3309:14: warning: ‘char* GDALPythonObjectToCStr(PyObject*, int*)’ defined but not used [-Wunused-function]
static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
^~~~~~~~~~~~~~~~~~~~~~
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/extensions/osr_wrap.o -L../../.libs -L../../ -lgdal -o build/lib.linux-x86_64-3.6/osgeo/_osr.cpython-36m-x86_64-linux-gnu.so
building 'osgeo._ogr' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.6m -I. -I/usr/include -c extensions/ogr_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/ogr_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/extensions/ogr_wrap.o -L../../.libs -L../../ -lgdal -o build/lib.linux-x86_64-3.6/osgeo/_ogr.cpython-36m-x86_64-linux-gnu.so
building 'osgeo._gnm' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.6m -I. -I/usr/include -c extensions/gnm_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gnm_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
extensions/gnm_wrap.cpp:3321:13: warning: ‘void GDALPythonFreeCStr(void*, int)’ defined but not used [-Wunused-function]
static void GDALPythonFreeCStr(void* ptr, int bToFree)
^~~~~~~~~~~~~~~~~~
extensions/gnm_wrap.cpp:3291:14: warning: ‘char* GDALPythonObjectToCStr(PyObject*, int*)’ defined but not used [-Wunused-function]
static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
^~~~~~~~~~~~~~~~~~~~~~
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/extensions/gnm_wrap.o -L../../.libs -L../../ -lgdal -o build/lib.linux-x86_64-3.6/osgeo/_gnm.cpython-36m-x86_64-linux-gnu.so
running install_lib
copying build/lib.linux-x86_64-3.6/gdal.py -> /usr/local/lib/python3.6/dist-packages
error: could not create '/usr/local/lib/python3.6/dist-packages/gdal.py': Permission denied
----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-iebgcn_u/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-x3vhb2t4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-iebgcn_u/GDAL/
If I execute the last command withs sudo: sudo pip install GDAL. I've got this another error ...
The directory '/home/josecarlos/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/josecarlos/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting GDAL Downloading GDAL-2.2.3.tar.gz (475kB)
100% |████████████████████████████████| 481kB 1.3MB/s Installing collected packages: GDAL Running setup.py install for GDAL ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0rp6w4f8/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record /tmp/pip-w7crvfsd-record/install-record.txt --single-version-externally-managed --compile:
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
copying gnm.py -> build/lib.linux-x86_64-3.6
creating 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/osr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gnm.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
Fixing build/lib.linux-x86_64-3.6/gdal.py build/lib.linux-x86_64-3.6/ogr.py build/lib.linux-x86_64-3.6/osr.py build/lib.linux-x86_64-3.6/gdalconst.py build/lib.linux-x86_64-3.6/gnm.py build/lib.linux-x86_64-3.6/osgeo/gdal.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py
Skipping optional fixer: ws_comma
Fixing build/lib.linux-x86_64-3.6/gdal.py build/lib.linux-x86_64-3.6/ogr.py build/lib.linux-x86_64-3.6/osr.py build/lib.linux-x86_64-3.6/gdalconst.py build/lib.linux-x86_64-3.6/gnm.py build/lib.linux-x86_64-3.6/osgeo/gdal.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py
Skipping optional fixer: ws_comma
running build_ext
building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/extensions
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.6m -I. -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
extensions/gdal_wrap.cpp:3168:10: fatal error: cpl_port.h: No existe el archivo o el directorio
#include "cpl_port.h"
^~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
---------------------------------------- Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0rp6w4f8/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record /tmp/pip-w7crvfsd-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0rp6w4f8/GDAL/
How can I install GDAL in Ubuntu?
maybe you'll have more choices if you download the package and read the readme.txt.
downloadpage
im not that confident with all those command parameters on my own.
hope it helps^^
Maybe the problem is the Ubuntu version more than Python. I didn't find much information about ubuntu 17, so you should try what is available for the older and more stable versions.
I have Ubuntu 18.04 and this answer seems to help her, too. According to comments it also worked on Ubuntu 16.04 and 14.04:
If you don't have any gdal previous version installed
Open your terminal and type
sudo add-apt-repository -y ppa:ubuntugis/ppa
sudo apt update
sudo apt install gdal-bin python-gdal python3-gdal
If you have a previous version installed
Open your terminal and type
sudo add-apt-repository -y ppa:ubuntugis/ppa
sudo apt update
sudo apt upgrade

Unable to install MySQL-Python Mac Mavericks

I am unable to install MySQL-Python on Mavericks with sudo pip install MySQL-Python
I did
export CPPFLAGS=-Qunused-arguments
and
export CFLAGS=-Qunused-arguments before running the command, but I still ran into this same error.
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.9-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -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 -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.15/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip-build-root/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_UV3aF-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/tmp/pip-build-root/mysql-python
Run the following before pip install...
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Ok, here's what I did:
sudo CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments python setup.py build
then same thing, but 'install' instead of build

Categories

Resources