Ask Your Question

fero's profile - activity

2018-06-27 12:01:13 -0600 received badge  Popular Question (source)
2017-09-17 19:06:26 -0600 received badge  Student (source)
2017-09-17 19:06:23 -0600 received badge  Self-Learner (source)
2017-09-17 18:52:35 -0600 received badge  Famous Question (source)
2016-07-28 09:31:27 -0600 received badge  Popular Question (source)
2013-09-30 20:26:52 -0600 received badge  Notable Question (source)
2013-04-15 19:56:36 -0600 received badge  Popular Question (source)
2012-08-11 06:48:54 -0600 answered a question psycopg2: ImportError libgnutls on Debian wheezy and sage-5.2-Ubuntu-10.04

I downloaded source tarball sage-5.2.tar and compiled it as suggested in #debian. At the end of compilation my problem wasn't solved.

I have found the following hack that now seemds to work:

mkdir /opt/sage/local/libhacks
ln -s /usr/lib/x86_64-linux-gnu/ /opt/sage/local/libhacks/
export LD_LIBRARY_PATH=/opt/sage/local/libhacks/:$LD_LIBRARY_PATH
BEFORE executing Django or Apache2 or whatever else has to do with psycopg2

I will write an update if it doesn't work...


2012-08-10 18:17:47 -0600 asked a question psycopg2: ImportError libgnutls on Debian wheezy and sage-5.2-Ubuntu-10.04

Hi all,

I am deploying my Django app in sage-5.2-Ubuntu-10.04 on a Debian Wheezy.

Almost all succeeds but I need python psycopg2 in sage environment and I cannot make it working.

My problem is verified when I import psycopg2:


ImportError: /usr/lib/x86_64-linux-gnu/ symbol gnutls_certificate_get_x509_cas, version GNUTLS_1_4 not defined in file with link time reference


The symbol gnutls_certificate_get_x509_ca seems to be in /usr/lib/x86_64-linux-gnu/ but not in /opt/sage-5.2-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/ that is checked because of the LD_LIBRARY_PATH setting.

Follow the story on how to reproduce it

sage -sh
esay_install --upgrade psycopg2

First error:

Processing psycopg2-2.4.5.tar.gz
Running psycopg2-2.4.5/ -q bdist_egg --dist-dir /tmp/easy_install-Vhfq2Z/psycopg2-2.4.5/egg-dist-tmp-sajtkC
no previously-included directories found matching 'doc/src/_build'
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1

Following and I have done:

ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
esay_install --upgrade psycopg2

Installed. WOW! BUT...

Python 2.7.3 (default, Jul 27 2012, 03:29:26) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/sage-5.2-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/psycopg2-2.4.5-py2.7-linux-x86_64.egg/psycopg2/", line 67, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: /usr/lib/x86_64-linux-gnu/ symbol gnutls_certificate_get_x509_cas, version GNUTLS_1_4 not defined in file with link time reference

I cannot find out the way to get out of this problem, please help me if you can.

Thank you very much Luca

2012-08-10 18:00:31 -0600 answered a question notebook api: new worksheet

I finally have decided to come back to the notebook interface. I proxy the notebook interface in an iframe, adjusted some css, and call some worksheet function with javascript.

I have not used sagecell version 1 because I have to present the user a cell with different interpreters from the %sage one.

I have not used sagecell > version 1 because I can't manage to install it.

For my needings now, it's enough this implementation, spent too much time on this activity for a "proof of concept", maybe we have the opportunity to improve sagecell in some future days...

2012-08-10 17:50:41 -0600 received badge  Editor (source)
2012-08-10 17:48:45 -0600 answered a question sage 5.2 and single cell server

Would you like to follow while trying these patches? Yet not too much testing done and first time "hg" user



as published now in sage-devel group.

This is for sagecell version 1.

