1

I am simply trying to run python (interactively) in cygwin, but whenever I try to print out a numpy array or write a pandas dataframe to a csv file python prints out :

Segmentation fault (core dumped)

To run numpy/pandas I installed with cygwin set-up.exe:

  • gcc-core            11.2.0-1
  • gcc-fortran        11.2.0-1
  • gcc-g++            11.2.0-1
  • make                  4.3-1
  • python38
  • python38-cython
  • python38-devel
  • python38-numpy
  • python38-pip
  • python38-setuptools
  • python38-six
  • python38-wheel
  • wget                  1.21.2-1

I'd like to emphasize that python prints out the message, it's not an error message, apparently. The problem arises whenever I do something as simple as the following:

In cygwin terminal:

$ python3
>>> import numpy
>>> numpy.random.random(20)
Segmentation fault (core dumped)
$

But it doesn't happen when I do this (printing the first element of the array):

$ python3
>>> import numpy
>>> numpy.random.random(20)[0]
0.5200677516279423
>>>

Nor when I do this (print another numpy.ndarray of integers):

$ python3
>>> import numpy
>>> numpy.random.ranint(1, 20, 100)
array([13,  2, 10, 14, 11, 13, 16, 16, 13,  7, 14, 13,  1, 19,  8,  6,  3,
        7,  2, 15, 18,  7, 17, 16, 17,  2, 19, 13, 12, 11, 16,  8, 19,  4,
       19,  8, 12, 11, 13, 15,  7, 16, 11, 18, 16, 14, 13, 13, 19,  1, 18,
        3, 16, 12, 19,  3,  5,  6, 19, 15, 11, 18, 12, 12, 18, 16, 16, 11,
        7,  9,  2, 18, 17, 10, 17, 11, 10,  2,  4, 16,  7,  9,  9,  7, 17,
        3, 11,  4, 14, 17,  4,  4,  2,  3, 10,  7,  1,  8,  2, 16])
>>>

I am unfortunately not an expert in any way. Any help or discussion is greatly appreciated you guys.

Thank you!

Update

I found another equipment in which numpy runs OK and decided to downgrade the dependencies I know of (listed above), and it still does not work.

  • gcc-core            10.2.0-1
  • gcc-fortran        10.2.0-1
  • gcc-g++            10.2.0-1
  • make                  4.3-1
  • wget                  1.21.2-1

Please have in mind that no version of python (3.6, 3.8 y 3.9) runs numpy (same error).

Do you know what other package could be causing this issue?

Do you think it would work if I downgrade cygwin itself?

  • Did you recompile _numpy_? – user1934428 Dec 29 '21 at 08:14
  • @user1934428 he mentioned that is using the Cygwin package `python38-numpy`. However it is possible that its installation of `pandas` has some side effect. – matzeri Dec 29 '21 at 09:18
  • @user1934428 I did recompile numpy quite a few times, and I actually performed a whole new cygwin installation because of this issue. No luck. @matzeri pandas might have messed up my system, but I don't think it caused the issue. Before I installed it (pandas) on the cygwin environment itself I created a virtual environment via `python3.8 -m venv` and installed it therein. Only after that failed (with the same message) did I install it directly in cygwin's python. But I did that after the message had already shown up. – Alberto Larios Dec 29 '21 at 13:22
  • I wander **why** you compiled it yourself. I didn't check it, but doesn't _python38-numpy_ already contained the compiled code for the Cygwin version of Python 3.8? I would have simply installed it via cygwin setup, without recompilation. – user1934428 Dec 30 '21 at 08:15
  • @user1934428 I might have completely misunderstood what recompiling refers to, what I did was reinstall numpy through the set-up.exe. Maybe that’s the way to go, can you tell me how recompile it? – Alberto Larios Dec 30 '21 at 12:04
  • For a complete recompile, please see the installation instructions on the numpy website. But if the version on the Cygwin server already does not work, perhaps it makes sense to file a bug report at Cygwin. – user1934428 Dec 30 '21 at 12:10
  • @user1934428 OK thank you very much, I’ll keep on trying and see where it gets me. – Alberto Larios Dec 30 '21 at 13:37

1 Answers1

1

Turns out it was a numpy bug apparently. I'm not sure if it's a proper bug or something else (like my system not being entirely compatible) but I was using numpy 1.21.4 and 1.21.5. The problem was solved for me by downgrading to numpy 1.20.3.

Sorry if I mistakenly gave a wrong impression of what the problem was.

Thank you all for your answers!