keurfonluu / evodcinv

Inversion of dispersion curves using Evolutionary Algorithms
BSD 3-Clause "New" or "Revised" License
69 stars 29 forks source link

2): Symbol not found: _PyBytes_FromString #1

Closed marscfeng closed 6 years ago

marscfeng commented 6 years ago

Hi Dr. Luu,

I got an error when i tried to run example_dc.py. Do you have any idea how did this happen? I am using a macOS platform.

ImportError: dlopen(/Users/Mars/anaconda/lib/python3.6/site-packages/evodcinv-1.0.0-py3.6-macosx-10.7-x86_64.egg/evodcinv/_dispcurve.cpython-36m-darwin.so, 2): Symbol not found: _PyBytes_FromString Referenced from: /Users/Mars/anaconda/lib/python3.6/site-packages/evodcinv-1.0.0-py3.6-macosx-10.7-x86_64.egg/evodcinv/_dispcurve.cpython-36m-darwin.so Expected in: flat namespace in /Users/Mars/anaconda/lib/python3.6/site-packages/evodcinv-1.0.0-py3.6-macosx-10.7-x86_64.egg/evodcinv/_dispcurve.cpython-36m-darwin.so

keurfonluu commented 6 years ago

Hello @marscfeng,

A quick search on Google indicates that it seems to be a common problem on macOS. Unfortunately, I cannot reproduce this error as I don't have macOS. The package has only been tested on Windows and Unix systems.

A first guess may be that the Python you used to install the package is different from the version your interpreter is invoking. How did you install the package evodcinv?

marscfeng commented 6 years ago

Indeed. I have multiple python installed (python2.7/ python3.6), as well as anaconda. When i tried to install EvoDCinv with pip install evodcinv, it threw out some errors:

RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

So i downloaded the package and conda install python.app. Finally, i tried pythonw setup.py install and the installation worked out. But when i run pythonw(or python) example_dc.py, the Import Error about symbol not found occurs.

marscfeng commented 6 years ago

But i successfully run this code on Anaconda>Spyder. I wander why pythonw example_dc.py does not work.

keurfonluu commented 6 years ago

What does the command which pythonw (or which python) returns?

marscfeng commented 6 years ago
$ which pythonw(or python there're the same)
~/anaconda/bin/pythonw
keurfonluu commented 6 years ago

It seems your Anaconda installation is broken, somehow. You can try pip install . instead of python setup.py install (first make sure that which pip returns Anaconda's one).

marscfeng commented 6 years ago

broken? I am sorry about my last reply, which python returns ~/anaconda/bin/python not pythonw. And which pip indeed return Anaconda's pip. Anyway at least Spyder could run your package successfully. I do not want to wast your time for some untouched reasons. I am phd student who works on near-surface section. I check the true model you gave under /data, it looks wired (i mean uncommon for my section). Can i have your phd thesis to satisfy my curiosity?

keurfonluu commented 6 years ago

Are you using surface waves for geotechnical or geophysical problems? The true model I used as an example for this package presents a thin rapid layer, which is usually encountered in geophysical problems. I used this code to invert real dispersion curves obtained by ambient noise correlation. The paper is currently under review.

My PhD thesis is currently not available as I am not graduated yet...

marscfeng commented 6 years ago

Great! Yes, I work on passive & active seismic survey, mainly surface wave, for geophysical problems. It would be proved to be a good literature and i guess this package could also be able to solve LVL inversion problem. Good luck! Which Journal is that you submitted you paper? I would like to keep an eye on it.

keurfonluu commented 6 years ago

Actually, my research focuses on numerical optimization of inverse problems in geophysics. I worked on the inversion of dispersion curves as one of my colleague in my lab works on surface waves. The paper has been submitted to Geophysical Journal International, and the main authors are Marc Peruzzetto and Alexandre Kazantsev (@alexandrekazantsev).

If you have any question about how to use the package, don't hesitate to contact me again :)

marscfeng commented 6 years ago

thanks!