gempy
gempy copied to clipboard
ImportError: cannot import name 'Iterable' from 'collections'
Hello, I’ve installed gempy using pip on Ubuntu22. I was wondering if you could advise me on how to solve the following error which happens when I import it :
Traceback (most recent call last):
File "
I’ve installed gempy using conda as well. But the same import error happens. I'd be grateful, if you could help.
That's been fixed and merged in PR #686 . It hasn't made its way to pip yet, but you could use the github master as working with gempy.
Thank you for your response. I've used the github master, but a new error happened: AttributeError: module 'numpy.distutils.config' has no attribute 'blas_opt_info'.
Thank you for your help.
what is your numpy version? Can you provide an output of your environment you're using Gempy in?
I'm running GemPy on Ubuntu 2022 installed on VirtualBox, and I'm using numpy 1.23.0. Thank you.
numpy 1.23.0 is a very recent development (1 week old), so there might be changes, which affect gempy. To ensure properly running of gempy, better ensure to run numpy 1.22.x (e.g. I have 1.22.2 running).
OK. Thank you. I'll try numpy 1.22. It might be worth mentioning that, I have tried to install Gempy twice in two different virtual Ubuntus, on separate conda envs, but every time after installing Gempy, the Qt platform was removed. As a result, any plotting with Matplotlib was crashed and this warning was produced:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped).
Thanks.
That's a linux specific problem, not caused by gempy. On the new Ubuntu 22, wayland is the default. Might maybe help to set this back to xorg https://stackoverflow.com/questions/69828508/warning-ignoring-xdg-session-type-wayland-on-gnome-use-qt-qpa-platform-wayland
Hi @Japhiolite , I am using a python3.10 virtual env and I encounter the same error as above:
(python39env) gb4018@titaros:~/workspace/environments$ python3
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gempy as gp
No module named 'osgeo'
Not subsurface compatibility available
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/gb4018/workspace/environments/python39env/lib/python3.10/site-packages/gempy/__init__.py", line 25, in <module>
from gempy.gempy_api import *
File "/home/gb4018/workspace/environments/python39env/lib/python3.10/site-packages/gempy/gempy_api.py", line 17, in <module>
from gempy.core.model import Project
File "/home/gb4018/workspace/environments/python39env/lib/python3.10/site-packages/gempy/core/model.py", line 17, in <module>
from gempy.core.interpolator import InterpolatorModel, InterpolatorGravity
File "/home/gb4018/workspace/environments/python39env/lib/python3.10/site-packages/gempy/core/interpolator.py", line 1, in <module>
from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
>>>
I tried several numpy versions (1.21.0, 1.21.6) but I still fail to import gempy. Is there any combination guaranteed to work?
I am interested in installing gempy as a pip package alongside another project. I do not care if gempy requirements override mine (almost nothing in common apart from numpy which we can support a wide range of versions)
Thanks George
Hi @georgebisbas
Iterable
was removed from collections
with Python 3.10. So that's where the error is coming from. I'll re-check the next days, how vital that import is...I remember, that it was kinda obsolete.
I've GemPy working with Py 3.8, 3.9. So in the meantime, any env with those versions should work.
Anyhow, with 3.10 we'll solve this in the near future.
Hello,
I managed to install GemPy with python 3.8 successfully. Thank you.