8000 BUG: can't install from pip on mingw's python · Issue #22023 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: can't install from pip on mingw's python #22023

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

Closed
Kreijstal opened this issue Jul 21, 2022 · 10 comments
Closed

BUG: can't install from pip on mingw's python #22023

Kreijstal opened this issue Jul 21, 2022 · 10 comments
Labels

Comments

@Kreijstal
Copy link

Describe the issue:

I'm not sure if this should go here, pip or on mingw repo, but here I go. I am using mingw enviroment with windows 10. And can't install numpy with pip for python 3.10.

There is a mingw package that installs numpy with python 3.10 flawlessly, but of coruse when creating a virtual enviroment, numpy is not accessible, so you have to install it with pip, and it fails.

Reproduce the code example:

pip install numpy

Error message:

https://gist.github.com/Kreijstal/877c6ff8c88b2e37420a7e08c5089a7e

too long to paste here

NumPy/Python version information:

3.10

@mattip
Copy link
Member
mattip commented Jul 21, 2022

You are using mingw12. The errors start here

gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNPY_NO_DEPRECATED_API=0 -Inumpy/random -Inumpy/random/src -Inumpy/random/src/mt19937 -Inumpy/core/include -Ibuild/src.mingw_x86_64-3.10/numpy/core/include/numpy -Ibuild/src.mingw_x86_64-3.10/numpy/distutils/include -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/src/_simd -IC:/u/ok/groses-projekt-mdt/test/include -IC:/u/scoop/apps/msys2/2022-01-28/mingw64/include/python3.10 -Ibuild/src.mingw_x86_64-3.10/numpy/core/src/common -Ibuild/src.mingw_x86_64-3.10/numpy/core/src/npymath -c numpy/random/src/mt19937/mt19937-jump.c -o build/temp.mingw_x86_64-3.10/numpy/random/src/mt19937/mt19937-jump.o -U__GNUC_GNU_INLINE__ -std=c99 -msse -msse2 -msse3
        In file included from numpy/random/src/mt19937/mt19937.c:1:
        numpy/random/src/mt19937/mt19937.h:27:1: error: multiple storage classes in declaration specifiers
           27 | static inline uint32_t mt19937_next(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:48:1: error: multiple storage classes in declaration specifiers
           48 | static inline uint64_t mt19937_next64(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:52:1: error: multiple storage classes in declaration specifiers
           52 | static inline uint32_t mt19937_next32(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:56:1: error: multiple storage classes in declaration specifiers
           56 | static inline double mt19937_next_double(mt19937_state *state) {
              | ^~~~~~
        In file included from numpy/random/src/mt19937/mt19937-jump.h:3,
                         from numpy/random/src/mt19937/mt19937.c:2:
        C:/u/scoop/apps/msys2/2022-01-28/mingw64/include/stdlib.h:398:3: error: duplicate 'extern'
          398 |   __CRT_INLINE __MINGW_ATTRIB_NORETURN void  __cdecl _Exit(int status)
              |   ^~~~~~~~~~~~
        In file included from numpy/random/src/mt19937/mt19937-jump.h:2,
                         from numpy/random/src/mt19937/mt19937-jump.c:1:
        numpy/random/src/mt19937/mt19937.h:27:1: error: multiple storage classes in declaration specifiers
           27 | static inline uint32_t mt19937_next(mt19937_state *state) {
              | ^~~~~~
        C:/u/scoop/apps/msys2/2022-01-28/mingw64/include/stdlib.h:732:3: error: duplicate 'extern'
          732 |   __MINGW_EXTENSION __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); }
              |   ^~~~~~~~~~~~~~~~~
        numpy/random/src/mt19937/mt19937.h:48:1: error: multiple storage classes in declaration specifiers
           48 | static inline uint64_t mt19937_next64(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:52:1: error: multiple storage classes in declaration specifiers
           52 | static inline uint32_t mt19937_next32(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:56:1: error: multiple storage classes in declaration specifiers
           56 | static inline double mt19937_next_double(mt19937_state *state) {
              | ^~~~~~

Do we have known good versions of mingw?

@Kreijstal
Copy link
Author

You are using mingw12. The errors start here

gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNPY_NO_DEPRECATED_API=0 -Inumpy/random -Inumpy/random/src -Inumpy/random/src/mt19937 -Inumpy/core/include -Ibuild/src.mingw_x86_64-3.10/numpy/core/include/numpy -Ibuild/src.mingw_x86_64-3.10/numpy/distutils/include -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/src/_simd -IC:/u/ok/groses-projekt-mdt/test/include -IC:/u/scoop/apps/msys2/2022-01-28/mingw64/include/python3.10 -Ibuild/src.mingw_x86_64-3.10/numpy/core/src/common -Ibuild/src.mingw_x86_64-3.10/numpy/core/src/npymath -c numpy/random/src/mt19937/mt19937-jump.c -o build/temp.mingw_x86_64-3.10/numpy/random/src/mt19937/mt19937-jump.o -U__GNUC_GNU_INLINE__ -std=c99 -msse -msse2 -msse3
        In file included from numpy/random/src/mt19937/mt19937.c:1:
        numpy/random/src/mt19937/mt19937.h:27:1: error: multiple storage classes in declaration specifiers
           27 | static inline uint32_t mt19937_next(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:48:1: error: multiple storage classes in declaration specifiers
           48 | static inline uint64_t mt19937_next64(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:52:1: error: multiple storage classes in declaration specifiers
           52 | static inline uint32_t mt19937_next32(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:56:1: error: multiple storage classes in declaration specifiers
           56 | static inline double mt19937_next_double(mt19937_state *state) {
              | ^~~~~~
        In file included from numpy/random/src/mt19937/mt19937-jump.h:3,
                         from numpy/random/src/mt19937/mt19937.c:2:
        C:/u/scoop/apps/msys2/2022-01-28/mingw64/include/stdlib.h:398:3: error: duplicate 'extern'
          398 |   __CRT_INLINE __MINGW_ATTRIB_NORETURN void  __cdecl _Exit(int status)
              |   ^~~~~~~~~~~~
        In file included from numpy/random/src/mt19937/mt19937-jump.h:2,
                         from numpy/random/src/mt19937/mt19937-jump.c:1:
        numpy/random/src/mt19937/mt19937.h:27:1: error: multiple storage classes in declaration specifiers
           27 | static inline uint32_t mt19937_next(mt19937_state *state) {
              | ^~~~~~
        C:/u/scoop/apps/msys2/2022-01-28/mingw64/include/stdlib.h:732:3: error: duplicate 'extern'
          732 |   __MINGW_EXTENSION __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); }
              |   ^~~~~~~~~~~~~~~~~
        numpy/random/src/mt19937/mt19937.h:48:1: error: multiple storage classes in declaration specifiers
           48 | static inline uint64_t mt19937_next64(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:52:1: error: multiple storage classes in declaration specifiers
           52 | static inline uint32_t mt19937_next32(mt19937_state *state) {
              | ^~~~~~
        numpy/random/src/mt19937/mt19937.h:56:1: error: multiple storage classes in declaration specifiers
           56 | static inline double mt19937_next_double(mt19937_state *state) {
              | ^~~~~~

Do we have known good versions of mingw?

I mean, as I said there is a mingw package that installs without problem, but shouldn't pip also be able to install numpy, or maybe im just confused about virtualenvs

@daveloyall
Copy link

Hi. I can reproduce this on two machines. I ran pacman -Syuu on both of them and still got the same error.

I'm also using msys2. @Kreijstal, I see that you're using mingw "inside" msys2, as I am.

@mattip, based on these lines, should this be reported to the numpy project or the mingw project or the msys2 project?

  In file included from numpy/random/src/mt19937/mt19937-jump.h:3:
  C:/bin/msys64/mingw64/include/stdlib.h:398:3: error: duplicate 'extern'
    398 |   __CRT_INLINE __MINGW_ATTRIB_NORETURN void  __cdecl _Exit(int status)
        |   ^~~~~~~~~~~~
  In file included from numpy/random/src/mt19937/mt19937-jump.h:3,
                   from numpy/random/src/mt19937/mt19937.c:2:

@mattip, you said "you are using mingw12". Is that a known problem?

What does "mingw12" mean? I see these substrings in the posted gist. Does one of them mean "mingw12"?

  • lib.mingw_x86_64-3.10
  • x86_64-w64-mingw32/12.1.0

I'd be happy to gather more information if someone tells me how or try things if someone makes suggestions, but at the moment, I don't know what to do next.

Thanks, cheers,
--sebboh

@daveloyall
Copy link

@Kreijstal, I was just able to pip install numpy successfully by executing an MSYS shell instead of an MING64 shell. You know how there are more than one shortcut to start an msys2 shell? I used the other one. (I'm not yet sure if this will achieve my goals, since I do most of my work in the MING64 shell and numpy is NOT available there after installing it in the MSYS shell...)

@mattip
Copy link
Member
mattip commented Nov 17, 2022

I don't remember how I got to the conclusion that the original report was about mingw12. I think I searched for that error message and found some other people who ran into it, leading me to think that there is something wrong with the compiler stack in that version.

@mattip
Copy link
Member
mattip commented Nov 17, 2022

should this be reported to the numpy project or the mingw project or the msys2 project?

Well, you reported it to the NumPy project 😄 and we can't really help.

@daveloyall
Copy link

You might be able to help more than you know, @mattip.. :)

Do you speak the C language?

This file numpy/random/src/mt19937/mt19937-jump.h and this one msys64/mingw64/include/stdlib.h both try to define .. something. An 'extern' by the name of __CRT_INLINE? Or is extern a name?

@seberg
Copy link
Member
seberg commented Nov 18, 2022

That file (and some others in random) use:

#if defined(_WIN32) && !defined (__MINGW32__)
#define inline __forceinline
#endif

try removing that? Probably makes sense in either case to refactor it. We use the following snippet also:

#ifdef _MSC_VER
    #define NPY_FINLINE static __forceinline
#elif defined(__GNUC__)
    #define NPY_FINLINE static NPY_INLINE __attribute__((always_inline))
#else
    #define NPY_FINLINE static
#endif

which seems far more reliable to get a force-inline (although maybe it was never important for gcc/clang toolchains in the random code). Unfortunately, that is private to the core of NumPy, so probably got to copy-paste it into random We could use NPY_FINLINE, not sure how much that would change.

EDIT: Does __forceinline happen to work sometimes, or is it that we don't reallys upport the migw64 bit?

EDIT: Or it really doesn't like redefining inline maybe?

@lazka
Copy link
Contributor
lazka commented Jul 21, 2024

This is fixed since the switch to meson + #24968 , which was part of https://github.com/numpy/numpy/releases/tag/v1.26.2

So I think this can be closed.

@charris
Copy link
Member
charris commented Jul 21, 2024

Thanks for the feedback @lazka

@charris charris closed this as completed Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants
0