2012-08-07 12:29:05 -0600 received badge  Teacher (source)
2012-08-07 12:29:05 -0600 received badge  Self-Learner (source)
2012-08-06 00:19:18 -0600 received badge  Scholar (source)
2012-08-06 00:19:18 -0600 marked best answer Math structures converters

If you look at the source for the Matlab interface, you can see that it's still pretty rudimentary. In particular,

sage: M = matrix([[1.1,2.0000002],[3,4]])
sage: M._ma<tab>

doesn't reveal anything to convert it to a Matlab format. It turns out you can do

sage: matlab.sage2matlab_matrix_string(M)
'[1.10000000000000, 2.00000020000000; 3.00000000000000, 4.00000000000000]'

but I don't know if that's what you want.

It looks like this interface could use a lot of work. Perhaps you might contribute? Also, if you really just need an open source alternative, Octave is very good. Interestingly, there is

sage: M._octave_()

though of course one needs Octave installed and in the PATH to use it.

On a tangential note, I've opened Ticket 13291 to do some minor improvement to our internal testing stuff that I found while looking at this.

2012-08-03 05:03:36 -0600 received badge  Supporter (source)
2012-08-03 05:03:25 -0600 answered a question Math structures converters

thx to logix in the irc channel I found a workaround to complete the circle, saved a struct to 'test.mat' file and then reload through scipy:

mat ='test.mat') 
print mat['test_struct'] 
M =matrix(mat['test_struct']) 
matlab("%s'" % 
2012-08-03 05:00:35 -0600 commented answer Math structures converters

thx to logix in the irc channel I found a workaround to do this: import mat ='/tmp/test.mat') print mat['test_struct'] M =matrix(mat['test_struct']) matlab("%s'" % matlab.sage2matlab_matrix_string(M))

2012-08-02 20:23:09 -0600 commented answer Math structures converters

it is wonderful thank you. The thing that I still do not understand is how to revert the result to sage. In example I have a "data" variable in a data.mat file and I can do: matlab.eval("load('/tmp/data.mat')") ; x = matlab("data") ; but then I can't convert it to sage variable. I wrote x.sage(), but I get a "NotImplementedError: Unable to parse output: ??? Undefined function or variable 'sage10'"

2012-07-25 02:09:25 -0600 commented question Math structures converters

let's say a simple example like: a = [ 1.1, 2.000002 ; 3, 4] , is there a way to say: sage_to_matlab(a) ? Of course I have already done this by hand with the help of str(), and " ".join() but what about number precision? and what about if I have a structure? like the one presented in Matlab "help save": s1.a = 12.7; s1.b = {'abc', [4 5; 6 7]}; s1.c = 'Hello!'; ? TIA

2012-07-21 21:59:08 -0600 asked a question notebook api: new worksheet

Hello I am here again for a second question:

I proxy connections to SAGE notebook, because I tried the API documented at

but I didn't succeed.

To my needing in this stage of early development is ok to proxy connections to notebook worksheet pages, hijacking the session cookie, but I'd like to be able to create new worksheets on the fly. I know it is a bit weird, but is it feasible in your opinion?

TIA Luca

2012-07-21 21:51:01 -0600 asked a question Math structures converters

Hi all,

I am a newbie here, and I am doing some experiments with SAGE. I am trying to tie up a kind of computing framework that could import data from some kind of sources, invoke generic algorhitms, and render output data.

SAGE and SAGENB are great works, thanks for developing them!

I see that SAGE can operate on many backends, but I can't figure out if it can convert data from one backend to another.

More explanation:

I have to take care mainly of Matlab syntax in this stage, but I'd like to save data in Python or a Scipy structure after import, and then perform conversion of data basing on the computing or rendering algorithm the user choose. Is it feasible with any library you developed or you know?

The "b plan" could be to use the Octave syntax which is 100% compatible. Am I right?

Respect to this question there are also performance,data size grow issues and maybe other to consider.

I hope this is the right place to post this question.

Thank you in advance Luca