<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Muanis .plan &#187; en</title>
	<atom:link href="http://muanis.org/blog/category/en/feed/" rel="self" type="application/rss+xml" />
	<link>http://muanis.org/blog</link>
	<description>Trying to write more often about anything that matters</description>
	<lastBuildDate>Sun, 21 Feb 2010 05:11:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Compiling and Installing pyactivemq on mac osx with macports</title>
		<link>http://muanis.org/blog/2010/01/compiling-and-installing-pyactivemq-on-mac-osx-with-macports/</link>
		<comments>http://muanis.org/blog/2010/01/compiling-and-installing-pyactivemq-on-mac-osx-with-macports/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 00:13:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[en]]></category>
		<category><![CDATA[activemq]]></category>
		<category><![CDATA[pyactivemq]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://muanis.org/blog/?p=21</guid>
		<description><![CDATA[I had a hard time trying to configure pyactivemq in my osx box. At the beginning I followed a tutorial written by my friend Andreia Kumpera where she explains what she did on her machine to install pyactivemq (in portuguese). Well, I followed the tutorial and when I tested pyactivemq, I just got a meaningless [...]]]></description>
			<content:encoded><![CDATA[<div>I had a hard time trying to configure pyactivemq in my osx box. At the beginning I followed a tutorial written by my friend Andreia Kumpera where she explains what she did on her machine to <a href="http://www.semtexgirl.net/2009/07/24/compilando-o-pyactivemq-activemq-cpp-no-mac-os-x-leopard/" target="_blank">install pyactivemq (in portuguese)</a>. Well, I followed the tutorial and when I tested pyactivemq, I just got a meaningless error message.</div>
<div>I started googling around and couldn&#8217;t find much info, maybe pyactivemq is not used a lot in osx environments. I even asked on stackoverflow <a href="http://stackoverflow.com/questions/2013765/compiling-and-installing-pyactivemq-on-osx" target="_blank">how could I compile and install pyactivemq</a>. (a question that actually no one answered)</div>
<div>Back to the problem. The error message appeared when pyactivemq was imported, just like below:</div>
<div>
<pre class="brush: bash;">
$ python
Python 2.5.4 (r254:67916, Jan  5 2010, 17:58:16)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import pyactivemk
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
</pre>
</div>
<div><a href="http://muanis.org/blog/wp-content/uploads/2010/01/4252706235_3bee4fa54d_m.jpg"><img class="size-full wp-image-61 alignright" style="margin-left: 30px; margin-right: 30px; margin-top: 10px; margin-bottom: 10px;" title="4252706235_3bee4fa54d_m" src="http://muanis.org/blog/wp-content/uploads/2010/01/4252706235_3bee4fa54d_m.jpg" alt="" width="160" height="240" /></a></div>
<div>Things got a little bit clearer when I found this page talking about <a href="http://trac.mapnik.org/wiki/InstallationTroubleshooting#PythonVersionMismatch" target="_blank">troubleshooting installing mapnik</a>, it has an entry that looked very familiar to my problem of Interpreter not initialized. It says the problem is related to an error linking boost to the python libraries. And, most important, presenting (at least to me) the otool, wich shows every library which your program or library was linked to, after digging around a little bit figuring out how to run otool I was able to run it on my libraries, and what was the surprise when the following came up? Notice that my libraries were linked to apple&#8217;s version o python 2.5. After that I&#8217;runned it against my copy of pyactivemq and got the same result.</div>
<div>
<pre class="brush: bash;">
$ otool -L /opt/local/lib/libboost_python-mt.dylib | grep Python
/System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.1)
$ otool -L build/lib.macosx-10.5-i386-2.5/pyactivemq.so | grep Python
/System/Library/Frameworks/Python.framework/Versions/2.5/Python
</pre>
</div>
<div>After that I tried to import pyactivemq with apple&#8217;s python and everything worked.</div>
<div>
<pre class="brush: bash;">
$ /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python src/test/alltests.py
................................................
----------------------------------------------------------------------
Ran 48 tests in 4.795s
OK
</pre>
</div>
<div>Now I knew what the problem was, but not how to solve it. The problem was that something was wrong on macports that made boost compile against system&#8217;s python and not macport&#8217;s one. Mapnik Troubeshoot page pointed to <a href="https://trac.macports.org/ticket/17975" target="_blank">macports ticket #17975</a> where the issue was a little better explained. There is also a thred talking about the same problem where I could found some <a href="http://lists.macosforge.org/pipermail/macports-users/2009-January/013226.html" target="_blank">examples of otool usage</a>. If you want to know more about otool, check <a href="http://newman.mcmaster.ca/mt/doas/archives/2006/03/otool_os_x_vers.html" target="_blank">this</a> and <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/otool.1.html" target="_blank">otool man page</a>.</div>
<div>Then I reach <a href="https://trac.macports.org/ticket/17998" target="_blank">macports ticket #17998</a> which explain in details the problem and points to a possible solution.</div>
<div>
<pre class="brush: bash;">
$ cd /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config
$ ls -ld libpython2.5.a
libpython2.5.a -&gt; /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Python
$ rm libpython2.5.a
$ ln -s ../../../Python libpython2.5.a
$ ln -s ../../../Python libpython2.5.dylib
$ ls -ld libpython*
lrwxr-xr-x    1 root  wheel     15 Jan  6 12:46 libpython2.5.a -&gt; ../../../Python
lrwxr-xr-x    1 root  wheel     15 Jan  6 12:46 libpython2.5.dylib -&gt; ../../../Python
$ otool -L /opt/local/lib/libboost_python-mt.dylib | grep Python
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0)
$ cd /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config
</pre>
</div>
<div>This one alone does not solve the problem. You have to switch the link to macports python. To do this I used:</div>
<div>
<pre class="brush: bash;">
$ cd /opt/local/lib
$ ls -l ../Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
$ sudo rm ../Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
$ sudo mkdir ../Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
$ sudo cp -R /opt/local/lib/python2.5/* ../Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
$ sudo rm -rf /opt/local/lib/python2.5
$ sudo ln -s ../Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5 python2.5
</pre>
</div>
<div>After that I installed again the boost library, but this time after install, it was correct linkeg agains macports python 2.5</div>
<div>
<pre class="brush: bash;">
$ sudo port install boost +python25
$ otool -L /opt/local/lib/libboost_python-mt.dylib | grep Python
	/opt/local/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0)
</pre>
</div>
<div>then I&#8217;ve gonne to my pyactivemq distribution, build it again and it was also correct linked. And everything just worked. You should read carefully the <a href="https://trac.macports.org/ticket/17998" target="_blank">macports ticket #17998</a> because there are some sideeffects of what I just did.</div>
<div>Other References:</div>
<p><a href="http://stackoverflow.com/questions/2013765/compiling-and-installing-pyactivemq-on-osx" target="_blank">http://stackoverflow.com/questions/2013765/compiling-and-installing-pyactivemq-on-osx</a></p>
<p><a href="http://code.google.com/p/pyactivemq/wiki/Building" target="_blank">http://code.google.com/p/pyactivemq/wiki/Building</a></p>
]]></content:encoded>
			<wfw:commentRss>http://muanis.org/blog/2010/01/compiling-and-installing-pyactivemq-on-mac-osx-with-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Python MySQL connector on MacOS X 10.5</title>
		<link>http://muanis.org/blog/2009/10/installing-python-mysql-connector-on-macos-x-10-5/</link>
		<comments>http://muanis.org/blog/2009/10/installing-python-mysql-connector-on-macos-x-10-5/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 15:20:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[en]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://muanis.org/blog/?p=11</guid>
		<description><![CDATA[Today I spent a couple of hours trying to get Python MySQLdb connector to work on my Mac OS X 10.5.7. After some search over the internet I found that I should download MySQLdb distribution from SourceForge and compile it locally. I followed Mango Orange&#8217;s Installing Python MySQLdb 1.2.2 on Mac OS X. The information [...]]]></description>
			<content:encoded><![CDATA[<p>Today I spent a couple of hours trying to get Python MySQLdb connector to work on my Mac OS X 10.5.7. After some search over the internet I found that I should download <a href="http://sourceforge.net/projects/mysql-python/">MySQLdb</a> distribution from SourceForge and compile it locally. I followed Mango Orange&#8217;s <a href="http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/comment-page-1/#comment-17494">Installing Python MySQLdb 1.2.2 on Mac OS X</a>. The information here is an addendum as I took a slightly different approach.</p>
<div class="wp-caption alignright" style="width: 250px"><a href="http://www.flickr.com/photos/army_chaz/"><img class=" " title="Photo by Army Man Chaz" src="http://farm2.static.flickr.com/1310/845173739_c5b6bfeae5_m.jpg" alt="Photo by Army Man Chaz" width="240" height="180" /></a><p class="wp-caption-text">There is a long road to get stuff working</p></div>
<p>First of all, when I first installed MySQL I took the best version I could use with my computer. So, I got the 64 bit version. Aside all the problems I&#8217;ve ever had with 64-bit software, I still make the same mistake.</p>
<p>It turns out that Macs come with 32-bit python installed, and, obviously you cannot link 32-bit code with 64-bit code. So, to get everything working I needed to install a 32-bit version of MySQL, but &#8230;</p>
<p>As I&#8217;ve already compiled the code, the binaries were already generated, and dist and build directories were not deleted by python setup.py clean. As both directories were removed, compiling and installing was a breeze.</p>
<p>The error I was getting was the following:</p>
<pre>Macintosh:MySQL-python-1.2.2 muanis$ python
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import MySQLdb
  import sys, pkg_resources, imp
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "MySQLdb/__init__.py", line 19, in &lt;module&gt;
    import _mysql
  File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in &lt;module&gt;
  File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dynamic module does not define init function (init_mysql)</pre>
<p>If you&#8217;re getting the same error message, chances are that you&#8217;ve got the same problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://muanis.org/blog/2009/10/installing-python-mysql-connector-on-macos-x-10-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
