gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
346 stars 131 forks source link

Polite request: Anaconda and pyGimli #67

Closed L120P closed 5 years ago

L120P commented 6 years ago

Hi, I apologize for the disturbance. I am using pyGimli and pyBERT python modules. The modules work well until I have updated pyGimly with the command "conda update -c gimli -f pygimli".Since that time I have an error when I run the codes. For example, for the code:

world = plc.createWorld(start=[-50, 0], end=[50, -50],layers=[-1, -5], worldMarker=True)

block = plc.createCircle(pos=[0, -3.], radius=1, marker=4, boundaryMarker=10, area=0.1)

geom = plc.mergePLC([world, block])

pg.show(geom)

I have the error:

Traceback (most recent call last):

File "", line 1, in pg.show(geom)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/viewer/showmesh.py", line 79, in show return showMesh(mesh, data, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/viewer/showmesh.py", line 204, in showMesh drawMesh(ax, mesh, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/mplviewer/meshview.py", line 191, in drawMesh pg.mplviewer.drawMeshBoundaries(ax, mesh, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/mplviewer/meshview.py", line 473, in drawMeshBoundaries drawPLC(ax, mesh, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/mplviewer/meshview.py", line 511, in drawPLC snap=True)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/mplviewer/meshview.py", line 249, in drawModel cmap=cmap, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/mplviewer/meshview.py", line 713, in drawMPLTri **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 7686, in tripcolor return mtri.tripcolor(self, *args, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/matplotlib/tri/tripcolor.py", line 71, in tripcolor tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/matplotlib/tri/triangulation.py", line 165, in get_from_args_and_kwargs triangulation = Triangulation(x, y, triangles, mask)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/matplotlib/tri/triangulation.py", line 42, in init self.x = np.asarray(x, dtype=np.float64)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/numpy/core/numeric.py", line 482, in asarray return array(a, dtype, copy=False, order=order)

File "/home/lucia/anaconda3/lib/python3.6/site-packages/pygimli/core/init.py", line 630, in RVectorArrayCall return self.array()

SystemError: <Boost.Python.function object at 0x30fe430> returned a result with an error set

I have the same error even when I try to invert synthetic data or experimental data. I don't know how to continue, since I can't reinstall the old version and so I would be very grateful if someone can help me. I again apologize for the disturbance and I thank you in advance.

florian-wagner commented 6 years ago

Hey @L120P,

no reason to apologize. The conda packages are broken at the moment. I'll try to fix it asap and let you know when they are working again.

Best wishes Florian

L120P commented 6 years ago

Ok, thank you for your prompt answer and kindness!

All the best, Lucia

florian-wagner commented 6 years ago

Hey Lucia,

can you try the following in a linux terminal please:

# Get rid of old installation
conda uninstall -y pygimli pybert
conda clean -ya

# Add gimli and conda-forge channel
conda config --add channels gimli --add channels conda-forge
conda install -fy pygimli pybert python=3.6

# Test pygimli
wget http://www.pygimli.org/_downloads/plot_mod-dc-2d.py -O test.py
python test.py

# Test bert
cd ~/miniconda3/share/examples/inversion/2dflat/gallery
bert gallery.cfg all
bert gallery.cfg show
L120P commented 6 years ago

Hi Florian, when I write conda config --add channels gimli --add channels conda-forge I have: Warning: 'gimli' already in 'channels' list, moving to the top Warning: 'conda-forge' already in 'channels' list, moving to the top.

Then I write: conda install -fy pygimli pybert python=3.6 I have the error: UnsatisfiableError: The following specifications were found to be in conflict:

florian-wagner commented 6 years ago

This is due to https://github.com/ContinuumIO/anaconda-issues/issues/1068 and not gimli related. anaconda-navigator needs pyqt5, whereas matplotlib currently only works with pyqt4 in conda.

You have two options:

I'll leave this open as a reminder that we remove the pyqt4 dependency once https://github.com/ContinuumIO/anaconda-issues/issues/1068 is solved.

L120P commented 6 years ago

Hi, just this morning I thought that the problem could be with conda and not with gimli. However, I have used the second option suggested from you and the codes run! Thank you so much for your help!

All the best, Lucia

florian-wagner commented 6 years ago

Happy to hear that it works. You can also run the existing tests with python -c "import pygimli; pygimli.test(show=True)" or download the more sophisticated examples from www.pygimli.org.

Don't forget to activate the pg environment everytime you want to work with pygimli. To do it automatically, you can add these two lines:

export PATH=/home/lucia/anaconda3/bin:$PATH
source activate pg

to your ~/.bashrc file.

Have a nice weekend, Florian

halbmy commented 6 years ago

Seems like everything is alright and the issue can be closed.

florian-wagner commented 6 years ago

Claudio had the same issue today.

I'll leave this open as a reminder that we remove the pyqt4 dependency once ContinuumIO/anaconda-issues#1068 is solved.

ayaknak commented 6 years ago

Hello Florian, Have a issue after installing make: ** [all] Error 2 anemias@Qi-Invert:~/src/gimli/build$ python -c 'import pygimli as pg; print(pg.version())' No module named pygimli Traceback (most recent call last): File "/home/anemias/src/gimli/gimli/python/pygimli/core/init.py", line 33, in from . pygimli import ImportError: No module named pygimli ERROR: cannot import the library 'pygimli'. Traceback (most recent call last): File "", line 1, in File "/home/anemias/src/gimli/gimli/python/pygimli/init.py", line 29, in from . import core File "/home/anemias/src/gimli/gimli/python/pygimli/core/init.py", line 54, in swatch = pygimli.Stopwatch() AttributeError: 'NoneType' object has no attribute 'Stopwatch'

compiling error

src/CMakeFiles/gimli.dir/build.make:206: recipe for target 'src/CMakeFiles/gimli.dir/gimli.cpp.o' failed make[2]: [src/CMakeFiles/gimli.dir/gimli.cpp.o] Error 1 make[2]: Leaving directory '/home/anemias/src/gimli/build' CMakeFiles/Makefile2:538: recipe for target 'src/CMakeFiles/gimli.dir/all' failed make[1]: [src/CMakeFiles/gimli.dir/all] Error 2 make[1]: Leaving directory '/home/anemias/src/gimli/build' Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

and the bin folder is empty ~/src/gimli/build$ tree bin/ bin/

0 directories, 0 files

I'm running on debian 9, python 2.7, hope you can help me Thanks Manuel

halbmy commented 6 years ago

How did you install pygimli? I guess with the curl script? Probably something went wrong in the build script...

Did you try installing pygimli with the conda package? That's far easier. Just take miniconda, create an environment and install everything you need into it... So you can also choose your Python version, note that we will (like many other packages) eventually drop Python 2 support ...

RandomForestGump commented 6 years ago

Hello everybody! I am using pygimli for my academic research. When I tried to install through .whl files available on the main site, I get this error when I try to import the library.

Please can anyone help with this, I am using python 3.6

AttributeError Traceback (most recent call last)

in () ----> 1 import pygimli C:\Users\cmm\Anaconda3\lib\site-packages\pygimli\__init__.py in () 16 import os 17 ---> 18 from . import core 19 from ._version import get_versions 20 from .core import * C:\Users\cmm\Anaconda3\lib\site-packages\pygimli\core\__init__.py in () 52 # showLater(0) # not working anymore 53 ---> 54 __swatch__ = _pygimli_.Stopwatch() 55 56 def tic(msg=None): AttributeError: 'NoneType' object has no attribute 'Stopwatch'
halbmy commented 6 years ago

Can you please try installing the MSI installer (where you can choose your Python installation that pygimli is installed in) instead? I just tried it for the newest Anaconda (5.0.1 with Python 3.6 for Win-64bit) and the newest pygimli msi (1.0.5) and it worked fine.

RandomForestGump commented 6 years ago

Thank you so much, a silly error on my part