[IPython-User] pythonnet and IPython
Wed Nov 7 03:30:16 CST 2012
To anyone interested, following Christoph's suggestion has now worked! For
the record (any my own reference, I'm writing up my 'recipe' here).
0) Install Vanilla Python and modules of choice -- here, the only external
I installed these using binaries available from Christoph Gohlke
1) Build pythonnet with VS2012 .NET 4 (Python.Runtime Build Options ->
2) Use mt.exe to set the manifest (I created the following batch script)
set path="C:\Program Files (x86)\Windows Kits\8.0\bin\x64";%path%
mt.exe -manifest msvcr90.manifest -outputresource:python.exe;#1
Thanks Christoph for this tip!
3) You are done! Now, however, the point of #2 above was to get IPython
working with pythonnet (and the audience here is probably interested in
that issue too). I had to do #2 above because of the errors I was getting
from pyreadline (discussed earlier in this thread). Once that was resolved
with the manifest, I was able to use the following batch script to run
IPython using the pythonnet python.exe. Place this into a file called
ipythonnet.bat and put it in the same directory as the pythonnet
python.exe. You should be able to call it from there and 'import clr'.
python.exe -c "import sys; from IPython.frontend.terminal.ipapp import
launch_new_instance; sys.exit(launch_new_instance())" %*
exit /B %ERRORLEVEL%
*note* I still am using python.exe -c which according to Christoph is
probably a bad idea, so suggestions for a way around this are welcome
(maybe by running python.exe and loading the ipython-script.py file?).
Thanks everyone! Hopefully this means I can work happily between CPython
and use the resources of our in-house .NET 4 tools within Python!
On Tue, Nov 6, 2012 at 10:54 PM, John Burkhart <email@example.com>wrote:
> Thomas, Thank you for the link. It took me some time to read through, and
> it exposes my naivety to think that I believed I could simply just 'build
> Python' with VS2012...
> Paul, I have considered IronPython, and decided it is not the avenue I'd
> prefer to pursue... However, that being said, the issue is that I want to
> be able to use .NET 4 assemblies we've built in house as part of a project.
> The library is large, and well built and documented, and would be a core
> part of activities. Further, I plan to use numpy. IronPython is an option,
> and it would work, and ultimately may be the route...
> Yet somehow, my preference it so stick with CPython. Both for
> philosophical and practical reasons. Philosophically, while I appreciate
> the port of numpy/scipy for C# (therefore IronPython), and despite
> 'hearing' contrary, it seems like the project is quite alive and actively
> developed, I still find myself concerned for fragmentation.
> Practically, I have concerns about the viability of IronPython and
> incorporation of all the CPython 'batteries'.
> We see technology change so rapidly, and languages are included. Yet, it
> seems Python has such a large community and momentum. I am confident that
> it will evolve and grow for some time.
> Being faced with the challenge of interfacing Python and C# is providing a
> a great deal of new information and exposure to 'what lies beneath'.
> Interesting, indeed.
> I see Christoph's suggestion now, and will hope I can make that solution
> work for now!
> On Tue, Nov 6, 2012 at 5:44 PM, Paul Moore <firstname.lastname@example.org> wrote:
>> On 6 November 2012 16:16, Thomas Kluyver <email@example.com> wrote:
>>> On 6 November 2012 16:02, John Burkhart <firstname.lastname@example.org>wrote:
>>>> Is it at all common, or at least not so unique, to be forced to build
>>>> your own Python, and is it something that would be reliable in a
>>>> operational environment?
>>> As far as I know it's pretty unusual, especially on Windows, but not
>>> unheard of.
>>> Have a look at http://bugs.python.org/issue13210 for an idea of the
>>> changes made to release Python 3.3 using VS 2010. If you can replicate
>>> that, it sounds like it should be quite easy to move between 2010 and 2012.
>> I'd agree, it's pretty unusual. The big issue, as Thomas said, is likely
>> to be with the build process (the solution files, etc).
>> I've never encountered an extension that *required* a particular version
>> of VS to build, so it's always a case for me of getting the version of VS
>> which matches the version of Python I'm using and building extensions with
>> that, rather than the other way around. Having said that, Python.NET is a
>> very special case, and I can imagine it might well be necessary here. It's
>> quite ironic, actually, I just happened to look at Python.NET the other day
>> for completely unrelated reasons. I had thought from what I'd seen that it
>> had stagnated (certainly there's no sign of a Python 3 version, which
>> unfortunately made it useless for me). Anyway, best of luck. I don't have
>> much else I can offer, but if you do hit issues, post them and I'll see if
>> I can help.
>> PS I presume IronPython is not appropriate for your requirements?
>> IPython-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User