cython: Cython 0.29 cannot import 'pythran_is_numpy_func_supported'

After installing Cython 0.29 I was unable to run the line:

from Cython.Build.Inline import _get_build_extension

The full error message is below. It appears, for example, when calling pystan.

<ipython-input-4-468ee6613710> in <module>()
----> 1 import pystan
      2 overwrite=False
      3 nocov = '''
      4 functions {
      5     real bailerjones_lpdf(real r, real L){             //This is our distance prior

~/.local/lib/python3.6/site-packages/pystan/__init__.py in <module>()
      7 import logging
      8 
----> 9 from pystan.api import stanc, stan
     10 from pystan.misc import read_rdump, stan_rdump, stansummary
     11 from pystan.diagnostics import check_hmc_diagnostics

~/.local/lib/python3.6/site-packages/pystan/api.py in <module>()
     14 import pystan._api  # stanc wrapper
     15 from pystan._compat import string_types, PY2
---> 16 from pystan.model import StanModel
     17 
     18 logger = logging.getLogger('pystan')

~/.local/lib/python3.6/site-packages/pystan/model.py in <module>()
     30 
     31 import Cython
---> 32 from Cython.Build.Inline import _get_build_extension
     33 from Cython.Build.Dependencies import cythonize
     34 

~/.local/lib/python3.6/site-packages/Cython/Build/Inline.py in <module>()
     15 from ..Compiler.Main import Context, CompilationOptions, default_options
     16 
---> 17 from ..Compiler.ParseTreeTransforms import (CythonTransform,
     18         SkipDeclarations, AnalyseDeclarationsTransform, EnvTransform)
     19 from ..Compiler.TreeFragment import parse_from_strings

~/.local/lib/python3.6/site-packages/Cython/Compiler/ParseTreeTransforms.py in <module>()
     12 from . import PyrexTypes
     13 from . import Naming
---> 14 from . import ExprNodes
     15 from . import Nodes
     16 from . import Options

~/.local/lib/python3.6/site-packages/Cython/Compiler/ExprNodes.py in <module>()
     44 from .DebugFlags import debug_disposal_code, debug_temp_alloc, \
     45     debug_coercion
---> 46 from .Pythran import (to_pythran, is_pythran_supported_type, is_pythran_supported_operation_type,
     47      is_pythran_expr, pythran_func_type, pythran_binop_type, pythran_unaryop_type, has_np_pythran,
     48      pythran_indexing_code, pythran_indexing_type, is_pythran_supported_node_or_none, pythran_type,

ImportError: cannot import name 'pythran_is_numpy_func_supported'

I also received the error message when attempting the following from commandline:

pip3 install cftime --user.

This has been resolved since reverting to version 0.28.5.

I am using Ubuntu 18.04 and Python 3.6.6.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 13
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I saw this error in cython-0.29.6. But error fixed. repeat this command “pip3 uninstall cython” till showing this message “Cannot uninstall requirement cython, not installed” and install again “pip3 install cython”

same problem. I back to 0.28.5 solved it.

Hi, I had the same problem with 0.29.14 and solved it by downgrading to 0.28.5

Might be a circular import dependency. Investigation and PR welcome.

My experience is somewhat different. I’m still seeing this error in version 0.29.5:

Python 3.6.2 |Anaconda, Inc.| (default, Sep 19 2017, 08:03:39) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cython
>>> cython.__version__
'0.29.5'
>>> from Cython.Build.Inline import _get_build_extension
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\Cython\Build\Inline.py", line 17, in <module>
    from ..Compiler.ParseTreeTransforms import (CythonTransform,
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\Cython\Compiler\ParseTreeTransforms.py", line 14, in <module>
    from . import ExprNodes
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\Cython\Compiler\ExprNodes.py", line 46, in <module>
    from .Pythran import (to_pythran, is_pythran_supported_type, is_pythran_supported_operation_type,
ImportError: cannot import name 'pythran_is_numpy_func_supported'