tungwaiyip.info

home

about me

links

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< December 2013 >
SuMoTuWeThFrSa
1 2 3 4 5 6 7
8 91011121314
15161718192021
22232425262728
293031    

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Getting Cython to work with Python 3.3 on Windows

I have spent a fair bit of time to get Cython to work with Python 3.3 on Windows. So I just add a note here in case anyone want a similar setup. These are the components I use:

  • Windows 7
  • Python 3.3 (Anaconda distribution)
  • Visual C++ 2010 Express

To install Python 3.3 version of Anaconda there is a twist. The Anaconda Windows installer (as of 2013-12) is of Python 2.7. You could add the Python 3.3 environment after Anaconda is installed. But then you will be adding the 3.3 packages on top of the 2GB base 2.7 installation. If you don't need 2.7, there is a way to save the disk space. Download and install the Miniconda3 installer. It should be a 32M base installer only. Note that I have only successfully used the x86 32 bit version. I would explain the problem of the 64 bit version later. Next run this to install the Python 3.3 Anaconda packages.

conda update conda
conda create -n py33 python=3.3 anaconda
activate py33

Previously I have tried to download miniconda and install individual packages as needed. But then I find that I did not save much disk space compare to the 2GB full Anaconda packages. So I rather save myself hassle and install everything.

Next you need a C compilers. The idea is your C compiler should be of the same version that compiles the Python interpreter. How do you find out what version of compiler is used? Notice when you start the Python interpreter, it output one line that says the system version. From this we can find out the what it is compiled from. The Anaconda Python version string looks like:

Python 3.3.3 |Anaconda 1.8.0 (32-bit)| (default, Dec 3 2013, 11:58:39) [MSC v.1600 32 bit (Intel)]

1600 is the MSVC version string. Divide it by 100 and then minus 6 gets you 10. This corresponds to Visual Studio 2010 Express. If you have Python 2.7, the version string reads 1500 and it corresponds to Visual Studio 2008 express. I found out this only after tracing the source code in msvc9compiler.py in the distutils packages.

Originally I have installed the 64 bit version of miniconda. In this case the version is like

Python 3.3.3 |Continuum Analytics, Inc.| (default, Dec 3 2013, 11:56:40) [MSC v.1600 64 bit (AMD64)] on win32

I don't know what is the significance of the label (AMD64) in there (my PC is Intel i7). But this prevent the msvc9compiler from associating with the correct compiler. It gives me a cryptic error when I tried compiling:

ValueError: ['path']

I have succeed only after I reinstall with the 32 bit miniconda. With this I am able to compile Cython's hello world example. I hope this helps.

2013.12.18 [] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

Trump signs order undoing Obama climate change policies (28 Mar 2017)

 

Cyclone Debbie: Australia activates disaster response plan (28 Mar 2017)

 

Cyclone Debbie seen from space (28 Mar 2017)

 

Turkey 'spied' on pro-Gulen opponents in Germany (28 Mar 2017)

 

New population of rare tigers found in eastern Thailand (28 Mar 2017)

 

Paris clashes after French police kill Chinese man (28 Mar 2017)

 

Carlos the Jackal : Third French life sentence for notorious militant (28 Mar 2017)

 

Sweden reacts to anger at 'risky births' and maternity care shortages (28 Mar 2017)

 

Kasai unrest: UN experts 'found dead' in DR Congo (28 Mar 2017)

 

Winnie Madikizela-Mandela on Kathrada: 'Same pain as Mandela' (28 Mar 2017)

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

United’s leggings, Samsung’s Bixby and London’s luxury rentals (27 Mar 2017)

 

Uber resumes self-driving car program after brief suspension (27 Mar 2017)

 

Mission Beach Cafe sued by workers claiming wage violations (27 Mar 2017)

 

Panel grapples with pot banking laws (27 Mar 2017)

 

Business News Roundup, March 28 (27 Mar 2017)

 

Shiptraffic, March 28 (27 Mar 2017)

more »

 


Site feed Updated: 2017-Mar-28 12:00