Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import meep error with spyder #1565

Closed
Rub-Ric opened this issue May 6, 2021 · 2 comments
Closed

Import meep error with spyder #1565

Rub-Ric opened this issue May 6, 2021 · 2 comments

Comments

@Rub-Ric
Copy link

Rub-Ric commented May 6, 2021

Hello,

I am a new user of Meep and I am facing issues when importing meep.

I am using Spyder (with Python 3.8) in meep environment, but when I import the package (import meep as mp ) the following error occurs:

Traceback (most recent call last):

  File "<ipython-input-1-08e93272f3df>", line 1, in <module>
    runfile('/home/ruben/.config/spyder-py3/temp.py', wdir='/home/ruben/.config/spyder-py3')

  File "/usr/lib/python3/dist-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "/usr/lib/python3/dist-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/ruben/.config/spyder-py3/temp.py", line 10, in <module>
    import meep as mp

  File "/usr/lib/python3/dist-packages/meep/__init__.py", line 2600, in <module>
    class dft_ldos(object):

  File "/usr/lib/python3/dist-packages/meep/__init__.py", line 2639, in dft_ldos
    __swig_getmethods__["freq_min"] = get_omega_min

NameError: name '__swig_getmethods__' is not defined

From #965 it seems that the issue is solved, but it is not the case for me. I tried modifying the relevant file (init.py) but it is read-only. I am on Ubuntu 20.04.2 LTS, if that matters.

Thanks in advance!

@Rub-Ric Rub-Ric changed the title Import meep error with Import meep error with spyder May 6, 2021
@oskooi
Copy link
Collaborator

oskooi commented May 7, 2021

You may be using an older version of Meep which does not support SWIG 4.0 (added in #1159 and version 1.14.0). Assuming you haven't tried to build from source and installed things into your system directory (which could create conflicts with the dependencies when trying to install elsewhere), can you try installing Meep version 1.18 using the Conda package?

@Rub-Ric
Copy link
Author

Rub-Ric commented May 17, 2021

Thanks for the answer!

I re-installed Meep with Conda (and SWIG as well, just to be sure) and it is now working with Jupyter Notebook, but still not with Spyder. This is fine for me as far as I am concerned, as I don't mind either of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants