3D SimPEG for Casing Modeling: cannot import name 'get_dlf_points' from 'empymod.transform'

Hi SimPEG developers and users,

My colleagues plan to use 3D SimPEG for casing modeling. They tried to install and use it based on the instructions found at GitHub - simpeg-research/heagy-2021-tle-casing but faced an error pasted below. When I installed this version of SimPEG several months ago, I was able to use it without trouble. How could we trouble-shoot this library issue? I would like to share the solution with my colleagues. In advance, thank you very much for your help.

Best Regards,
Evan


ImportError Traceback (most recent call last)
Cell In[1], line 12
10 import discretize
11 from discretize import utils
—> 12 from SimPEG.electromagnetics import time_domain as tdem
13 from SimPEG import utils, maps, Report
14 from pymatsolver import Pardiso

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\SimPEG\electromagnetics_init_.py:3
1 from scipy.constants import mu_0, epsilon_0
----> 3 from . import time_domain
4 from . import frequency_domain
5 from . import natural_source

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\SimPEG\electromagnetics\time_domain_init_.py:1
----> 1 from .simulation import (
2 Simulation3DMagneticFluxDensity,
3 Simulation3DElectricField,
4 Simulation3DMagneticField,
5 Simulation3DCurrentDensity,
6 )
7 from .fields import (
8 Fields3DMagneticFluxDensity,
9 Fields3DElectricField,
10 Fields3DMagneticField,
11 Fields3DCurrentDensity,
12 )
13 from .survey import Survey

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\SimPEG\electromagnetics\time_domain\simulation.py:10
8 from …utils import mkvc, sdiag, speye, Zero
9 from …base import BaseEMSimulation
—> 10 from .survey import Survey
11 from .fields import (
12 Fields3DMagneticFluxDensity,
13 Fields3DElectricField,
(…)
17 FieldsDerivativesHJ,
18 )
21 class BaseTDEMSimulation(BaseTimeSimulation, BaseEMSimulation):

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\SimPEG\electromagnetics\time_domain\survey.py:3
1 import properties
2 from …survey import BaseSurvey
----> 3 from .sources import BaseTDEMSrc
6 ####################################################
7 # Survey
8 ####################################################
11 class Survey(BaseSurvey):

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\SimPEG\electromagnetics\time_domain\sources.py:7
4 import warnings
5 from …utils.code_utils import deprecate_property
----> 7 from geoana.em.static import MagneticDipoleWholeSpace, CircularLoopWholeSpace
9 from …base import BaseEMSrc
10 from …utils import segmented_line_current_source_term, line_through_faces

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\geoana_init_.py:3
1 from . import utils
2 from . import earthquake
----> 3 from . import em
5 version = ‘0.4.0’
6 author = ‘SimPEG developers’

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\geoana\em_init_.py:25
1 “”"
2 =================================================
3 Base Electromagnetics (:mod:geoana.em)
(…)
22
23 “”"
24 from . import static
—> 25 from . import fdem
26 from . import tdem
27 from .base import BaseEM, BaseDipole, BaseElectricDipole, BaseMagneticDipole, BaseLineCurrent

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\geoana\em\fdem_init_.py:45
39 from geoana.em.fdem.wholespace import (
40 ElectricDipoleWholeSpace, MagneticDipoleWholeSpace, HarmonicPlaneWave
41 )
43 from geoana.em.fdem.halfspace import MagneticDipoleHalfSpace
—> 45 from geoana.em.fdem.layered import MagneticDipoleLayeredHalfSpace
47 from geoana.em.fdem.simple_functions import (
48 vertical_magnetic_field_horizontal_loop, vertical_magnetic_flux_horizontal_loop
49 )

File ~\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\geoana\em\fdem\layered.py:6
4 from scipy.constants import mu_0, epsilon_0
5 from empymod.utils import check_hankel
----> 6 from empymod.transform import get_dlf_points
7 from geoana.kernels.tranverse_electric_reflections import rTE_forward
10 class MagneticDipoleLayeredHalfSpace(BaseFDEM, BaseMagneticDipole):

ImportError: cannot import name ‘get_dlf_points’ from ‘empymod.transform’ (C:\Users\esum\Anaconda3\envs\heagy-2021-tle-casing\lib\site-packages\empymod\transform.py)

Hi @evan

That is odd, and from the top of my head I am not sure what is going wrong. Could you print the output of SimPEG.Report(['empymod'])? (Maybe you have to install scooby for it: either conda install -c conda-forge scooby or pip install scooby.)

Knowing what versions you have installed might give me some hints.

Dieter

Hi, posting here as I’m having the same error message.
I started a new Python 3.11.5 environment from scratch (Windows, Anaconda navigator) and installed simpeg using the command
conda install -c conda-forge simpeg which took about 4 hours to complete.
Now, when running the 3D Least Square Inversion of DCIP data notebook, I can’t get through the import cell and receive the error:
ImportError: cannot import name 'get_dlf_points' from 'empymod.transform' (c:\Users\...\anaconda3\envs\simpeg\Lib\site-packages\empymod\transform.py)
As you suggested the user above, I installed scooby and ran SimPEG.Report(['empymod']).
cython, vectormath and properties were not installed so I just did a conda install from conda-forge, reran SimPEG.Report(['empymod']) and here is the output:

Any idea of how to proceed?

Edit: The issue is with the version of empymod that is installed. There is indeed no get_dlf_pts function in my transform.py file. @prisae even after using conda update empymod, the version of empymod is 1.10.6.
Now trying to force an update to version 2.2.2.

Solved for me with conda install empymod=2.2.2

FYI, this triggered the following warning message:

The following NEW packages will be INSTALLED:

  future             conda-forge/noarch::future-0.18.3-pyhd8ed1ab_0
  llvmlite           conda-forge/win-64::llvmlite-0.40.1-py311h5bc0dda_0
  numba              conda-forge/win-64::numba-0.57.1-py311h2c0921f_0

The following packages will be UPDATED:

  empymod                                       1.10.6-py_0 --> 2.2.2-pyhd8ed1ab_0

The following packages will be SUPERSEDED by a higher-priority channel:

  geoana             conda-forge/win-64::geoana-0.5.0-py31~ --> conda-forge/noarch::geoana-0.0.6-py_1

The following packages will be DOWNGRADED:

  numpy                              1.26.0-py311h0b4df5a_0 --> 1.24.4-py311h0b4df5a_0
  simpeg                                0.18.1-pyhd8ed1ab_0 --> 0.17.0-pyhd8ed1ab_0

Hi @mdupont - I am glad you found a solution. I am not sure why the newest SimPEG installs such an old empymod. We will look into this. Thanks for reporting!

We’ve fixed the underlying issues with the version requirements, you should try conda-forge install with the SimPEG 0.20 version and let us know if it doesn’t work out!

1 Like

I have encountered the same problem when using from SimPEG.electromagnetics import frequency_domain as fdem
I have checked that the version of SimPEG is 0.20.0, and the version of empymod is 2.2.2.
ImportError: cannot import name ‘unpack_widths’ from ‘SimPEG.utils’

I have solved this question: the version of SimPEG is 0.18.0 and empymod is 2.2.2