Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
cython in WinPython, and all of those ".bat" files in the scripts directory
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark  
View profile  
 More options Sep 25 2012, 12:27 pm
From: Mark <markperrymil...@gmail.com>
Date: Tue, 25 Sep 2012 09:27:53 -0700 (PDT)
Local: Tues, Sep 25 2012 12:27 pm
Subject: cython in WinPython, and all of those ".bat" files in the scripts directory

Sorry for asking what may be a very simple (or even technically incorrect)
question , but I am trying to get a little more information.

I was hoping that WinPython could possibly make my entry to using Cython a
little easier. I have not had much luck with Cython to date, and I know
that I am likely missing something simple. So I have downloaded WinPython
to try some things out and see if I can get Cython running under a more
controlled setting.

Does the distribution also contain all of the Python header files and code
required by Cython for compilation of cPython functions into modules? And
is there a specific approach that is recommended for using Cython  from
WinPython.

Also, when poking around in the python-2.7.3\Scripts folder, I see numerous
"*.bat" files that I don't have in my normal Python distribution. Is there
any information available regarding what these are used for?

Sorry for cluttering the list with such basic questions, but thanks in
advance for any information that anyone can provide.

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pierre Raybaut  
View profile  
 More options Sep 25 2012, 2:42 pm
From: Pierre Raybaut <pierre.rayb...@gmail.com>
Date: Tue, 25 Sep 2012 20:42:22 +0200
Local: Tues, Sep 25 2012 2:42 pm
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory
2012/9/25 Mark <markperrymil...@gmail.com>:

> Sorry for asking what may be a very simple (or even technically incorrect)
> question , but I am trying to get a little more information.

> I was hoping that WinPython could possibly make my entry to using Cython a
> little easier. I have not had much luck with Cython to date, and I know that
> I am likely missing something simple. So I have downloaded WinPython to try
> some things out and see if I can get Cython running under a more controlled
> setting.

> Does the distribution also contain all of the Python header files and code
> required by Cython for compilation of cPython functions into modules? And is

Yes for the 32-bit version of WinPython (MinGW32 with gcc is
included), and no for the 64-bit version (you will have to install
your own C compiler).

> there a specific approach that is recommended for using Cython  from
> WinPython.

No, WinPython is really close to a standard Windows Python
installation. When running one of the launchers (.exe files at the
root directory), the environment is exactly the same as the one you
would have after installing Python with the official installer. So to
run scripts installed with WinPython (like Cython) from a command
window, you would have to run cmd.exe. But you can also run everything
from Spyder: you write your .pyx script and build it in a terminal
inside Spyder.

> Also, when poking around in the python-2.7.3\Scripts folder, I see numerous
> "*.bat" files that I don't have in my normal Python distribution. Is there
> any information available regarding what these are used for?

As I tried to explain in the readme.txt in that directory, these batch
scripts are indeed specific to WinPython and they are only there to
help the user eventually writing its own launchers. For example, the
script "scripts\spyder.bat" does (almost) exactly the same things as
the launcher "Spyder.exe". But none of this script is required for
using WinPython, these are extras.

> Sorry for cluttering the list with such basic questions, but thanks in
> advance for any information that anyone can provide.

No, problem.

-Pierre


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile  
 More options Sep 28 2012, 2:15 pm
From: Mark <markperrymil...@gmail.com>
Date: Fri, 28 Sep 2012 11:15:26 -0700 (PDT)
Local: Fri, Sep 28 2012 2:15 pm
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory

Thank you, Pierre. I again apologize for asking extremely simple questions.

My interest in your WinPython distributions stems from my lack of success
using Cython in the past. I have always suspected that there is some sort
of minor configuration issue occurring that is preventing me from making
progress.  Unfortunately I am still not having much success getting the
basic Cython tutorial to work (a simple "Hello World!";
http://docs.cython.org/src/userguide/tutorial.html), even when using
WinPython.

And I sincerely apologize if this question should be asked elsewhere, but
this seemed like a reasonable place to start given the goals of WinPython.

1) I have installed WinPython in "C:\WinPython-32bit-2.7.3.0". This
directory includes all of the links to Spyder, IPython, WPControlPanel, etc.

2) Using Spyder, I created the "helloworld.pyx" and "setup.py" files
indicated in the Cython tutorial. These file sit in a directory called
"C:\WinPython-32bit-2.7.3.0\python-2.7.3\myCython"

3) Still within Spyder, I used the "Tools" menu to open a command prompt
(it opens to the locations where my .pyx and setup.py file are located).

4) I issue the command

"python setup.py build_ext --inplace" at the prompt (as listed in the tutorial) and then see the following output:

running build_ext
cythoning hello.pyx to hello.c
building 'hello' extension
error: Unable to find vcvarsall.bat

I have searched my WinPython directory for the "vcvarsall.bat" file, and it
doesn't exist.

Does anyone have any suggestions?

Thanks,

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile  
 More options Sep 28 2012, 2:15 pm
From: Mark <markperrymil...@gmail.com>
Date: Fri, 28 Sep 2012 11:15:48 -0700 (PDT)
Local: Fri, Sep 28 2012 2:15 pm
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory

Thank you, Pierre. I again apologize for asking extremely simple questions.

My interest in your WinPython distributions stems from my lack of success
using Cython in the past. I have always suspected that there is some sort
of minor configuration issue occurring that is preventing me from making
progress.  Unfortunately I am still not having much success getting the
basic Cython tutorial to work (a simple "Hello World!";
http://docs.cython.org/src/userguide/tutorial.html), even when using
WinPython.

And I sincerely apologize if this question should be asked elsewhere, but
this seemed like a reasonable place to start given the goals of WinPython.

1) I have installed WinPython in "C:\WinPython-32bit-2.7.3.0". This
directory includes all of the links to Spyder, IPython, WPControlPanel, etc.

2) Using Spyder, I created the "helloworld.pyx" and "setup.py" files
indicated in the Cython tutorial. These file sit in a directory called
"C:\WinPython-32bit-2.7.3.0\python-2.7.3\myCython"

3) Still within Spyder, I used the "Tools" menu to open a command prompt
(it opens to the locations where my .pyx and setup.py file are located).

4) I issue the command

"python setup.py build_ext --inplace" at the prompt (as listed in the tutorial) and then see the following output:

running build_ext
cythoning hello.pyx to hello.c
building 'hello' extension
error: Unable to find vcvarsall.bat

I have searched my WinPython directory for the "vcvarsall.bat" file, and it
doesn't exist.

Does anyone have any suggestions?

Thanks,

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pierre Raybaut  
View profile  
 More options Sep 29 2012, 4:55 am
From: Pierre Raybaut <pierre.rayb...@gmail.com>
Date: Sat, 29 Sep 2012 10:55:54 +0200
Local: Sat, Sep 29 2012 4:55 am
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory
2012/9/28 Mark <markperrymil...@gmail.com>:

> Thank you, Pierre. I again apologize for asking extremely simple questions.

> My interest in your WinPython distributions stems from my lack of success
> using Cython in the past. I have always suspected that there is some sort of
> minor configuration issue occurring that is preventing me from making
> progress.  Unfortunately I am still not having much success getting the
> basic Cython tutorial to work (a simple "Hello World!";
> http://docs.cython.org/src/userguide/tutorial.html), even when using
> WinPython.

> And I sincerely apologize if this question should be asked elsewhere, but
> this seemed like a reasonable place to start given the goals of WinPython.

> 1) I have installed WinPython in "C:\WinPython-32bit-2.7.3.0". This
> directory includes all of the links to Spyder, IPython, WPControlPanel, etc.

Ok, so this is the 32-bit version of WinPython including a free C
compiler (MinGW32 with gcc).

> 2) Using Spyder, I created the "helloworld.pyx" and "setup.py" files
> indicated in the Cython tutorial. These file sit in a directory called
> "C:\WinPython-32bit-2.7.3.0\python-2.7.3\myCython"

Just a suggestion: avoid mixing installed libraries and your own.
Moving the 'myCython' folder to a 'C:\dev\myCython' folder would
probably be more cleaner.

> 3) Still within Spyder, I used the "Tools" menu to open a command prompt (it
> opens to the locations where my .pyx and setup.py file are located).

Ok.

> 4) I issue the command

> "python setup.py build_ext --inplace" at the prompt (as listed in the
> tutorial) and then see the following output:

> running build_ext
> cythoning hello.pyx to hello.c
> building 'hello' extension
> error: Unable to find vcvarsall.bat

> I have searched my WinPython directory for the "vcvarsall.bat" file, and it
> doesn't exist.

This is a classic error due to the fact that the default C compiler on
Windows for Python is Microsoft Visual C/C++ (that's what 'vc' stands
for in 'vcvarsall.bat'). So either you install the free version of
this compiler (Microsoft Visual C/C++ 2008 Express Edition -- why
2008? because Python 2.7 was built with this compiler version) or you
will have to tell Python to use MinGW32 instead of MSVC compiler with
the '-c' option as in the following command.

python setup.py build_ext -c mingw32 --inplace

That should work but it isn't with WinPython v2.7.3.0 32bit because I
have apparently forgot to include some essential files for MinGW32
(that's my fault: I did very limited testing of MinGW32 as I'm
replacing it with MSVC in all my projects due to an imminent migration
from 32-bit to 64-bit).

I'll fix this in WinPython v2.7.3.1:
http://code.google.com/p/winpython/issues/detail?id=9

In the meantime, you may install Microsoft Visual C/C++ 2008 Express
Edition, and everything will work as expected.

-Pierre


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Miller  
View profile  
 More options Oct 1 2012, 12:37 pm
From: Mark Miller <markperrymil...@gmail.com>
Date: Mon, 1 Oct 2012 09:37:05 -0700
Local: Mon, Oct 1 2012 12:37 pm
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory
Thanks Pierre: I look forward to seeing the next release. It will be
extremely to have something pre-configured that does not need to rely
on the microsoft compiler.

In the meantime, I did install the MS 2008 C++ compiler that you
suggested. Installation seems to be fine, but I am still getting
errors when trying to compile the 'hello world' example.  Here's the
readout...I am just mentioning it in case it is indicative of some
other sort of problem that you might need to be aware of.

Thanks again, and I am definitely looking forward to the next release!

-Mark

C:\Marks\Python_code\Cython\hello>python setup.py build_ext --inplace
running build_ext
cythoning hello.pyx to hello.c
building 'hello' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG
-IC:\WinPython-32bit-2.7.3.0\python-2.7.3\include
-IC:\WinPython-32bit-2.7.3.0\python-2.7.3\PC /Tchello.c
/Fobuild\temp.win32-2.7\Release\hello.obj
hello.c
c:\winpython-32bit-2.7.3.0\python-2.7.3\include\pyconfig.h(227) :
fatal error C1083: Cannot open include file: 'basetsd.h': No such file
or directory
error: command '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\cl.exe"' failed with exit status 2

On Sat, Sep 29, 2012 at 1:55 AM, Pierre Raybaut


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile  
 More options Oct 16 2012, 5:59 pm
From: Mark <markperrymil...@gmail.com>
Date: Tue, 16 Oct 2012 14:59:46 -0700 (PDT)
Local: Tues, Oct 16 2012 5:59 pm
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory

The newest release seems to be working for me now. Thanks for working on
it, Pierre. Initially, after installing it, I was still getting some errors
when compiling an extension with Cython:

cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1

I fiddled with this for a while, and was finally able to get everything to
work after editing the file "cygwincompiler.py" in \Lib\distutils from the
Python distribution. The changes were as follows (original commented-out
code from line 322 followed by the edited version:

##        self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
##                             compiler_so='gcc -mno-cygwin -mdll -O -Wall',
##                             compiler_cxx='g++ -mno-cygwin -O -Wall',
##                             linker_exe='gcc -mno-cygwin',
##                             linker_so='%s -mno-cygwin %s %s'
##                                        % (self.linker_dll, shared_option,
##                                           entry_point))
        self.set_executables(compiler='gcc -O -Wall',
                             compiler_so='gcc -mdll -O -Wall',
                             compiler_cxx='g++ -O -Wall',
                             linker_exe='gcc ',
                             linker_so='%s %s %s'
                                        % (self.linker_dll, shared_option,
                                           entry_point))

Just mentioning it in case it helps anyone else,

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sol Simpson  
View profile  
 More options Oct 16 2012, 6:28 pm
From: Sol Simpson <s...@isolver-software.com>
Date: Tue, 16 Oct 2012 15:28:05 -0700 (PDT)
Local: Tues, Oct 16 2012 6:28 pm
Subject: Re: cython in WinPython, and all of those ".bat" files in the scripts directory

I ran into this same issue today and after 2 hours gave up trying to fix it
for the day. Your fix worked for me as well. Thank you for the tip.

I have also read else where that instead of having to type -c mingw32 when
you compile, you can add a distutils.cfg file to your distutils folder in
Python2.7.3\Lib with the contents:

 [build]

compiler=mingw32

This worked from a command prompt inside Spyder for me (other than then
giving the error you seem to have now resolved), but when I would try and
have cython compile from source instead of using a setup.py file using the:

import pyximport; pyximport.install()
import _hello

syntax in my .py  source file

format, where _hello is a _hello.pyx file, cython would still use vc to try
and compile and give the old 'can not fine blabla.bat error'.  

Does anyone know how to get around this one? ;)

Thanks!

Sol


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »