Moving a package in cygwin
steve at holdenweb.com
Fri Dec 9 10:22:12 CET 2005
63q2o4i02 at sneakemail.com wrote:
> I'm using python 2.4 and windows XP.
> I have two packages in the windows version of python in site-packages.
> They are PyVisa and ctypes, and both live in
> I'd like to move these to the cygwin version of python on the same
> system. I tried copying the PyVisa and ctypes directorices (including
> other miscellaneous "junk" like .pyd files associated with ctypes) to
> c:\cygwin\lib\python24\site-packages\, but that didn't do the trick.
> It appears site-packages *is* in my path. Aside from the pyvisa and
> ctypes directories, site-packages also contains: _ctypes.pyd,
> _ctypes_test.pyd, visa.py, visa.pyc, visa.pyo. For the windows
> version, this appears to be enough. For cygwin, however, it's not.
> This is what I get under cygwin:
> $ python
> Python 2.4.1 (#1, May 27 2005, 18:02:40)
> [GCC 3.3.3 (cygwin special)] on cygwin
> Type "help", "copyright", "credits" or "license" for more information.
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/visa.py", line 1, in ?
> from pyvisa.visa import *
> File "/usr/lib/python2.4/site-packages/pyvisa/__init__.py", line 27,
> in ?
> import vpp43
> File "/usr/lib/python2.4/site-packages/pyvisa/vpp43.py", line 41, in
> from vpp43_types import *
> File "/usr/lib/python2.4/site-packages/pyvisa/vpp43_types.py", line
> 38, in ?
> import ctypes as _ctypes
> File "C:\Python24\Lib\site-packages\ctypes\__init__.py", line 13, in
> from _ctypes import Union, Structure, Array
> ImportError: No module named _ctypes
> The .pyd files are the only files with "_ctypes" in the name. There
> are no references to pyvisa or ctypes in the c:\python24\lib directory.
> All the documentation points to adding an arbitrary path via modifying
> site.py, sys.path, or other tricks, or installing fresh. I tried
> installing ctypes with source (python setup.py build...) but that lead
> to compile problems which I won't go into here.
> It seems like moving an already-working package should be easy. Is
> there anything I'm missing? Seems like it should be a one-liner
Unfortunately Cygwin and Windows are two quite different platforms.
While pure Python packages will transfer quite easily in the way you
have attempted, extension packages (compiled from C or C++) will not. In
order to make the same packages available under Cygwin you'll have to
build them from source or find Cygwin installers.
The problem is that the extension packages must be created using the
same compiler and libraries as (or at least a compiler and libraries
that are binary compatible with) the Python interpreter.
Since the Cygwin interpreter was built with Cygwin gcc + Cygwin
libraries and the Windows interpreter was built with Microsoft's Visual
Studio compiler and libraries there's very little chance of a non-source
migration of the Windows package to Cygwin.
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list