Import error in Rec Model

I'm getting the error "cannot import name moduleTNC" when I try to import the recmodel_client in a Python script.  It had been working fine until last week.  Any suggestions?  Thanks.


  • jdouglassjdouglass Administrator, NatCap Staff
    HI @panellio, could you include the full text of the exception including the traceback?  That'll help a ton with pinpointing where the error is occurring.

  • paniellopaniello Member
    Hi James, thanks for the response, here's the full text of the exception:

    Traceback (most recent call last):
      File "X:/GIS_PROJECTS/NATIONAL/ParkServe/CustomProjects/UW_NatCap/", line 1, in <module>
        import natcap.invest.recreation.recmodel_client
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\natcap\invest\", line 8, in <module>
        import natcap.invest.pygeoprocessing_0_3_3
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\natcap\invest\pygeoprocessing_0_3_3\", line 9, in <module>
        from geoprocessing import *
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\natcap\invest\pygeoprocessing_0_3_3\", line 24, in <module>
        import scipy.interpolate
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\interpolate\", line 175, in <module>
        from .interpolate import *
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\interpolate\", line 21, in <module>
        import scipy.special as spec
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\special\", line 648, in <module>
        from ._ellip_harm import ellip_harm, ellip_harm_2, ellip_normal
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\special\", line 7, in <module>
        from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm
      File "_ellip_harm_2.pyx", line 7, in init scipy.special._ellip_harm_2
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\integrate\", line 93, in <module>
        from ._bvp import solve_bvp
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\integrate\", line 11, in <module>
        from scipy.optimize import OptimizeResult
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\optimize\", line 241, in <module>
        from ._minimize import *
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\optimize\", line 33, in <module>
        from .tnc import _minimize_tnc
      File "C:\Users\pete.aniello\PycharmProjects\test1\venv5\lib\site-packages\scipy\optimize\", line 37, in <module>
        from scipy.optimize import moduleTNC, approx_fprime
    ImportError: cannot import name moduleTNC
  • jdouglassjdouglass Administrator, NatCap Staff
    Hmm, this looks like there's an issue with one of the submodules from the scipy package.  I wonder if a recent package upgrade or downgrade in your virtual environment might have caused something to break.  In any case, could you try reinstalling scipy and see if that happens to fix the issue?

  • paniellopaniello Member
    Good call James...upgraded scipy from 1.0 to 1.1 and it works now.  Thanks!
This discussion has been closed.