How to install GDAL in Ubuntu? - python

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

Related

pip: problem with the installation of mpi4py

I am trying to install mpi4py in default python environment used by anaconda:
python3.9 -m pip install mpi4py
which produces error during installation
python -m pip install mpi4py
Collecting mpi4py
Using cached mpi4py-3.1.3.tar.gz (2.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: mpi4py
Building wheel for mpi4py (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /home/gleb/anaconda3/bin/python /home/gleb/anaconda3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp75wsbtz5
cwd: /tmp/pip-install-84g0ez5h/mpi4py_2ac6e87b98de43d3827e1b2951c5c4ff
Complete output (156 lines):
running bdist_wheel
running build
running build_src
running build_py
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/bench.py -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/__main__.py -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/run.py -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/__init__.py -> build/lib.linux-x86_64-cpython-39/mpi4py
creating build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/server.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/pool.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_lib.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_base.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/aplus.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__main__.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__init__.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_core.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
creating build/lib.linux-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/dtlib.py -> build/lib.linux-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/pkl5.py -> build/lib.linux-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/__init__.py -> build/lib.linux-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/py.typed -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/__main__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/dl.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/MPI.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/__init__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/bench.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/run.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/MPI.pxd -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/libmpi.pxd -> build/lib.linux-x86_64-cpython-39/mpi4py
copying src/mpi4py/__init__.pxd -> build/lib.linux-x86_64-cpython-39/mpi4py
creating build/lib.linux-x86_64-cpython-39/mpi4py/include
creating build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.MPI.h -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.h -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.MPI_api.h -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.i -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi.pxi -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/futures/_lib.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__main__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/aplus.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__init__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/pool.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/server.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_core.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/util/dtlib.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/pkl5.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/__init__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/util
running build_clib
MPI configuration: [mpi] from 'mpi.cfg'
MPI C compiler: /home/gleb/anaconda3/bin/mpicc
MPI C++ compiler: /home/gleb/anaconda3/bin/mpicxx
MPI F compiler: /home/gleb/anaconda3/bin/mpifort
MPI F90 compiler: /home/gleb/anaconda3/bin/mpif90
MPI F77 compiler: /home/gleb/anaconda3/bin/mpif77
checking for library 'lmpe' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
building 'mpe' dylib library
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/src
creating build/temp.linux-x86_64-cpython-39/src/lib-pmpi
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c src/lib-pmpi/mpe.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/mpe.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
warning: build_clib: command '/home/gleb/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "mpe" failed
checking for library 'vt-mpi' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
checking for library 'vt.mpi' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
building 'vt' dylib library
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c src/lib-pmpi/vt.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
warning: build_clib: command '/home/gleb/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "vt" failed
checking for library 'vt-mpi' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
checking for library 'vt.mpi' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
building 'vt-mpi' dylib library
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c src/lib-pmpi/vt-mpi.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt-mpi.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
warning: build_clib: command '/home/gleb/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "vt-mpi" failed
checking for library 'vt-hyb' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
checking for library 'vt.ompi' ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
building 'vt-hyb' dylib library
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -c src/lib-pmpi/vt-hyb.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt-hyb.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
warning: build_clib: command '/home/gleb/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "vt-hyb" failed
running build_ext
MPI configuration: [mpi] from 'mpi.cfg'
MPI C compiler: /home/gleb/anaconda3/bin/mpicc
MPI C++ compiler: /home/gleb/anaconda3/bin/mpicxx
MPI F compiler: /home/gleb/anaconda3/bin/mpifort
MPI F90 compiler: /home/gleb/anaconda3/bin/mpif90
MPI F77 compiler: /home/gleb/anaconda3/bin/mpif77
checking for dlopen() availability ...
checking for header 'dlfcn.h' ...
gcc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -I/home/gleb/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
success!
removing: _configtest.c _configtest.o
success!
checking for library 'dl' ...
gcc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -I/home/gleb/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
gcc -pthread -B /home/gleb/anaconda3/compiler_compat _configtest.o -Lbuild/temp.linux-x86_64-cpython-39 -ldl -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
checking for function 'dlopen' ...
gcc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -I/home/gleb/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
gcc -pthread -B /home/gleb/anaconda3/compiler_compat _configtest.o -Lbuild/temp.linux-x86_64-cpython-39 -ldl -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
building 'mpi4py.dl' extension
gcc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -DHAVE_DLFCN_H=1 -DHAVE_DLOPEN=1 -I/home/gleb/anaconda3/include/python3.9 -c src/dynload.c -o build/temp.linux-x86_64-cpython-39/src/dynload.o
gcc -pthread -B /home/gleb/anaconda3/compiler_compat -shared -Wl,-rpath,/home/gleb/anaconda3/lib -Wl,-rpath-link,/home/gleb/anaconda3/lib -L/home/gleb/anaconda3/lib -L/home/gleb/anaconda3/lib -Wl,-rpath,/home/gleb/anaconda3/lib -Wl,-rpath-link,/home/gleb/anaconda3/lib -L/home/gleb/anaconda3/lib build/temp.linux-x86_64-cpython-39/src/dynload.o -Lbuild/temp.linux-x86_64-cpython-39 -ldl -o build/lib.linux-x86_64-cpython-39/mpi4py/dl.cpython-39-x86_64-linux-gnu.so
checking for MPI compile and link ...
/home/gleb/anaconda3/bin/mpicc -pthread -B /home/gleb/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/gleb/anaconda3/include -I/home/gleb/anaconda3/include -fPIC -O2 -isystem /home/gleb/anaconda3/include -fPIC -I/home/gleb/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
/home/gleb/anaconda3/bin/mpicc: line 301: x86_64-conda_cos6-linux-gnu-cc: command not found
failure.
removing: _configtest.c _configtest.o
error: Cannot compile MPI programs. Check your configuration!!!
----------------------------------------
ERROR: Failed building wheel for mpi4py
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py which use PEP 517 and cannot be installed directly
Then I tried
sudo pip install mpi4py
that installed the package correctly but into another python environment
so python does not see it
Python 3.9.12 (main, Apr 5 2022, 06:56:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpi4py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mpi4py'
Finally I've tried simply
sudo apt install python3-mpi4py
it installed package correclty but my python3 enviroment still does not see it.
I also tried
conda install -c conda-forge mpi4py
which does not work as well:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: - failed with initial frozen solve. Retrying with flexible solve.
how could I execute python3.9 -m pip install mpi4py with sudo ?

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 do I install mysql-python for python2.7

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

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