New issue 3025: importing autograd module fails
https://bitbucket.org/pypy/pypy/issues/3025/importing-autograd-module-fails

Jan Vesely:

```
Python 3.6.1 (784b254d669919c872a505b807db8462b6140973, Apr 21 2019, 14:47:54)
[PyPy 7.1.1-beta0 with GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``"messy" is not a judgement, but
just a fact of complicatedness''
>>>> import autograd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/orome/.local/lib/pypy3.6/site-packages/autograd/__init__.py", 
line 2, in <module>
    from .differential_operators import (
  File 
"/home/orome/.local/lib/pypy3.6/site-packages/autograd/differential_operators.py",
 line 12, in <module>
    import autograd.numpy as np
  File 
"/home/orome/.local/lib/pypy3.6/site-packages/autograd/numpy/__init__.py", line 
5, in <module>
    from . import numpy_vjps
  File 
"/home/orome/.local/lib/pypy3.6/site-packages/autograd/numpy/numpy_vjps.py", 
line 130, in <module>
    defvjp(anp.where, None,
AttributeError: module 'autograd.numpy.numpy_wrapper' has no attribute 'where'
```

the function is exported in this way:

```
def wrap_namespace(old, new):
    unchanged_types = {float, int, type(None), type}
    int_types = {_np.int, _np.int8, _np.int16, _np.int32, _np.int64, 
_np.integer}
    function_types = {_np.ufunc, types.FunctionType, types.BuiltinFunctionType}
    for name, obj in old.items():
        if obj in notrace_functions:
            new[name] = notrace_primitive(obj)
        elif type(obj) in function_types:
            new[name] = primitive(obj)
        elif type(obj) is type and obj in int_types:
            new[name] = wrap_intdtype(obj)
        elif type(obj) in unchanged_types:
            new[name] = obj

wrap_namespace(_np.__dict__, globals())
```


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to