Moving a package in cygwin

6

63q2o4i02

Hi,

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
c:\python24\lib\site-packages

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
someplace.

thanks
Michael
 
S

Steve Holden

Hi,

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
c:\python24\lib\site-packages

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
someplace.
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.

regards
Steve
 
6

63q2o4i02

Ok, thanks. I actually hadn't considered the build system, figuring
that function names, etc., would somehow magically be "exported" to
anyone wanting to use the .pyd library.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top