Skip to content

BUG: Fix numpy.random bug in platform detection #14298

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

Merged
merged 1 commit into from
Aug 20, 2019
Merged

BUG: Fix numpy.random bug in platform detection #14298

merged 1 commit into from
Aug 20, 2019

Conversation

5ghz
Copy link
Contributor

@5ghz 5ghz commented Aug 19, 2019

BUG: fix platform detection
Wrong platfrom detection

Enviroment:
Linux host: Linux debian-cross 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux
Python3 version: Python 3.7.3
Pip3 version: 18.1
Debian version: 10
Numpy cross-compile on debian 10 failed because numpy detects arm platform as amd64 and add msse2 flag.

For reproduce:
Install proot and qemu
apt install proot qemu qemu-user
Download raspbian from official mirror:
wget https://downloads.raspberrypi.org/raspbian/images/raspbian-2019-07-12/2019-07-10-raspbian-buster.zip
unzip 2019-07-10-raspbian-buster.zip
Mount partion:
fdisk -l 2019-07-10-raspbian-buster.img
Need these string from output
2019-07-10-raspbian-buster.img2 540672 7380991 6840320 3.3G 83 Linux
mount -o loop,offset=$((512*540672)) 2019-07-10-raspbian-buster.img /mnt
Chroot into raspbian:
proot -R /mnt -q qemu-arm
After that:
bash
pip3 install --log=/tmp/numpy git+https://github.com/numpy/numpy.git
Chroot enviroment: Linux debian-cross 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) armv7l GNU/Linux

Also If you have not Intel like hardwate (e.g. raspberry pi)
You can set hostname e.g. hostname leafx86 and try to compile numpy.
Compile log in attachment:
numpy_failed.log

@rgommers
Copy link
Member

Hmm, most of that logic is new and seems a bit out of place. This PR can be merged as is, but then we should really move most of the logic for platform detection and flag handling to numpy.distutils as much as possible (is_msvc, the LARGE_FILES stuff, etc.). /arch:SSE2 is already handled in the numpy.distutils MSVC support files.

@charris charris added 03 - Maintenance 09 - Backport-Candidate PRs tagged should be backported labels Aug 20, 2019
@charris charris added this to the 1.17.1 release milestone Aug 20, 2019
@charris
Copy link
Member

charris commented Aug 20, 2019

@rgommers Sounds like you are OK for merging this. The code is new in 1.17, if we want to make it more consistent we can do that in master and backport this.

@rgommers
Copy link
Member

Sounds like you are OK for merging this.

indeed

The code is new in 1.17, if we want to make it more consistent we can do that in master and backport this.

no need to backport unless someone reports an actual build issue. I just noticed that it's in the wrong place and will lead to maintenance issues long-term

@charris
Copy link
Member

charris commented Aug 20, 2019

@rogommers I meant just backport this fix, any different fixes can go in master later.

@charris charris merged commit 810d315 into numpy:master Aug 20, 2019
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Aug 20, 2019
@charris charris removed this from the 1.17.1 release milestone Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants