472,143 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

Moving a package in cygwin

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.
import visa 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

Dec 8 '05 #1
2 3085
63*******@sneakemail.com wrote:
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.
import visa


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
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Dec 9 '05 #2
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

Dec 9 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by dw | last post: by
3 posts views Thread by Jeff Blaine | last post: by
reply views Thread by Eric Myers | last post: by
9 posts views Thread by Mayer | last post: by
1 post views Thread by Bill Harris | last post: by
4 posts views Thread by reachsamdurai | last post: by
7 posts views Thread by =?Utf-8?B?TW9iaWxlTWFu?= | last post: by
1 post views Thread by Gheorghe Postelnicu | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.