victorliu / S4

Stanford Stratified Structure Solver - Electromagnetic simulator for layered periodic structures
http://www.stanford.edu/group/fan/S4/
GNU General Public License v2.0
131 stars 149 forks source link

New Simulation Attribute Not Found In Python shared object #75

Open 123Abelian opened 6 years ago

123Abelian commented 6 years ago

Whenever I go to execute a script on an Amazon AWS notebook involving S4, I get the error:

AttributeError: module 'S4' has no attribute 'NewSimulation' as well as AttributeError: module 'S4' has no attribute 'New' and any permutation of the two. I even confirmed that "New" was the name of the initialization method from the main python file, so I don't know what could possibly be happening. Here's the context below:

import S4 import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Conv2D, Flatten, InputLayer, Input, Reshape, MaxPooling2D, UpSampling2D import numpy as np from pprint import pprint

all_xs = [] all_ys = [] test_xs = [] test_ys = []

arraylist = [] coefflist = [] for x1 in np.arange(0.1, 1.3, 0.01): for x2 in np.arange(0.1, 1.3, 0.01): S = S4.New(Lattice = ((1, 0), (0, 1)), NumBasis=5) (rest has to be held back for the sake of privacy)

Any ideas on what could be causing the problem?

Chronum94 commented 6 years ago

It appears that the porting of the old API to the new one never really completed. I've personally worked around this by hacking together Lua and Python scripts.

kwrobert commented 6 years ago

My fork compiles and runs on Ubuntu 16.04 (x86 processor, not sure if that matters) and is fully compatible with Python3.5. I've been using it without any issues, feel free to give it a try and reach out to me if you have any problems with it.

It requires a lot of dependent libraries to compile and run. To get those installed, just install all the packages discussed here and you should be good to go.

With that up and running, to compile run:

make clean
make boost
make 
make S4_pyext

hopefully that runs without any failures. Good luck!

quentintanguy commented 4 years ago

@kwrobert I compiled that way and it stills display the same error: module 'S4' has no attribute 'NewSimulation'. I installed all dependencies as listed in https://web.stanford.edu/group/fan/S4/install.html except Posix and MPI and I compiled OpenBLAS dependency using 'make'. In S4 Makefile.common line 142: python setup.py build produced an error since only python3 was installed on my Linux distribution. I installed python-dev-is-python2 package and the error was not reiterated upon build. However, I am unable to run S4 under python/python2, it requires python3. May that cause some error as well? If you can help any way, I would really appreciate.