Error installing Plone on OpenSolaris using the Unified Installer
The Unified Installer builds and installs a specific python version that will be used by the zope instance providing plone. Unfortunately python gets built lacking some crucial features required by plone and so the install fails on open solaris.
After I have downloaded the Unified Installer package I had it unpacked and entered the package directory. I have entered the install command like this:
./install.sh standalone
After a while the install aborted and I got the following message:
Installing Python 2.6.4. This takes a while... Installing distribute... /export/home/roman/Plone/Python-2.6/bin/easy_install missing. Aborting. Installation has failed. See the detailed installation log at /export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/install.log to determine the cause.
Well let's look at install.log. The last few lines looked like this:
/usr/bin/ginstall -c -m 644 ./Misc/python.man \
/export/home/roman/Plone/Python-2.6/share/man/man1/python.1
Before install bootstrap.
Scanning installed packages
No setuptools distribution found
running install
Traceback (most recent call last):
File "./setup.py", line 175, in <module>
scripts = scripts,
File "/export/home/roman/Plone/Python-2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/export/home/roman/Plone/Python-2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/export/home/roman/Plone/Python-2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/packages/distribute-0.6.10/setuptools/command/install.py", line 73, in run
self.do_egg_install()
File "/export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/packages/distribute-0.6.10/setuptools/command/install.py", line 82, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "/export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/packages/distribute-0.6.10/setuptools/dist.py", line 361, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "/export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/packages/distribute-0.6.10/pkg_resources.py", line 1948, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/packages/distribute-0.6.10/setuptools/command/easy_install.py", line 21, in <module>
from setuptools.package_index import PackageIndex, parse_bdist_wininst
File "/export/home/roman/Downloads/Plone-4.0b1-1-UnifiedInstaller/packages/distribute-0.6.10/setuptools/package_index.py", line 2, in <module>
import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
File "/export/home/roman/Plone/Python-2.6/lib/python2.6/urllib2.py", line 92, in <module>
import httplib
File "/export/home/roman/Plone/Python-2.6/lib/python2.6/httplib.py", line 70, in <module>
import socket
File "/export/home/roman/Plone/Python-2.6/lib/python2.6/socket.py", line 46, in <module>
import _socket
ImportError: No module named _socket
Doing a quick search on the inet helped me to get this fixed. One has to enable the _socket feature in the python source code repackage and start all over. This seems to be a problem that affects the open solaris install only.
Let's do it:
$ cd packages $ tar -xvjf Python-2.6.4.tar.bz2 $ cd Python-2.6.4 $ vim Python-2.6.4/Modules/Setup.dist
Find the line:
#_socket socketmodule.c
and uncomment it by removing the leading #. Save an exit.
I tried to build, but it failed:
./Modules/socketmodule.c: In function `makesockaddr': ./Modules/socketmodule.c:1103: error: structure has no member named `ifr_ifindex' ./Modules/socketmodule.c:1104: error: `SIOCGIFNAME' undeclared (first use in this function) ./Modules/socketmodule.c:1104: error: (Each undeclared identifier is reported only once ./Modules/socketmodule.c:1104: error: for each function it appears in.) ./Modules/socketmodule.c: In function `getsockaddrarg': ./Modules/socketmodule.c:1411: error: `SIOCGIFINDEX' undeclared (first use in this function) ./Modules/socketmodule.c:1423: error: structure has no member named `ifr_ifindex' ./Modules/socketmodule.c: In function `init_socket': ./Modules/socketmodule.c:4589: error: `PACKET_LOOPBACK' undeclared (first use in this function) ./Modules/socketmodule.c:4590: error: `PACKET_FASTROUTE' undeclared (first use in this function) make: *** [Modules/socketmodule.o] Fehler 1
Ughh! Searing the inet for some advice or reference gave me no solution that I could use to solve the problem out of the box. The only thing that I could find that looked somehow meaningful was this article http://opensolaris.org/jive/thread.jspa?threadID=16134 it sayes something to the account that the solaris C interface to network has changed and looks different to what is expected here.
Finally I decided to user my own brain, analyze the C source and modify it so python will compile with the _socket module enabled.
Here is what I did:
Open the source file:
$ vim Python-2.6.4/Modules/socketmodule.c
In the beginning of the platform-dependend preprocessor hacks, that the author considers a terrible mess ;-) I entered the following block of code somewhere around line 153:
#if defined(__sun) # define ifr_ifindex ifr_index # undef HAVE_NETPACKET_PACKET_H #endif
Save and exit.
Pack the sources:
$ tar -cvjf Python-2.6.4.tar.bz2 Python-2.6.4
Now the install completed without warnings or errors.
One thing I should mention however:
I'm not a C-programmer and I'm not aware of all the implications that this change to the source might have. So if you decide to do it like this, please do it on you own risk.
Maybe someone reads this and fixes it. Since this seems to be broken for quite a while. I tried several versions of the plone Installer bundle an all of them failed with the same error.

