Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy as no Attribute string0 #5884

Closed
Carreau opened this issue Jan 19, 2016 · 7 comments
Closed

numpy as no Attribute string0 #5884

Carreau opened this issue Jan 19, 2016 · 7 comments
Assignees
Milestone

Comments

@Carreau
Copy link
Contributor

Carreau commented Jan 19, 2016

I came across this traceback while using v1.5.1-970-g950c712

Traceback (most recent call last):
  File "/Users/bussonniermatthias/dev/permute/doc/source/_sphinxext/plot_directive.py", line 502, in run_code
    six.exec_(code, ns)
  File "<string>", line 5, in <module>
  File "/Users/bussonniermatthias/dev/matplotlib/lib/matplotlib/mlab.py", line 3227, in rec2txt
    for i, colname in enumerate(r.dtype.names)]
  File "/Users/bussonniermatthias/dev/matplotlib/lib/matplotlib/mlab.py", line 3227, in <listcomp>
    for i, colname in enumerate(r.dtype.names)]
  File "/Users/bussonniermatthias/dev/matplotlib/lib/matplotlib/mlab.py", line 3183, in get_justify
    if (ntype == np.str or ntype == np.str_ or ntype == np.string0 or
AttributeError: module 'numpy' has no attribute 'string0'

np.string0 seem to be still in the souce code of matplotlib. Asking my neighbor numpy developer, he has never heard of this. I can imagine this might have ment to be np.str0.

I got that by by trying to build the docs of https://github.com/statlab/permute , trying to fix an IPython bug https://github.com/ipython/ipython/issues/8733, so I have no clue what's going in permute, or matplotlib, or numpy. Hoping to reach someone who knows.

@tacaswell
Copy link
Member

Looks like this originally came in in 9638f5e (JDH: Feb 16 2008).

There is still one reference to string0 in the numpy source: https://github.com/tacaswell/numpy/blob/master/doc/summarize.py#L32

It looks like it was part of f2py and removed from the numpy source tree in numpy/numpy@484c100 (rkern: July 2008)

@tacaswell
Copy link
Member

attn @rkern

@rkern
Copy link

rkern commented Jan 20, 2016

That commit did not remove string0; it only deleted files in numpy/f2py:

$ git diff --summary '484c100392601f4942ceecbedf32e6df0201d473^..484c100392601f4942ceecbedf32e6df0201d473'                                    :master
 delete mode 100644 numpy/f2py/lib/__init__.py
 delete mode 100644 numpy/f2py/lib/api.py
 delete mode 100644 numpy/f2py/lib/doc.txt
 delete mode 100644 numpy/f2py/lib/extgen/__init__.py
 delete mode 100644 numpy/f2py/lib/extgen/base.py
 delete mode 100644 numpy/f2py/lib/extgen/c_support.py
 delete mode 100644 numpy/f2py/lib/extgen/doc.txt
 delete mode 100644 numpy/f2py/lib/extgen/py_support.py
 delete mode 100644 numpy/f2py/lib/extgen/setup_py.py
 delete mode 100644 numpy/f2py/lib/extgen/utils.py
 delete mode 100644 numpy/f2py/lib/main.py
 delete mode 100644 numpy/f2py/lib/nary.py
 delete mode 100644 numpy/f2py/lib/parser/Fortran2003.py
 delete mode 100644 numpy/f2py/lib/parser/__init__.py
 delete mode 100644 numpy/f2py/lib/parser/api.py
 delete mode 100644 numpy/f2py/lib/parser/base_classes.py
 delete mode 100644 numpy/f2py/lib/parser/block_statements.py
 delete mode 100644 numpy/f2py/lib/parser/doc.txt
 delete mode 100644 numpy/f2py/lib/parser/parsefortran.py
 delete mode 100644 numpy/f2py/lib/parser/pattern_tools.py
 delete mode 100644 numpy/f2py/lib/parser/readfortran.py
 delete mode 100644 numpy/f2py/lib/parser/sourceinfo.py
 delete mode 100644 numpy/f2py/lib/parser/splitline.py
 delete mode 100644 numpy/f2py/lib/parser/statements.py
 delete mode 100644 numpy/f2py/lib/parser/test_Fortran2003.py
 delete mode 100644 numpy/f2py/lib/parser/test_parser.py
 delete mode 100644 numpy/f2py/lib/parser/typedecl_statements.py
 delete mode 100644 numpy/f2py/lib/parser/utils.py
 delete mode 100644 numpy/f2py/lib/py_wrap.py
 delete mode 100644 numpy/f2py/lib/py_wrap_subprogram.py
 delete mode 100644 numpy/f2py/lib/py_wrap_type.py
 delete mode 100644 numpy/f2py/lib/setup.py
 delete mode 100644 numpy/f2py/lib/src/F_FUNC.cpp
 delete mode 100644 numpy/f2py/lib/src/pyobj_to_string_len.c
 delete mode 100644 numpy/f2py/lib/tests/test_derived_scalar.py
 delete mode 100644 numpy/f2py/lib/tests/test_module_module.py
 delete mode 100644 numpy/f2py/lib/tests/test_module_scalar.py
 delete mode 100644 numpy/f2py/lib/tests/test_scalar_function_in.py
 delete mode 100644 numpy/f2py/lib/tests/test_scalar_in_out.py
 delete mode 100644 numpy/f2py/lib/wrapper_base.py

@rkern
Copy link

rkern commented Jan 20, 2016

It's an alias that is still added in numpy.core.numerictypes.

It's possible that it's a Python 2-only thing with numpy.bytes0 being the Python 3 equivalent.

@Carreau
Copy link
Contributor Author

Carreau commented Jan 20, 2016

It's possible that it's a Python 2-only thing with numpy.bytes0 being the Python 3 equivalent.

That seem probable :

$ python2
>>> import numpy as np
>>> np.string0
<type 'numpy.string_'>
 $ python3
>>> import numpy as np
>>> np.bytes0
<class 'numpy.bytes_'>

@mdboom
Copy link
Member

mdboom commented Jan 20, 2016

Cool. Seems easy enough to fix on our end, then.

@jenshnielsen jenshnielsen added this to the 1.5.2 (Critical bug fix release) milestone Feb 8, 2016
dopplershift added a commit to dopplershift/matplotlib that referenced this issue May 10, 2016
The main goal is to remove the reference to np.string0. In the end,
it became better to clean up the checking of various types using
np.issubdtype.
tacaswell added a commit that referenced this issue May 11, 2016
FIX: Clean up type checking in rex2txt 

Fixes #5884
@jenshnielsen
Copy link
Member

Closed by #6396

tacaswell pushed a commit to tacaswell/matplotlib that referenced this issue May 22, 2016
The main goal is to remove the reference to np.string0. In the end,
it became better to clean up the checking of various types using
np.issubdtype.
jarrodmillman added a commit to jarrodmillman/permute that referenced this issue Jul 27, 2016
Problem due to this bug:
matplotlib/matplotlib#5884

1.5.2 includes the fix:
matplotlib/matplotlib#6396

1.5.2 tagged release:
matplotlib/matplotlib/releases/tag/v1.5.2

(also update numpy to current release)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants