We had a problem today with M2Crypto package from pip repository in a CentOS server.


... Error: Unable to find 'opensslconf-x86_64.h'

The actual version in pip repositories is 0.21.1, but the setup.py file doesn't search for the correct headers in this version of CentOS 5.5 (It's old, I know :-) ).

There's an easy workaround to get it working, I found it in a Zenoss community thread, you can just add a new path to search for files to self.swig_opts list.

First, we can download it from pip, and modify the setup.py file.


pip install -d . M2Crypto==0.21.1
untar M2Crypto-0.21.1.tar.gz

BEFORE


#LINE 58
self.swig_opts = ['-I%s' % i for i in self.include_dirs + \                                                                                  
                 [opensslIncludeDir]]
self.swig_opts.append('-includeall')

AFTER


self.swig_opts = ['-I%s' % i for i in self.include_dirs + \                                                                                  
                 [opensslIncludeDir]]
self.swig_opts.append('-includeall')
self.swig_opts.append('-I/usr/include/openssl')

Then running python setup.py install might do the trick.