[Numpy-discussion] Error importing numpy in cygwin

Ralf Gommers ralf.gommers at googlemail.com
Tue Apr 12 12:51:57 EDT 2011


On Tue, Apr 12, 2011 at 9:17 AM, David Cournapeau <cournape at gmail.com> wrote:
> On Tue, Apr 12, 2011 at 10:25 AM, Gabriella Turek <g.turek at niwa.co.nz> wrote:
>>
>> Hello I'm working with cygwin 1.7.9. I've installed python 2.6 from the cygwin distro. I've also installed nympy from the distro (v. 1.4.1), and when that failed, I tried to installed directly form source (v. 1.5.1)
>> In both cases when I try to run a script that imports numpy (including running the numpy tests) I get the following
>> error message:
>
> It seems ctypes import fails. Are you sure that your python is
> correctly installed ? What does the following does:
>
> python -c "import ctypes"
>
> If that does not work, the problem is how python was installed, not with numpy.

It's a known problem that ctypes is not always built for Python, see for example
http://projects.scipy.org/numpy/ticket/1475
http://bugs.python.org/issue1516
http://bugs.python.org/issue2401

Also this ticket (ctypes + Cygwin) may be related:
http://projects.scipy.org/numpy/ticket/904

The submitter of #1475 suggests that it's worth considering if numpy
should depend on ctypes. I agree that it would be better not to.
Ctypes is not in the Python 2.4 stdlib, and even after that can give
problems on anything that's not Linux. Would it be possible to use
Cython instead with a reasonable amount of effort?

Ralf



More information about the NumPy-Discussion mailing list