Skip to content

Imp package is deprecated in Python 3.12 #5

Open

Description

@juvenalandres

Hello,

I've just installed your package and I ran into a problem importing the library.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 4
      1 # -----------------------
      2 # import all components of srfpython
      3 # -----------------------
----> 4 from srfpython import *

File [c:\users\j.andres\anaconda3\srfpython\srfpython\__init__.py:1](file:///C:/users/j.andres/anaconda3/srfpython/srfpython/__init__.py#line=0)
----> 1 from srfpython.Herrmann.Herrmann import check_herrmann_codes, recompile_src, HerrmannCaller, Curve
      2 from srfpython.depthdisp.depthmodels import depthmodel1D, depthmodel, depthmodel_from_mod96string, \
      3     depthmodel_from_mod96, depthmodel_from_arrays, depthspace, gardner74, brocher2005
      4 from srfpython.depthdisp.dispcurves import Claw, Ulaw, freqspace, \
      5     surf96reader, surf96reader_from_surf96string, surf96reader_from_arrays

File [c:\users\j.andres\anaconda3\srfpython\srfpython\Herrmann\Herrmann.py:10](file:///C:/users/j.andres/anaconda3/srfpython/srfpython/Herrmann/Herrmann.py#line=9)
      8 from numpy import log
      9 import numpy as np
---> 10 from srfpython.utils import Timer, TimeOutError, Timeout
     11 from srfpython.depthdisp.dispcurves import groupbywtm, igroupbywtm
     14 """
     15 program to compute surface wave dispersion curves, Maximilien Lehujeur, 01/11/2017
     16 see documentation in function dispersion
   (...)
     19 WARNING : This module calls fortran programs, make sure they are compiled correctly before calling
     20 """

File [c:\users\j.andres\anaconda3\srfpython\srfpython\utils.py:3](file:///C:/users/j.andres/anaconda3/srfpython/srfpython/utils.py#line=2)
      1 import time
      2 import signal
----> 3 import imp
      4 import os
      5 import sys

ModuleNotFoundError: No module named 'imp'

Seems that Imp has been deprecated as per the documentation. So if you create a new anaconda environment for instance you should be installing Python 3.11 to make the library work.

I believe this should be stated somewhere in the installation manual, until the code is upgraded to be compatible with Python 3.12

Activity

  1. added a commit that references this issue on Apr 18, 2024
  2. mlehujeur commented on Apr 18, 2024

    @mlehujeur
    Collaborator

    Thank you, I simply put an upper limit in the setup file. so that pip install should complain if python is >=3.12.
    I Still need to upgrade the corresponding functions for >=3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions