[Community] Installing Shapely on Windows

Kai Lautaportti kai.lautaportti at hexagonit.fi
Wed Dec 12 12:45:32 EET 2007


Hi Kristian

On Dec 12, 2007, at 11:34 , Kristian Thy wrote:

> Hi
>
> I'm trying to install Shapely on Windows:
>
> 	easy_install Shapely
>
> To my surprise, this tries to download and install ctypes, even though
> I'm running Python 2.5 and ctypes is already available, as evidenced:
>
> 	>>> import ctypes
> 	>>> ctypes.__version__
> 	'1.0.2'
>
> This probably shouldn't be a problem, except that I can't compile  
> ctypes
> due to me missing the VS2003 compiler. I have VS2005, but that is
> apparently not okay. I have cygwin and can manually compile ctypes by
> downloading the tarball and running
>
> 	python setup.py -c mingw32
>
> but then I can't figure out how to install the ctypes I just built :-(
>
> So, in summary I have the following questions, not all of which  
> might be
> relevant to this list (so shoot me ;-]):
>
> 1) Why does Shapely try to install ctypes when it's already there?
>

Shapely's setup.py script currently lists 'ctypes' as an egg  
dependency and therefore easy_install tries to download, compile and  
install it for you. Unfortunately easy_install is not aware by default  
that you already have ctypes from Python 2.5.

There are a few things that can be done here.

a) Remove the ctypes dependency declaration from the setup.py. This  
will require Python 2.4 users to install ctypes manually, though.  
Sean, what do you think?

b) Let easy_install (actually setuptools) know that you already have  
ctypes installed. You can do this by creating a ctypes.egg-info file  
in a directory that is on your python path. Try the following:

  1. Create a file called ctypes.egg-info somewhere in your python  
path (see sys.path)

  2. Write the following three lines in the file and save:

     Metadata-Version: 1.0
     Name: ctypes
     Version: 1.0.2

  3. Rerun easy_install Shapely

I tried b) on my OS X Leopard system and it seemed to work fine.

cheers,
Kai
--
Kai Lautaportti           +358-50-558-7935
Software engineer         www.hexagonit.fi
Hexagon IT Oy             kai.lautaportti at hexagonit.fi




More information about the Community mailing list