HomerReid / scuff-em

A comprehensive and full-featured computational physics suite for boundary-element analysis of electromagnetic scattering, fluctuation-induced phenomena (Casimir forces and radiative heat transfer), nanophotonics, RF device engineering, electrostatics, and more. Includes a core library with C++ and python APIs as well as many command-line applications.
http://www.homerreid.com/scuff-em
GNU General Public License v2.0
128 stars 51 forks source link

Problem installing Python API #235

Open jiveshsem opened 3 years ago

jiveshsem commented 3 years ago

I followed the steps mentioned on the homepage

http://homerreid.github.io/scuff-em-documentation/reference/Installing/#2-installing-on-debianubuntu-based-linux-systems

I installed python-dev through the command

% sudo apt-get install libopenblas-dev libhdf5-openmpi-dev python-dev python3-scipy gmsh

and then the next set of commands

% git clone https://github.com/HomerReid/scuff-em.git
% cd scuff-em
% sh autogen.sh --prefix=${HOME}/scuff-em-installation
% make -j 8 install

Now I have two folders: scuff-em and scuff-em-installation

In scuff-em, there is a libs folder, with python subfolder. I did a "make" there and then a "make install". I get the scuff.py file. But when I import scuff in python (not python3) while in that subfolder, I get the ImportError: _scuff not found. And _scuff is the C library that links to Python.

In scuff-em-installation, there is a lib subfolder, but that does not have many files, and the libscuff.a and libscuff.la files that it does have - I don't know what I can do to get the scuff.py or _scuff module out of it.

I have been trying to look for solutions on installing scuff-em API for Python (or even C), but I didn't get much help online, so I had to report this issue here. Thank you.

EDIT: I checked the config.log file in scuff-em folder. There is an error thrown by conftest.cpp:

conftest.cpp:41:10: fatal error: numpy/arrayobject.h: No such file or directory
   41 | #include <numpy/arrayobject.h>
        |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I have checked and even tried to install numpy all over again: but whether I try pip install numpy or pip3 install numpy it gives me the same message:

Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (1.20.1)

EDIT2: I was able to locate the source of the problem: from config.log, there was a compilation termination when trying to search for numpy/arrayobject.h. Even after installing python-dev this issue was not resolved. I manually found the numpy.get_include() pathway to arrayobject.h and modified the corresponding line in configure. At least now, there is NO compilation terminated in config.log *because of numpy/arrayobject.h (there are still 12 compilation terminated messages for C header files, but Python went through, so I was hoping this should've resolved it). BUT STILL, import scuff throws the ModuleNotFoundError: No module named '_scuff'. There is now a .deps folder in scuff-em/libs/python but it just has one file in it _scuff_la-scuff-python.Plo, with one line in the file: #dummy...

Further from the config.log:

| #include </home/tbit/.local/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h>
configure:15816: result: no
configure:15822: WARNING: disabling Python wrappers
configure:15855: checking tr1/unordered_map usability

so I am not sure if Python wrappers were installed or not.