Dear Dr. Oskooi,

Thank you for your great work.
I have met two problems when I installed PyMeep following your script.

1) In my Arch linux system, swig of version 3.0.12 is installed.
Swig >= 3.09 seems not support renaming the generated meep.py as __init__.py, and the following error message was shown when running files in meep/python/tests.

------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/meep/__init__.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named '_meep'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tests/3rd_harm_1d.py", line 4, in <module>
    import meep as mp
  File "/usr/local/lib/python3.6/site-packages/meep/__init__.py", line 17, in <module>
    _meep = swig_import_helper()
  File "/usr/local/lib/python3.6/site-packages/meep/__init__.py", line 16, in swig_import_helper
    return importlib.import_module('_meep')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_meep'
------------------------------------------------------------------------------------------------

This relates the swig issue [https://github.com/swig/swig/issues/769].
A workaround is to edit __init__.py as suggested in [https://github.com/swig/swig/pull/1105]:

------------------------------------------------------------------------------------------------
--- __init__.py.orig    2017-12-06 10:49:48.054412987 +0900
+++ __init__.py    2017-12-06 10:51:04.182548303 +0900
@@ -8,7 +8,8 @@
 if _swig_python_version_info >= (2, 7, 0):
     def swig_import_helper():
         import importlib
-        pkg = __name__.rpartition('.')[0]
+        pkg_parts = __name__.rpartition('.')
+        pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]
         mname = '.'.join((pkg, '_meep')).lstrip('.')
         try:
             return importlib.import_module(mname)
------------------------------------------------------------------------------------------------

2) With the above workaound, all tests passed except tests/wvg_src.py:

--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 0 on node gromit exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------
FAIL tests/wvg_src.py (exit status: 139)


With best regards,

Munehiro Nishida

On 2017年12月05日 08:33, Ardavan Oskooi wrote:

Dear Meep community:

We have prepared an installation shell script <http://ab-initio.mit.edu/%7Eoskooi/meep_discuss/build_meep_python_mpi.sh> for parallel PyMeep on Ubuntu 16.04. This involves building OpenMPI and HDF5 from source and linking it with the Python library mpi4py. Most of the Python tutorial examples have been added to the documentation <http://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/>. These scripts can be found in the python/examples <https://github.com/stevengj/meep/tree/master/python/examples> subdirectory of the source.

The official release of PyMeep including additional updates to the documentation will happen later this month. In the meantime, we welcome your comments and feedback; particularly bug reports.

Cordially,

Ardavan Oskooi



_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to