I am having a brutal time getting gdal installed. I have a fresh install of Ubuntu Mint with a virtualenv Python 3.6 environment that I am trying to get GDAL installed on. After working through all the dependency requirements I now get the following error after running pip install gdal:
Collecting gdal
Using cached https://files.pythonhosted.org/packages/99/31/2e05c1be3196126fa04028aed51489f40ceea77e8361a80bc8b00fc463db/GDAL-2.3.1.tar.gz
Building wheels for collected packages: gdal
Running setup.py bdist_wheel for gdal ... error
Complete output from command /home/mnewman/pyenvs/py36/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sxbz7tcv/gdal/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/tmp00t__5p7pip-wheel- --python-tag cp36:
running bdist_wheel
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
copying gdalnumeric.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gnm.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/osr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdal.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/gdalnumeric.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.6/osgeo/gdal.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/gdalnumeric.py build/lib.linux-x86_64-3.6/osgeo/gdal_array.py build/lib.linux-x86_64-3.6/osgeo/gdalconst.py build/lib.linux-x86_64-3.6/osgeo/__init__.py build/lib.linux-x86_64-3.6/osgeo/gnm.py build/lib.linux-x86_64-3.6/osgeo/osr.py build/lib.linux-x86_64-3.6/osgeo/ogr.py build/lib.linux-x86_64-3.6/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.6/osgeo/gdal.py
Skipping optional fixer: ws_comma
running build_ext
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -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/home/mnewman/pyenvs/py36/include -I/usr/include/python3.6m -I/home/mnewman/pyenvs/py36/lib/python3.6/site-packages/numpy/core/include -I/usr/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
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-EKG1lX/python3.6-3.6.5=. -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/home/mnewman/pyenvs/py36/include -I/usr/include/python3.6m -I/home/mnewman/pyenvs/py36/lib/python3.6/site-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o -I/usr/include/gdal
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
extensions/gdal_wrap.cpp: In function ‘retStringAndCPLFree* wrapper_VSIGetSignedURL(const char*, char**)’:
extensions/gdal_wrap.cpp:4067:12: error: ‘VSIGetSignedURL’ was not declared in this scope
return VSIGetSignedURL( utf8_path, options );
^~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:4067:12: note: suggested alternative: ‘VSIRewindL’
return VSIGetSignedURL( utf8_path, options );
^~~~~~~~~~~~~~~
VSIRewindL
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetErrorCounter(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:7465:14: error: ‘CPLGetErrorCounter’ was not declared in this scope
result = CPLGetErrorCounter();
^~~~~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:7465:14: note: suggested alternative: ‘_wrap_GetErrorCounter’
result = CPLGetErrorCounter();
^~~~~~~~~~~~~~~~~~
_wrap_GetErrorCounter
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_MkdirRecursive(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:8553:16: error: ‘VSIMkdirRecursive’ was not declared in this scope
result = VSIMkdirRecursive((char const *)arg1,arg2);
^~~~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:8553:16: note: suggested alternative: ‘VSIReadDirRecursive’
result = VSIMkdirRecursive((char const *)arg1,arg2);
^~~~~~~~~~~~~~~~~
VSIReadDirRecursive
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_RmdirRecursive(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:8623:16: error: ‘VSIRmdirRecursive’ was not declared in this scope
result = VSIRmdirRecursive((char const *)arg1);
^~~~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:8623:16: note: suggested alternative: ‘VSIReadDirRecursive’
result = VSIRmdirRecursive((char const *)arg1);
^~~~~~~~~~~~~~~~~
VSIReadDirRecursive
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetActualURL(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:8788:24: error: ‘VSIGetActualURL’ was not declared in this scope
result = (char *)VSIGetActualURL((char const *)arg1);
^~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:8788:24: note: suggested alternative: ‘_wrap_GetActualURL’
result = (char *)VSIGetActualURL((char const *)arg1);
^~~~~~~~~~~~~~~
_wrap_GetActualURL
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetFileSystemsPrefixes(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:8962:25: error: ‘VSIGetFileSystemsPrefixes’ was not declared in this scope
result = (char **)VSIGetFileSystemsPrefixes();
^~~~~~~~~~~~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:8962:25: note: suggested alternative: ‘_wrap_GetFileSystemsPrefixes’
result = (char **)VSIGetFileSystemsPrefixes();
^~~~~~~~~~~~~~~~~~~~~~~~~
_wrap_GetFileSystemsPrefixes
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GetFileSystemOptions(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:9026:24: error: ‘VSIGetFileSystemOptions’ was not declared in this scope
result = (char *)VSIGetFileSystemOptions((char const *)arg1);
^~~~~~~~~~~~~~~~~~~~~~~
extensions/gdal_wrap.cpp:9026:24: note: suggested alternative: ‘_wrap_GetFileSystemOptions’
result = (char *)VSIGetFileSystemOptions((char const *)arg1);
^~~~~~~~~~~~~~~~~~~~~~~
_wrap_GetFileSystemOptions
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for gdal
Running setup.py clean for gdal
Failed to build gdal
Not sure what I am missing here, I have installed all the libraries and -dev versions.
I solved it via:
install the newest version of gdal-bin and libgdal-dev:
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt upgrade
sudo apt install gdal-bin libgdal-dev
My gdal version was 2.2.3, so maybe specifically install that one if this does not work.
install using pip3:
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
Related
I am trying to install OpenAI's Gym in Windows 10, according to this article.
I followed most of the steps without problems. However, at the step for installing Box2D with pip, I get the errors below. MyEnv is my current conda environment. How can I address this problem?
(MyEnv) C:\Users\me>pip install Box2D
Collecting Box2D
Using cached https://files.pythonhosted.org/packages/cc/7b/ddb96fea1fa5b24f8929714ef483f64c33e9649e7aae066e5f5023ea426a/Box2D-2.3.2.tar.gz
Building wheels for collected packages: Box2D
Building wheel for Box2D (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"'; __file__='"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\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 'C:\Users\me\AppData\Local\Temp\pip-wheel-58bpeewu' --python-tag cp37
cwd: C:\Users\me\AppData\Local\Temp\pip-install-v1w5reok\Box2D\
Complete output (338 lines):
Using setuptools (version 41.2.0).
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\Box2D
copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.7\Box2D
copying library\Box2D\__init__.py -> build\lib.win-amd64-3.7\Box2D
creating build\lib.win-amd64-3.7\Box2D\b2
copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.7\Box2D\b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\bin\swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
Box2D\Common\b2Math.h(67) : Warning 302: Identifier 'b2Vec2' redefined by %extend (ignored),
Box2D\Box2D_math.i(47) : Warning 302: %extend definition of 'b2Vec2'.
Box2D\Common\b2Math.h(158) : Warning 302: Identifier 'b2Vec3' redefined by %extend (ignored),
Box2D\Box2D_math.i(168) : Warning 302: %extend definition of 'b2Vec3'.
Box2D\Common\b2Math.h(197) : Warning 302: Identifier 'b2Mat22' redefined by %extend (ignored),
Box2D\Box2D_math.i(301) : Warning 302: %extend definition of 'b2Mat22'.
Box2D\Common\b2Math.h(271) : Warning 302: Identifier 'b2Mat33' redefined by %extend (ignored),
Box2D\Box2D_math.i(372) : Warning 302: %extend definition of 'b2Mat33'.
Box2D\Collision\b2DynamicTree.h(44) : Warning 312: Nested union not currently supported (ignored).
Box2D\Common\b2Settings.h(144) : Warning 506: Can't wrap varargs with keyword arguments enabled
Box2D\Common\b2Math.h(91) : Warning 509: Overloaded method b2Vec2::operator ()(int32) effectively ignored,
Box2D\Common\b2Math.h(85) : Warning 509: as it is shadowed by b2Vec2::operator ()(int32) const.
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\box2d
creating build\temp.win-amd64-3.7\Release\box2d\dynamics
creating build\temp.win-amd64-3.7\Release\box2d\dynamics\contacts
creating build\temp.win-amd64-3.7\Release\box2d\dynamics\joints
creating build\temp.win-amd64-3.7\Release\box2d\common
creating build\temp.win-amd64-3.7\Release\box2d\collision
creating build\temp.win-amd64-3.7\Release\box2d\collision\shapes
C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -c Box2D\Box2D_wrap.cpp -o build\temp.win-amd64-3.7\Release\box2d\box2d_wrap.o -I.
Box2D\Box2D_wrap.cpp: In function 'bool b2CheckVertices(b2Vec2*, int32, bool)':
Box2D\Box2D_wrap.cpp:3760:16: warning: variable 'm_centroid' set but not used [-Wunused-but-set-variable]
b2Vec2 m_centroid = __b2ComputeCentroid(vertices, count);
^
Box2D\Box2D_wrap.cpp: In function 'long int b2ContactPoint___hash__(b2ContactPoint*)':
Box2D\Box2D_wrap.cpp:4181:77: error: cast from 'b2ContactPoint*' to 'long int' loses precision [-fpermissive]
SWIGINTERN long b2ContactPoint___hash__(b2ContactPoint *self){ return (long)self; }
^
Box2D\Box2D_wrap.cpp: In function 'long int b2AssertException___hash__(b2AssertException*)':
Box2D\Box2D_wrap.cpp:4205:83: error: cast from 'b2AssertException*' to 'long int' loses precision [-fpermissive]
SWIGINTERN long b2AssertException___hash__(b2AssertException *self){ return (long)self; }
<lots of errors from Box2D_wrap.cpp>
^
error: command 'C:\\Users\\me\\AppData\\Local\\Continuum\\anaconda3\\envs\\COBRA\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for Box2D
Running setup.py clean for Box2D
Failed to build Box2D
Installing collected packages: Box2D
Running setup.py install for Box2D ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"'; __file__='"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\me\AppData\Local\Temp\pip-record-7ni40amu\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\me\AppData\Local\Temp\pip-install-v1w5reok\Box2D\
Complete output (338 lines):
Using setuptools (version 41.2.0).
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\Box2D
copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.7\Box2D
copying library\Box2D\__init__.py -> build\lib.win-amd64-3.7\Box2D
creating build\lib.win-amd64-3.7\Box2D\b2
copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.7\Box2D\b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\bin\swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
Box2D\Common\b2Math.h(67) : Warning 302: Identifier 'b2Vec2' redefined by %extend (ignored),
Box2D\Box2D_math.i(47) : Warning 302: %extend definition of 'b2Vec2'.
Box2D\Common\b2Math.h(158) : Warning 302: Identifier 'b2Vec3' redefined by %extend (ignored),
Box2D\Box2D_math.i(168) : Warning 302: %extend definition of 'b2Vec3'.
Box2D\Common\b2Math.h(197) : Warning 302: Identifier 'b2Mat22' redefined by %extend (ignored),
Box2D\Box2D_math.i(301) : Warning 302: %extend definition of 'b2Mat22'.
Box2D\Common\b2Math.h(271) : Warning 302: Identifier 'b2Mat33' redefined by %extend (ignored),
Box2D\Box2D_math.i(372) : Warning 302: %extend definition of 'b2Mat33'.
Box2D\Collision\b2DynamicTree.h(44) : Warning 312: Nested union not currently supported (ignored).
Box2D\Common\b2Settings.h(144) : Warning 506: Can't wrap varargs with keyword arguments enabled
Box2D\Common\b2Math.h(91) : Warning 509: Overloaded method b2Vec2::operator ()(int32) effectively ignored,
Box2D\Common\b2Math.h(85) : Warning 509: as it is shadowed by b2Vec2::operator ()(int32) const.
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\box2d
creating build\temp.win-amd64-3.7\Release\box2d\dynamics
creating build\temp.win-amd64-3.7\Release\box2d\dynamics\contacts
creating build\temp.win-amd64-3.7\Release\box2d\dynamics\joints
creating build\temp.win-amd64-3.7\Release\box2d\common
creating build\temp.win-amd64-3.7\Release\box2d\collision
creating build\temp.win-amd64-3.7\Release\box2d\collision\shapes
C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -c Box2D\Box2D_wrap.cpp -o build\temp.win-amd64-3.7\Release\box2d\box2d_wrap.o -I.
Box2D\Box2D_wrap.cpp: In function 'bool b2CheckVertices(b2Vec2*, int32, bool)':
Box2D\Box2D_wrap.cpp:3760:16: warning: variable 'm_centroid' set but not used [-Wunused-but-set-variable]
b2Vec2 m_centroid = __b2ComputeCentroid(vertices, count);
^
<lots of errors from Box2D_wrap.cpp>
^
error: command 'C:\\Users\\me\\AppData\\Local\\Continuum\\anaconda3\\envs\\COBRA\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"'; __file__='"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\me\AppData\Local\Temp\pip-record-7ni40amu\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
(MyEnv) C:\Users\me>
I get compiler errors when following the instructions from the pybind11 docs for the example build housed at https://github.com/pybind/python_example
The instructions are (1) clone the repo, and (2) pip3 install ./python_example.
I'm on OS X (Mojave) with python 3.7.3 and
c++ --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I'm very new to python packages and to pybind11, so I'm more than a little lost and would appreciate newbie guidance. It looks like the errors have to do with implementations for C++ operator new and delete.
If so, I'm confident that I'm not the first person to have this issue and would appreciate a pointer to a solution.
I followed the steps given on the github repo:
Cloning into 'python_example'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 132 (delta 4), reused 11 (delta 4), pack-reused 119
Receiving objects: 100% (132/132), 31.03 KiB | 373.00 KiB/s, done.
Resolving deltas: 100% (62/62), done.
$ pip3 install ./python_example/
Here is the full output. Is something in the repo misconfigured (I did no configuration)? Is this a python version thing? A missing compiler flag? If I distribute code using this setup as a template, is there anything I need to do to increase portability? I'm a little worried that the "hello world" example has me on stack overflow! Thanks in advance for any help.
Processing ./python_example
Requirement already satisfied: pybind11>=2.3 in /usr/local/lib/python3.7/site-packages (from python-example==0.0.1) (2.3.0)
Building wheels for collected packages: python-example
Building wheel for python-example (setup.py) ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-wheel-fk0w8_oq --python-tag cp37:
running bdist_wheel
running build
running build_ext
creating var
creating var/folders
creating var/folders/7l
creating var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn
creating var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpag19sot6.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpag19sot6.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpf327436e.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpf327436e.o -fvisibility=hidden
building 'python_example' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include/python3.7m -I/Users/stevescott/Library/Python/3.7/include/python3.7m -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/main.cpp -o build/temp.macosx-10.14-x86_64-3.7/src/main.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="0.0.1" -std=c++17 -fvisibility=hidden
In file included from src/main.cpp:1:
In file included from /usr/local/include/python3.7m/pybind11/pybind11.h:49:
In file included from /usr/local/include/python3.7m/pybind11/attr.h:13:
/usr/local/include/python3.7m/pybind11/cast.h:579:34: error: aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on macOS 10.14 or newer
vptr = ::operator new(type->type_size,
^
/usr/local/include/python3.7m/pybind11/cast.h:579:34: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1009:9: error: no matching function for call to 'operator delete'
::operator delete(p, s, std::align_val_t(a));
^~~~~~~~~~~~~~~~~
note: candidate function not viable: requires 2 arguments, but 3 were provided
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 3 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1011:9: error: call to unavailable function 'operator delete': introduced in macOS 10.12
::operator delete(p, s);
^~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function has been explicitly made unavailable
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 2 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
3 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for python-example
Running setup.py clean for python-example
Failed to build python-example
Installing collected packages: python-example
Running setup.py install for python-example ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-record-yvb3nloo/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpkd6a1ugc.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpkd6a1ugc.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpywf858_h.cpp -o var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/tmpywf858_h.o -fvisibility=hidden
building 'python_example' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include/python3.7m -I/Users/stevescott/Library/Python/3.7/include/python3.7m -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/main.cpp -o build/temp.macosx-10.14-x86_64-3.7/src/main.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="0.0.1" -std=c++17 -fvisibility=hidden
In file included from src/main.cpp:1:
In file included from /usr/local/include/python3.7m/pybind11/pybind11.h:49:
In file included from /usr/local/include/python3.7m/pybind11/attr.h:13:
/usr/local/include/python3.7m/pybind11/cast.h:579:34: error: aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on macOS 10.14 or newer
vptr = ::operator new(type->type_size,
^
/usr/local/include/python3.7m/pybind11/cast.h:579:34: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1009:9: error: no matching function for call to 'operator delete'
::operator delete(p, s, std::align_val_t(a));
^~~~~~~~~~~~~~~~~
note: candidate function not viable: requires 2 arguments, but 3 were provided
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function not viable: requires 2 arguments, but 3 were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 3 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
In file included from src/main.cpp:1:
/usr/local/include/python3.7m/pybind11/pybind11.h:1011:9: error: call to unavailable function 'operator delete': introduced in macOS 10.12
::operator delete(p, s);
^~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:190:74: note: candidate function has been explicitly made unavailable
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:221:40: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:188:36: note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
^
note: candidate function not viable: no known conversion from 'pybind11::size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:187:36: note: candidate function not viable: requires single argument '__p', but 2 arguments were provided
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
^
3 errors generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-record-yvb3nloo/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/7l/5r4qgkms4vb3xm6ktxdvh1l80000gn/T/pip-req-build-9f8udd0w/
I ran into the same issue with my pybind11 project on Mac OS.
I haven't been able to figure it out the root cause, but found a workaround: I disabled the C++17 cpp flag by removing the -std=c++17 from the list here.
Therefore instead of receiving the same errors that you mentioned, I got them as warnings. It's not a proper solution, and I really like to see a real explanation for this, but at least I have my source code compiled.
Update:
As eudoxos pointed out in his comment they opened an issue on pybind11's github page related to this and the fix should be in the next release.
Keep getting this error while trying to install mysql-python on osx version 10.12.3 and i get the same error even when using virtualenv. installed mysql using brew (mysql Ver 14.14 Distrib 5.7.17, for osx10.12 (x86_64)) and version of setuptools is 18.5
sudo pip install mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ihGRLH/mysql-python/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-5ktJF8-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb
creating build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.12-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.12-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.17/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.12-intel-2.7/_mysql.o -fno-omit-frame-pointer
_mysql.c:287:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
cmd_argc = PySequence_Size(cmd_args);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:317:12: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
groupc = PySequence_Size(groups);
~ ^~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:470:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
int j, n2=PySequence_Size(fun);
~~ ^~~~~~~~~~~~~~~~~~~~
_mysql.c:1127:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = mysql_real_escape_string(&(self->connection), out, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1129:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = mysql_escape_string(out, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1168:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
size = PyString_GET_SIZE(s);
~ ^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note: expanded from macro 'PyString_GET_SIZE'
#define PyString_GET_SIZE(op) Py_SIZE(op)
^~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
_mysql.c:1178:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = mysql_real_escape_string(&(self->connection), out+1, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1180:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = mysql_escape_string(out+1, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1274:11: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
if ((n = PyObject_Length(o)) == -1) goto error;
~ ^~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note: expanded from macro 'PyObject_Length'
#define PyObject_Length PyObject_Size
^
_mysql.c:1466:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1468:10: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1504:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1506:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
14 warnings generated.
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.7.17/include/mysql/my_config.h:172:9: warning: 'SIZEOF_LONG' macro redefined [-Wmacro-redefined]
#define SIZEOF_LONG 8
^
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:54:17: note: previous definition is here
# define SIZEOF_LONG 4
^
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.7.17/include/mysql/my_config.h:177:9: warning: 'SIZEOF_TIME_T' macro redefined [-Wmacro-redefined]
#define SIZEOF_TIME_T 8
^
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:57:17: note: previous definition is here
# define SIZEOF_TIME_T 4
^
_mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
3 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.7.17/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.12-intel-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ihGRLH/mysql-python/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-5ktJF8-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-ihGRLH/mysql-python/
I meet the same error on MacOS.
Solved with the following steps:
Step 1. Make sure you have installed openssl with homebrew.
brew install openssl
Step 2. In a terminal:
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
The environments are Cent OS 6.7, boost-1.6.2, gcc-6.2.0
I have tried to install a software, but I got some errors.
Are theses errors come from g++ ? or boost?
I can't understand these messages.. because I have never been use g++..
Here is starting line.
[root#cms CASMcode-0.2.0]# scons install
scons: Reading SConscript files ...
rm /usr/local/include/casm
scons: done reading SConscript files.
scons: Building targets ...
Install directory: "include/casm" as "/usr/local/include/casm"
/usr/local/gcc-6.2/bin/g++-6.2 -o src/casm/version/version.os -c -DNDEBUG -O3 --std=c++11 -Wno-deprecated-register -Wno-deprecated-declarations -DEIGEN_DEFAULT_DENSE_INDEX_TYPE=long -Wno-unused-parameter -DNDEBUG -O3 -DGZSTREAM_NAMESPACE=gz -fPIC -Iinclude src/casm/version/version.cc
/usr/local/gcc-6.2/bin/g++-6.2 -o src/casm/clex/ConfigIOStrucScore.os -c -DNDEBUG -O3 --std=c++11 -Wno-deprecated-register -Wno-deprecated-declarations -DEIGEN_DEFAULT_DENSE_INDEX_TYPE=long -Wno-unused-parameter -DNDEBUG -O3 -DGZSTREAM_NAMESPACE=gz -fPIC -Iinclude -I/usr/local/boost_1_62_0/include src/casm/clex/ConfigIOStrucScore.cc
In file included from include/casm/external/Eigen/Core:263:0,
from include/casm/external/Eigen/Dense:1,
from include/casm/CASM_global_definitions.hh:13,
from include/casm/casm_io/EigenDataStream.hh:3,
from src/casm/clex/ConfigIOStrucScore.cc:3:
Error message appear here.
In file included from include/casm/casm_io/DataFormatterTools.hh:1291:0,
from include/casm/casm_io/DataFormatter_impl.hh:3,
from include/casm/casm_io/DataFormatter.hh:757,
from include/casm/clex/ConfigIO.hh:4,
from src/casm/clex/ConfigIOStrucScore.cc:6:
include/casm/casm_io/DataFormatterTools_impl.hh: In member function 'bool CASM::DataFormatterOperator<ValueType, ArgType, DataObject>::parse_args(const string&)':
include/casm/casm_io/DataFormatterTools_impl.hh:33:33: error: invalid initialization of reference of type 'const wstring& {aka const std::__cxx11::basic_string<wchar_t>&}' from expression of type 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}'
val = std::stod(ttag);
^
And here
In file included from include/casm/clex/PrimClex.hh:14:0,
from include/casm/clex/ConfigIOStrucScore.hh:6,
from src/casm/clex/ConfigIOStrucScore.cc:7:
include/casm/clex/ChemicalReference.hh: In member function 'void CASM::ChemicalReferencePrinter::print(const std::vector<CASM::ChemicalReferenceState>&)':
include/casm/clex/ChemicalReference.hh:366:27: error: 'round' is not a member of 'std'
if(almost_equal(std::round(num), num, 1e-14)) {
^~~
I'm using Mac OS X 10.9. I have already installed graphviz 2.36.0.
After downloading pygraphviz 1.2, I modified in setup.py the variables "library_path" and "include_path":
library_path='/usr/local/lib/graphviz'
include_path='/usr/local/include/graphviz'
When I try to install graphviz with python setup.py install, I get the following message:
library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/usr/local/include/graphviz -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2040:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2043:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2829:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(val);
~ ^~~~~~~~~~~
pygraphviz/graphviz_wrap.c:2855:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
return agattr(g, kind, name, val);
^~~~~~~~~~~~~~~~~~~~~~~~~~
pygraphviz/graphviz_wrap.c:2847:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen(val);
~ ^~~~~~~~~~~
pygraphviz/graphviz_wrap.c:4806:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
6 warnings generated.
pygraphviz/graphviz_wrap.c:2040:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2043:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
pygraphviz/graphviz_wrap.c:2855:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
return agattr(g, kind, name, val);
^~~~~~~~~~~~~~~~~~~~~~~~~~
pygraphviz/graphviz_wrap.c:4806:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
4 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o -L/usr/local/lib/graphviz -L/usr/local/lib/graphviz -lcgraph -lcdt -o build/lib.macosx-10.9-intel-2.7/pygraphviz/_graphviz.so
ld: library not found for -lcgraph
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Does anybody know how I can fix this?
Make sure your XCode is updated to the latest version and then try this:
xcode-select --install
When prompted install the command line tools. Then try rebuilding.