Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#11789 closed defect (worksforme)

compile python with ssl-support if possible

Reported by: Frank Polte Owned by: tbd
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords:
Cc: Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Frank Polte)

I wanted to use couchdb, but it was a real pain to find a way:

http://wiki.sagemath.org/couchdb

We should find a way that it will compile with ssl-support. A lot of other python eggs need this too.

Attachments (1)

py_compile_with_ssl.diff (19.5 KB) - added by Frank Polte 11 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by Frank Polte

Description: modified (diff)

comment:2 in reply to:  description ; Changed 11 years ago by Leif Leonhardy

Replying to FrankPolte:

We should find a way that it will compile with ssl-support. A lot of other python eggs need this too.

I haven't had any problems on Ubuntu (10.04.3 LTS) importing ssl (or _ssl).

I.e., after installing the (Debian) package libssl-dev (which includes the necessary header files, in contrast to libssl), then reinstalling our current Python 2.6.4.p11 spkg (with sage -f ..., to force reinstallation), all worked fine.

(Haven't tried to install couchdb into Sage's Python though.)

I agree that the documentation on how to [easy_]install Python packages for use with Sage could certainly be better.


For SSL, which is (or should be) ubiquitous, we could do a prerequisite check (although it currently isn't required by any part of Sage) before building Sage or its Python package, or at least test whether importing ssl works after installation, and issue a warning otherwise. (We already test that other crucial Python core packages are functional after the build, i.e., can be imported without errors at least, and exit with a more or less appropriate error message in case some don't.)

Unfortunately, running Python's own test suite gives a few (irrelevant) errors on almost any system, also depending on the configuration.

Changed 11 years ago by Frank Polte

Attachment: py_compile_with_ssl.diff added

comment:3 in reply to:  2 ; Changed 11 years ago by Frank Polte

Replying to leif:

Replying to FrankPolte:

We should find a way that it will compile with ssl-support. A lot of other python eggs need this too.

I haven't had any problems on Ubuntu (10.04.3 LTS) importing ssl (or _ssl). I.e., after installing the (Debian) package libssl-dev (which includes the necessary header files, in contrast to libssl), then reinstalling our current Python 2.6.4.p11 spkg (with sage -f ..., to force reinstallation), all worked fine. (Haven't tried to install couchdb into Sage's Python though.)

For me that doesn't worked. The problem was. that couchdb uses a special module called: HTTPSConnection which is juat there if SSL was directly compiled into the python-kernel. Installing OpenSSL or other SSL-packages doesn't helped me at all.

I agree that the documentation on how to [easy_]install Python packages for use with Sage could certainly be better. Yes there should be  wiki- or docu-page! It was a real pain for me to get it running. 

Btw. couchdb and other database modules are quite useful to get the result out of the box into other systems like web server or get data from them. I think this is really nice. But there is no need for creating spkg files if easy_install is working fine, especially for wrappers like couchdb.

comment:4 in reply to:  3 ; Changed 11 years ago by Frank Polte

Sorry here my answer again better to read:

For me that doesn't worked. The problem was. that couchdb uses a special module called: HTTPSConnection which is juat there if SSL was directly compiled into the python-kernel. Installing OpenSSL or other SSL-packages doesn't helped me at all.

And: Yes there should be wiki- or docu-page to easy_install! It was a real pain for me to get it running. Btw. couchdb and other database modules are quite useful to get the result out of the box into other systems like web server or get data from them. I think this is really nice. But there is no need for creating spkg files if easy_install is working fine, especially for wrappers like couchdb.

comment:5 in reply to:  4 Changed 11 years ago by Leif Leonhardy

Status: newneeds_info

Replying to FrankPolte:

For me that doesn't worked. The problem was. that couchdb uses a special module called: HTTPSConnection which is juat there if SSL was directly compiled into the python-kernel. Installing OpenSSL or other SSL-packages doesn't helped me at all.

Hmmm, I still cannot reproduce what exactly failed for you.

After reinstalling our unmodified Python spkg, with the libssl-dev Debian package installed in advance, the following all works for me:

$ ./sage --sh -c "easy_install http://pypi.python.org/packages/2.6/C/CouchDB/CouchDB-0.8-py2.6.egg#md5=b47f8fe5f0c76d7c45bf8e4805d43de4"

Starting subshell with Sage environment variables set.
Be sure to exit when you are done and do not do anything
with other copies of Sage!

Bypassing shell configuration files ...

Downloading http://pypi.python.org/packages/2.6/C/CouchDB/CouchDB-0.8-py2.6.egg#md5=b47f8fe5f0c76d7c45bf8e4805d43de4
Processing CouchDB-0.8-py2.6.egg
creating /tmp/Sage/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/CouchDB-0.8-py2.6.egg
Extracting CouchDB-0.8-py2.6.egg to /tmp/Sage/sage-4.7.2.alpha2/local/lib/python2.6/site-packages
Adding CouchDB 0.8 to easy-install.pth file
Installing couchdb-dump script to /tmp/Sage/sage-4.7.2.alpha2/local/bin
Installing couchpy script to /tmp/Sage/sage-4.7.2.alpha2/local/bin
Installing couchdb-load script to /tmp/Sage/sage-4.7.2.alpha2/local/bin
Installing couchdb-replicate script to /tmp/Sage/sage-4.7.2.alpha2/local/bin

Installed /tmp/Sage/sage-4.7.2.alpha2/local/lib/python2.6/site-packages/CouchDB-0.8-py2.6.egg
Processing dependencies for CouchDB==0.8
Finished processing dependencies for CouchDB==0.8
Exited Sage subshell.

Then, from Sage:

sage: import ssl
sage: import _ssl
sage: import couchdb
sage: from httplib import HTTPSConnection
sage: 

So does something else fail in a later stage when using couchdb?

(If so, we could include any necessary changes into our standard Python spkg, such that nobody would have to manually make changes to it, unless the build would fail in case e.g. libssl-dev, or other prerequisites, weren't available. It should be possible to circumvent the latter though, probably by additional changes.)


And: Yes there should be wiki- or docu-page to easy_install! It was a real pain for me to get it running.

Sorry for that.

Feel free to also contribute to e.g. the Sage Installation Guide or the FAQ; any improvements are always welcome.

comment:6 Changed 11 years ago by Frank Polte

I see. I just imported couchdb without the ssl and _ssl packages. But now it's working for me anyway. I will give the link to this trac in the wiki as well. Your way is easier and my is more python-couchdb-native, everybody should decide for his/her-self.

comment:7 Changed 10 years ago by Jeroen Demeyer

Milestone: sage-5.3sage-duplicate/invalid/wontfix
Resolution: worksforme
Reviewers: Jeroen Demeyer
Status: needs_infoclosed

Seems this can be closed then.

comment:8 Changed 10 years ago by Keshav Kini

FrankPolte?: leif was not saying that you must import ssl and _ssl before importing couchdb. He was just demonstrating that one can import ssl and _ssl, and then demonstrating that one can import couchdb. So his way is not more "python-couchdb-native". I think there was just some weirdness on your system which eventually happened to go away.

Note: See TracTickets for help on using tickets.