Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#59534 - Numpy command np.intersect1d stoped working after system upgrade

Attached to Project: Community Packages
Opened by Yassin Jomni (fakr00n) - Monday, 06 August 2018, 12:41 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 06 August 2018, 14:19 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Numpy command np.intersect1d (may be others) stopped working after a system upgrade that automatically upgraded python from 3.6 to 3.7.
The exact code used to work fine in python 3.6 but broke in 3.7

Additional info:
* package version(s): System upgrade upgrade from python 3.6 to 3.7


Steps to reproduce:
In python run the following:

>>> import numpy as np
>>> x=[1,2,3,4,5,6,7,8,9,10]
>>> y=[1,2,3,4,5]
>>> np.intersect1d(x,y)
array([1, 2, 3, 4, 5])
>>> np.intersect1d(x,y,assume_unique=True))
File "<stdin>", line 1
np.intersect1d(x,y,assume_unique=True))
^
SyntaxError: invalid syntax
>>> np.intersect1d(x,y,assume_unique=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/numpy/lib/arraysetops.py", line 368, in intersect1d
ar1 = ar1.ravel()
AttributeError: 'list' object has no attribute 'ravel'

This task depends upon

Closed by  Eli Schwartz (eschwartz)
Monday, 06 August 2018, 14:19 GMT
Reason for closing:  Not a bug
Comment by Eli Schwartz (eschwartz) - Monday, 06 August 2018, 14:19 GMT
This has nothing to do with python3.6 vs python3.7, and everything to do with numpy 1.14.5 vs numpy 1.15.0 which happened to have been upgraded at the same time.

See commit https://github.com/numpy/numpy/commit/0bd86db79b7a8000f9dbd401df722ffae9c2b33c where this behavior changed.

You are trying to compare two python lists, which used to work, but the function properly expects two numpy.array objects, and now actually makes use of the ravel() function of numpy arrays (and hence fails when you give it data it never expected to see).

If you don't like this behavior you should speak to upstream, but they'll probably tell you it only used to work by accident.

Loading...