gmes
gmes copied to clipboard
Installation Python 3.6 on Linux Mint 19 Tara
HI. I just clone the repository to install this module in order to install it. The problem I get some building errors.
First, I tried to install after clone:
$ python3 setup.py install
running install
running build
running build_py
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/gmes
copying gmes/pw_source.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/source.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/geometry.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/file_io.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/fdtd.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/show.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/__init__.py -> build/lib.linux-x86_64-3.6/gmes
copying gmes/pw_material.py -> build/lib.linux-x86_64-3.6/gmes
running build_ext
building 'gmes._pw_material' extension
swigging src/pw_material.i to src/pw_material_wrap.cpp
swig -python -c++ -outdir gmes -o src/pw_material_wrap.cpp src/pw_material.i
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_material.cc -o build/temp.linux-x86_64-3.6/src/pw_material.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_drude.cc -o build/temp.linux-x86_64-3.6/src/pw_drude.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_cpml.cc -o build/temp.linux-x86_64-3.6/src/pw_cpml.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_const.cc -o build/temp.linux-x86_64-3.6/src/pw_const.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_upml.cc -o build/temp.linux-x86_64-3.6/src/pw_upml.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dcp.cc -o build/temp.linux-x86_64-3.6/src/pw_dcp.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dummy.cc -o build/temp.linux-x86_64-3.6/src/pw_dummy.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_lorentz.cc -o build/temp.linux-x86_64-3.6/src/pw_lorentz.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dm2.cc -o build/temp.linux-x86_64-3.6/src/pw_dm2.o -std=c++0x
In file included from src/pw_dm2.cc:1:0:
src/pw_dm2.hh: In function ‘double gmes::l2_norm(const T&, const std::vector<std::array<T, 3> >&)’:
src/pw_dm2.hh:60:17: error: ‘sqrt’ is not a member of ‘std’
return std::sqrt(accu);
^~~~
src/pw_dm2.hh:60:17: note: suggested alternative: ‘sort’
return std::sqrt(accu);
^~~~
sort
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Aftewards, including #include <cmath>
into src/pw_dm2.hh
for sqrt() support, I got the following:
$ python3 setup.py install
running install
running build
running build_py
copying gmes/pw_material.py -> build/lib.linux-x86_64-3.6/gmes
running build_ext
building 'gmes._pw_material' extension
swigging src/pw_material.i to src/pw_material_wrap.cpp
swig -python -c++ -outdir gmes -o src/pw_material_wrap.cpp src/pw_material.i
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_material.cc -o build/temp.linux-x86_64-3.6/src/pw_material.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_drude.cc -o build/temp.linux-x86_64-3.6/src/pw_drude.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_cpml.cc -o build/temp.linux-x86_64-3.6/src/pw_cpml.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_const.cc -o build/temp.linux-x86_64-3.6/src/pw_const.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_upml.cc -o build/temp.linux-x86_64-3.6/src/pw_upml.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dcp.cc -o build/temp.linux-x86_64-3.6/src/pw_dcp.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dummy.cc -o build/temp.linux-x86_64-3.6/src/pw_dummy.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_lorentz.cc -o build/temp.linux-x86_64-3.6/src/pw_lorentz.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dm2.cc -o build/temp.linux-x86_64-3.6/src/pw_dm2.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_dielectric.cc -o build/temp.linux-x86_64-3.6/src/pw_dielectric.o -std=c++0x
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/pw_material_wrap.cpp -o build/temp.linux-x86_64-3.6/src/pw_material_wrap.o -std=c++0x
In file included from /home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
from /home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from src/pw_material_wrap.cpp:3339:
/home/MyUser/.local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^~~~~~~
src/pw_material_wrap.cpp: In function ‘const char* pytype_string(PyObject*)’:
src/pw_material_wrap.cpp:3518:9: error: ‘PyFile_Check’ was not declared in this scope
if (PyFile_Check( py_obj)) return "file" ;
^~~~~~~~~~~~
src/pw_material_wrap.cpp:3518:9: note: suggested alternative: ‘PyCell_Check’
if (PyFile_Check( py_obj)) return "file" ;
^~~~~~~~~~~~
PyCell_Check
src/pw_material_wrap.cpp:3520:9: error: ‘PyInstance_Check’ was not declared in this scope
if (PyInstance_Check(py_obj)) return "instance" ;
^~~~~~~~~~~~~~~~
src/pw_material_wrap.cpp:3520:9: note: suggested alternative: ‘PySequence_Check’
if (PyInstance_Check(py_obj)) return "instance" ;
^~~~~~~~~~~~~~~~
PySequence_Check
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Any ideas on what to do? How to install properly?
I encountered the same issue and fixed it by adding #include<math.h> to src/pw_dm2.hh (not cmath.h) and then changeing return std::sqrt(accu); to return sqrt(accu);