running pythonnet on MAC OSX[new to MAC and not not a programmer]

Hi, I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web: *1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error: "No output was in the standard output when trying to create the interpreter info." *2nd : I tried python.NET on XAMARIN : I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step). * 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured " I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success. Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-) I appreciate the help, Alon.

Ahh. Yes. I do it differently these days. Will get back to you shortly. -brad On Jun 12, 2013, at 10:35 AM, Alon Dulce <alondu@gmail.com> wrote:
Hi,
I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web:
*1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error:
"No output was in the standard output when trying to create the interpreter info."
*2nd : I tried python.NET on XAMARIN :
I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html
I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step).
* 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html
I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured "
I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success.
Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-)
I appreciate the help, Alon. _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet

So, firstly, I build my own 64bit mono. In that last thread, I said I was doing it off of their tar ball. I updated that slightly. I now maintain my own local "mac ports" port file. Attached is the latest one I built. It may need updating. And at the very least, you probably want to update it to build into a different place than my company's directory on my systems. Once it's built, it does create it's own pkg-config directory so you can use it in building python-net You can try and build against the usual 32-bit mono distributions on OSX. But it's usually a bad idea. Python is usually 64-bit in most places you'd want to use it in OSX. When Xamarin finally gets around to fully distributing in 64-bit on OSX by default, things will be easier and this part won't be necessary. On Jun 12, 2013, at 10:35 AM, Alon Dulce <alondu@gmail.com> wrote:
Hi,
I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web:
*1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error:
"No output was in the standard output when trying to create the interpreter info."
*2nd : I tried python.NET on XAMARIN :
I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html
I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step).
* 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html
I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured "
I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success.
Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-)
I appreciate the help, Alon. _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet

Hi, I tried using the portfile attached without success, are all the commented lines supposed to be commented ? I did the following steps: 1. I setup a folder for my local macports "~/Documents/Loc_Macports/" 2. Inside this folder I set up the directory structure according to what I understood from the port file attached: "~/Documents/Loc_Macports/devel/lang/mono/" and put the portfile in that folder 3.I didn't see any patch files in the port file (all are commented) - so I didn't do anything regarding this. 4. I edited the source.conf file with : open -a TextEdit /opt/local/etc/ports/sources.conf and added before the following line: file:///Users//~/Loc_Macports/ before this line : rsync://rsync.macports.org/release/tarballs/ports.tar [default] 5. I indexed my local repository: portindex ~/Documents/Loc_Macports/ But i received notification that none were indexed and here I'm stuck. Any insights ? BR, Alon. ---------- Forwarded message ---------- From: brad@fie.us <brad@fie.us> Date: Fri, Jun 14, 2013 at 2:01 AM Subject: Re: [Python.NET] running pythonnet on MAC OSX[new to MAC and not not a programmer] To: Alon Dulce <alondu@gmail.com> Cc: pythondotnet@python.org So, firstly, I build my own 64bit mono. In that last thread, I said I was doing it off of their tar ball. I updated that slightly. I now maintain my own local "mac ports" port file. Attached is the latest one I built. It may need updating. And at the very least, you probably want to update it to build into a different place than my company's directory on my systems. Once it's built, it does create it's own pkg-config directory so you can use it in building python-net You can try and build against the usual 32-bit mono distributions on OSX. But it's usually a bad idea. Python is usually 64-bit in most places you'd want to use it in OSX. When Xamarin finally gets around to fully distributing in 64-bit on OSX by default, things will be easier and this part won't be necessary. On Jun 12, 2013, at 10:35 AM, Alon Dulce <alondu@gmail.com> wrote: Hi, I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web: *1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error: "No output was in the standard output when trying to create the interpreter info." *2nd : I tried python.NET on XAMARIN : I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step). * 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured " I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success. Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-) I appreciate the help, Alon. _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet

On my system, the file is in: ~/ports/devel/fie-mono-64 but again, I'd suggest modifying it to better suit your needs. The commented content of the portfile is intentionally commented. The intention was to get the portfile building and deploying 64 bit mono in as simple and supported a way as possible. A lot of the way macports had been building mono seemed to be older cruft from less mac friendly versions of mono. I half expected to have to put them back in. So I left them commented. But so far, no issues have popped up. -brad On Jun 20, 2013, at 11:53 AM, Alon Dulce <alondu@gmail.com> wrote:
Hi,
I tried using the portfile attached without success, are all the commented lines supposed to be commented ? I did the following steps:
1. I setup a folder for my local macports "~/Documents/Loc_Macports/" 2. Inside this folder I set up the directory structure according to what I understood from the port file attached: "~/Documents/Loc_Macports/devel/lang/mono/" and put the portfile in that folder 3.I didn't see any patch files in the port file (all are commented) - so I didn't do anything regarding this. 4. I edited the source.conf file with : open -a TextEdit /opt/local/etc/ports/sources.conf and added before the following line: file:///Users//~/Loc_Macports/
before this line :
rsync://rsync.macports.org/release/tarballs/ports.tar [default]
5. I indexed my local repository: portindex ~/Documents/Loc_Macports/
But i received notification that none were indexed and here I'm stuck.
Any insights ?
BR, Alon.
---------- Forwarded message ---------- From: brad@fie.us <brad@fie.us> Date: Fri, Jun 14, 2013 at 2:01 AM Subject: Re: [Python.NET] running pythonnet on MAC OSX[new to MAC and not not a programmer] To: Alon Dulce <alondu@gmail.com> Cc: pythondotnet@python.org
So, firstly, I build my own 64bit mono. In that last thread, I said I was doing it off of their tar ball.
I updated that slightly. I now maintain my own local "mac ports" port file.
Attached is the latest one I built. It may need updating. And at the very least, you probably want to update it to build into a different place than my company's directory on my systems.
Once it's built, it does create it's own pkg-config directory so you can use it in building python-net
You can try and build against the usual 32-bit mono distributions on OSX. But it's usually a bad idea. Python is usually 64-bit in most places you'd want to use it in OSX. When Xamarin finally gets around to fully distributing in 64-bit on OSX by default, things will be easier and this part won't be necessary.
On Jun 12, 2013, at 10:35 AM, Alon Dulce <alondu@gmail.com> wrote:
Hi,
I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web:
*1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error:
"No output was in the standard output when trying to create the interpreter info."
*2nd : I tried python.NET on XAMARIN :
I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html
I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step).
* 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html
I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured "
I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success.
Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-)
I appreciate the help, Alon. _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
<Portfile>

Second, here is the latest, ugly ugly diff from my working version. I would not just blindly apply this. It needs to be taken apart. I did a lot of bad things in it. It needs to be revisited. But it does work and did provide me functioning pythonnet binaries and config files that work correctly. It imports into the system python2.7 as well as into Maya's embedded Python and Nuke's embedded Python. All on OSX. Some highlights… There were earlier commits of changes made by a user, "VIKAS DHIMAN" And those changes seemed to hard-code the system to ubuntu/debian locations and names. And a lot of what I had to do was revert those changes. However, I have been heavy handed in this diff in some places. Which is why I wouldn't want it committed back without re-working it. It should be neutral, rather than for one platform or the other. I added dllmap entries into the .config file for OSX. I also added an "__internal" which is what mono will need for embedded python. This allows it to run in maya and nuke on OSX in many cases. VIkas' setup.py file assumed the location of the pkg-config directory. I removed that assumption. So you need to set the PKG_CONFIG_PATH yourself before building. That is what allows you to pick which mono it builds against. Which is kind of important. And that's what a configure script is for. but since there isn't one, you do it yourself. On a proper linux package managed system, it's already set. There should be no need to hard-code it in the default case. I changed the monoclr makefile to accept the existing python executable rather than override it. I changed it to use gcc to compile rather than g++. I recall that being an Xcode thing. I updated it to use the more modern names of pkg-config packages for mono and glib. I made sure it used the glib flags too. iirc, glib's pkg-config is in the mac-ports dist location per my port file. so in my case, that's /opt/local/lib/pkgconfig/ . I have a bug fix in there that deals with "Reflection Only" assemblies being scanned for types when they should not be. I removed a clirmodule.il file that needs to not be there, in order for some of the build logic to function. I added some code to make it skip scanning of generics that have no namespace. this is a hack and probably needs further review. And there's ton of cruft in there where monodevelop was updating .csproj files and such. On Jun 12, 2013, at 10:35 AM, Alon Dulce <alondu@gmail.com> wrote:
Hi,
I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web:
*1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error:
"No output was in the standard output when trying to create the interpreter info."
*2nd : I tried python.NET on XAMARIN :
I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html
I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step).
* 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html
I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured "
I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success.
Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-)
I appreciate the help, Alon. _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet

Hi Brad, Thank you very much for the detailed explanation, I will try this and report about my progress :-) Alon. On Fri, Jun 14, 2013 at 2:45 AM, brad@fie.us <brad@fie.us> wrote:
Second, here is the latest, ugly ugly diff from my working version.
I would not just blindly apply this. It needs to be taken apart. I did a lot of bad things in it. It needs to be revisited. But it does work and did provide me functioning pythonnet binaries and config files that work correctly. It imports into the system python2.7 as well as into Maya's embedded Python and Nuke's embedded Python. All on OSX.
Some highlights…
There were earlier commits of changes made by a user, "VIKAS DHIMAN" And those changes seemed to hard-code the system to ubuntu/debian locations and names. And a lot of what I had to do was revert those changes. However, I have been heavy handed in this diff in some places. Which is why I wouldn't want it committed back without re-working it. It should be neutral, rather than for one platform or the other.
I added dllmap entries into the .config file for OSX. I also added an "__internal" which is what mono will need for embedded python. This allows it to run in maya and nuke on OSX in many cases.
VIkas' setup.py file assumed the location of the pkg-config directory. I removed that assumption. So you need to set the PKG_CONFIG_PATH yourself before building. That is what allows you to pick which mono it builds against. Which is kind of important. And that's what a configure script is for. but since there isn't one, you do it yourself. On a proper linux package managed system, it's already set. There should be no need to hard-code it in the default case.
I changed the monoclr makefile to accept the existing python executable rather than override it.
I changed it to use gcc to compile rather than g++. I recall that being an Xcode thing.
I updated it to use the more modern names of pkg-config packages for mono and glib. I made sure it used the glib flags too. iirc, glib's pkg-config is in the mac-ports dist location per my port file. so in my case, that's /opt/local/lib/pkgconfig/ .
I have a bug fix in there that deals with "Reflection Only" assemblies being scanned for types when they should not be.
I removed a clirmodule.il file that needs to not be there, in order for some of the build logic to function.
I added some code to make it skip scanning of generics that have no namespace. this is a hack and probably needs further review.
And there's ton of cruft in there where monodevelop was updating .csproj files and such.
On Jun 12, 2013, at 10:35 AM, Alon Dulce <alondu@gmail.com> wrote:
Hi,
I want to run python.NET on MAC OSX (Mountain Lion) and since I'm new to MAC/UNIX and I'm not a programmer I naturally turned to the web:
*1st : I tried iron python using eclipse with MONO (configuring eclipse iron python interpreter to the mono framework "/Library/Frameworks/Mono.framework/Versions/icy" file) - eclipse doesn't allow this and I got the following error:
"No output was in the standard output when trying to create the interpreter info."
*2nd : I tried python.NET on XAMARIN :
I found this link: http://curtis.schlak.com/2012/01/17/howto-run-pythonnet-on-osx.html
I followed all the instructions but it's not clear to me how can I write python in XAMARIN, import clr etc. (I set up the solution as explained in the link above but I'm not sure about the next step).
* 3rd try : I found a post on this mailing list : http://mail.python.org/pipermail/pythondotnet/2011-September/001171.html
I tried using the original makefile and setup.py (both makefiles) with "sudo setup.py install" and received the following error: "dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid /bin/sh: pkg-config: command not found Traceback (most recent call last): File "setup.py", line 46, in <module> argsDict = pkgconfig('glib-2.0', 'mono-2') File "setup.py", line 32, in pkgconfig raise RuntimeError("An error has occured") RuntimeError: An error has occured "
I also tried editing the makefiles and setup.py according to the diff file supplied in the thread but still no success.
Is there a makefile/ setup.py file that will work on MAC ? maybe some sort of step by step monkey guide... :-)
I appreciate the help, Alon. _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
participants (3)
-
Alon Dulce
-
brad@fie.us
-
Bradley Friedman