Skip to content

numpy.take fails with int64 dtype on i386 architecture #11696

@rth

Description

@rth

numpy.take fails with int64 dtype on i386 architecture

Reproducing code example:

import numpy as np
x = np.arange(10, dtype='int64')
index = np.arange(3, dtype='int64')
x.take(index)

Expected output:

array([0, 1, 2])

is obtained on 64 bit architecture

Error message:

On 32 bit Debian Linux, I get,

>>> x.take(index)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

On 32 bit windows, the same result was indirectly illustrated in scikit-learn/scikit-learn#11295 (comment)

Numpy/Python version information:

>>> import sys, numpy; print(numpy.__version__, sys.version)
1.14.5 3.6.6 (default, Jun 27 2018, 14:44:17) 
[GCC 8.1.0]

Generally this was run in the debian unstable i386 Docker image, with the following setup,

Dockerfile
FROM i386/debian:unstable

RUN apt-get update && apt-get install -y build-essential git make

RUN apt-get install -y python3 python3-scipy python3-numpy python3-setuptools python3-pkg-resources python3-pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions