My installation doesn't see matroids.all

60 views
Skip to first unread message

Smitty Horne

unread,
Jun 20, 2013, 10:28:29 AM6/20/13
to sage-s...@googlegroups.com
I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

Stefan van Zwam

unread,
Jun 20, 2013, 10:41:57 AM6/20/13
to sage-s...@googlegroups.com
Can you give some more info on what you did? Which commands did you issue? Which patches did you install? Did you rebuild Sage after installing them? Which Sage version?

Does your Sage have the "matroids" and "Matroid" keywords on startup?

--Stefan.

Smitty Horne

unread,
Jun 20, 2013, 10:53:53 AM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:
> I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

The command I used which caused the error was from sage.matroids.all import *. I added the matroids (I think this one worked) by using 'sage -hg clone https://bitbucket.org/matroid/sage_matroids' and '../sage setup.py install' from the shell prompt, but got the following errors on the second command:

Error compiling Cython file:
------------------------------------------------------------
...
versionB = 0
size = 0
limbs = 0
longsize = 0
for i from 0 <= i < self.nrows():
versionB, size, limbs, longsize, data = bitset_pickle(self._M[i])
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1366:65: undeclared name not builtin: bitset_pickle

Error compiling Cython file:
------------------------------------------------------------
...
versionB = 0
size = 0
limbs = 0
longsize = 0
for i from 0 <= i < self.nrows():
versionB, size, limbs, longsize, data = bitset_pickle(self._M[i])
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1366:73: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
if version != 0:
raise TypeError("object was created with newer version of Sage. Please upgrade.")
nrows, ncols, versionB, size, limbs, longsize, M = data
A = BinaryMatrix(nrows, ncols)
for i from 0 <= i < nrows:
bitset_unpickle(A._M[i], (versionB, size, limbs, longsize, M[i]))
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1397:23: undeclared name not builtin: bitset_unpickle

Error compiling Cython file:
------------------------------------------------------------
...
if version != 0:
raise TypeError("object was created with newer version of Sage. Please upgrade.")
nrows, ncols, versionB, size, limbs, longsize, M = data
A = BinaryMatrix(nrows, ncols)
for i from 0 <= i < nrows:
bitset_unpickle(A._M[i], (versionB, size, limbs, longsize, M[i]))
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1397:28: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
versionB = 0
size = 0
limbs = 0
longsize = 0
for i from 0 <= i < self.nrows():
versionB, size, limbs, longsize, data = bitset_pickle(self._M0[i])
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1885:74: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
limbs = 0
longsize = 0
for i from 0 <= i < self.nrows():
versionB, size, limbs, longsize, data = bitset_pickle(self._M0[i])
M0.append(data)
versionB, size, limbs, longsize, data = bitset_pickle(self._M1[i])
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1887:74: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
if version != 0:
raise TypeError("object was created with newer version of Sage. Please upgrade.")
nrows, ncols, versionB, size, limbs, longsize, M0, M1 = data
A = TernaryMatrix(nrows, ncols)
for i from 0 <= i < nrows:
bitset_unpickle(A._M0[i], (versionB, size, limbs, longsize, M0[i]))
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1918:29: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
raise TypeError("object was created with newer version of Sage. Please upgrade.")
nrows, ncols, versionB, size, limbs, longsize, M0, M1 = data
A = TernaryMatrix(nrows, ncols)
for i from 0 <= i < nrows:
bitset_unpickle(A._M0[i], (versionB, size, limbs, longsize, M0[i]))
bitset_unpickle(A._M1[i], (versionB, size, limbs, longsize, M1[i]))
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:1919:29: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
size = 0
limbs = 0
longsize = 0
ring = self._gf4
for i from 0 <= i < self.nrows():
versionB, size, limbs, longsize, data = bitset_pickle(self._M0[i])
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:2450:74: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
longsize = 0
ring = self._gf4
for i from 0 <= i < self.nrows():
versionB, size, limbs, longsize, data = bitset_pickle(self._M0[i])
M0.append(data)
versionB, size, limbs, longsize, data = bitset_pickle(self._M1[i])
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:2452:74: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
if version != 0:
raise TypeError("object was created with newer version of Sage. Please upgrade.")
nrows, ncols, ring, versionB, size, limbs, longsize, M0, M1 = data
A = QuaternaryMatrix(nrows, ncols, ring=ring)
for i from 0 <= i < nrows:
bitset_unpickle(A._M0[i], (versionB, size, limbs, longsize, M0[i]))
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:2483:29: Cannot convert 'bitset_t' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
raise TypeError("object was created with newer version of Sage. Please upgrade.")
nrows, ncols, ring, versionB, size, limbs, longsize, M0, M1 = data
A = QuaternaryMatrix(nrows, ncols, ring=ring)
for i from 0 <= i < nrows:
bitset_unpickle(A._M0[i], (versionB, size, limbs, longsize, M0[i]))
bitset_unpickle(A._M1[i], (versionB, size, limbs, longsize, M1[i]))
^
------------------------------------------------------------

sage/matroids/lean_matrix.pyx:2484:29: Cannot convert 'bitset_t' to Python object
Error running command, failed with status 256.

When I installed the patches, I used 'hg_sage.apply("trac_7477_setup_doc_load.patch")'; similar for the other patch. I did rebuild after running these two commands.

I am using Sage version 5.9, released 2013-04-30.

Thank you.

Smitty Horne

unread,
Jun 20, 2013, 10:54:32 AM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:
> I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

Oops, I forgot to say that, no, my Sage does not have "matroids" and "Matroid" on startup. Thanks.

Smitty

Smitty Horne

unread,
Jun 20, 2013, 10:56:17 AM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:

Stefan van Zwam

unread,
Jun 20, 2013, 11:15:35 AM6/20/13
to sage-s...@googlegroups.com

The command I used which caused the error was from sage.matroids.all import *. I added the matroids (I think this one worked) by using 'sage -hg clone https://bitbucket.org/matroid/sage_matroids' and '../sage setup.py install' from the shell prompt, but got the following errors on the second command:

Error compiling Cython file:
------------------------------------------------------------
...
        versionB = 0
        size = 0
        limbs = 0
        longsize = 0
        for i from 0 <= i < self.nrows():
            versionB, size, limbs, longsize, data = bitset_pickle(self._M[i])
                                                                ^
------------------------------------------------------------

These errors are because we moved some code out of our codebase and directly into Sage. I think this is the easiest way to get matroids to work right now:

0) From a terminal shell, run

/path/to/sage -clone mymatroid

(this will ensure the "main" branch of sage stays untouched, see http://www.sagemath.org/doc/developer/walk_through.html#creating-a-sandbox )

1) Download the .patch files from each of the following pages:

http://trac.sagemath.org/sage_trac/ticket/7477 (only the two mentioned in the description).

2) Start Sage from the directory to which you saved the patches, and issue these commands:

sage: hg_sage.apply("trac_14668_bitsets.patch")
sage: hg_sage.apply("trac_7477_setup_doc_load.patch")
sage: hg_sage.apply("trac_7477_code.patch")

Watch for any errors.

3) Quit Sage, run

/path/to/sage -b

4) Enjoy!

Smitty Horne

unread,
Jun 20, 2013, 11:42:10 AM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:
> I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

I got to the step of applying the patches and got the following error when I attempted to run hg_sage.apply("trac_14668_bitsets.patch") from the sage prompt:

syntax error near unexpected token `"trac_14668_bitsets.patch"'

Stefan van Zwam

unread,
Jun 20, 2013, 11:52:36 AM6/20/13
to sage-s...@googlegroups.com
That's weird, it looks like a Bash shell error. You are running Sage when entering those commands, right? Can you show what (if anything) is posted before the error? Should be something like

cd "/Users/stefan/sage-5.11.beta1/devel/sage" && sage --hg import   "/Users/stefan/Documents/coding/sage_matroids/trac_14668_bitsets.patch"
applying
/Users/stefan/Documents/coding/sage_matroids/trac_14668_bitsets.patch

 

Smitty Horne

unread,
Jun 20, 2013, 11:56:09 AM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:
> I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

Yes, I think it is a bash shell error. Actually nothing happens at all. Here is what I see:

Smittys-MacBook-Pro:sage swood$ hg_sage.apply("trac_14668_bitsets.patch"
-bash: syntax error near unexpected token `"trac_14668_bitsets.patch"'

Since you didn't say which directory should hold the patches, I just put them in the main directory off Applications; i.e., sage. Could that be part of the problem? Thanks.

Smitty Horne

unread,
Jun 20, 2013, 11:59:12 AM6/20/13
to sage-s...@googlegroups.com
Disregard previous. I need to be running Sage. Sorry!



--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/WcTASgo7p3U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.





--
PhiB

Stefan van Zwam

unread,
Jun 20, 2013, 11:59:35 AM6/20/13
to sage-s...@googlegroups.com
You're not running sage. Start Sage first, then from the prompt looking like

sage: 

issue those commands. See also


--Stefan.

Smitty Horne

unread,
Jun 20, 2013, 12:04:05 PM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:
> I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

Thank you. So sorry!

Smitty Horne

unread,
Jun 20, 2013, 12:10:37 PM6/20/13
to sage-s...@googlegroups.com
On Thursday, June 20, 2013 9:28:29 AM UTC-5, Smitty Horne wrote:
> I have installed the Sage program and, as far as I can tell, installed the matroids portion (including patches). But when I try to run the command 'from sage.matroids.all import *', I get an error that says "No module named matroids.all". Do any of you have an idea on what I am missing? Thank you very much.

Unfortunately, now my sage won't run... I am getting the following error: FYI it was running previously before I ran the -clone mymatroid command.

Smittys-MacBook-Pro:sage swood$ ./sage
----------------------------------------------------------------------
| Sage Version 5.9, Release Date: 2013-04-30 |
| Type "notebook()" for the browser-based notebook interface. |
| Type "help()" for help. |
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Applications/sage/local/bin/sage-ipython", line 6, in <module>
from sage.misc.interpreter import SageTerminalApp
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/interpreter.py", line 67, in <module>
import os, log, re, new, sys
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/log.py", line 65, in <module>
import latex
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/latex.py", line 60, in <module>
from sage.misc.cachefunc import cached_function, cached_method
ImportError: dlopen(/Applications/sage/local/lib/python2.7/site-packages/sage/misc/cachefunc.so, 2): Library not loaded: libcsage.dylib
Referenced from: /Applications/sage/local/lib/python2.7/site-packages/sage/misc/cachefunc.so
Reason: image not found
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/Applications/sage/local/lib/python/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/temporary_file.py", line 51, in delete_tmpfiles
from sage.misc.misc import SAGE_TMP
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/misc.py", line 39, in <module>
import sage.misc.prandom as random
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/prandom.py", line 58, in <module>
from sage.misc.randstate import current_randstate
ImportError: dlopen(/Applications/sage/local/lib/python2.7/site-packages/sage/misc/randstate.so, 2): Library not loaded: libcsage.dylib
Referenced from: /Applications/sage/local/lib/python2.7/site-packages/sage/misc/randstate.so
Reason: image not found
Error in sys.exitfunc:
Traceback (most recent call last):
File "/Applications/sage/local/lib/python/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/temporary_file.py", line 51, in delete_tmpfiles
from sage.misc.misc import SAGE_TMP
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/misc.py", line 39, in <module>
import sage.misc.prandom as random
File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/prandom.py", line 58, in <module>
from sage.misc.randstate import current_randstate
ImportError: dlopen(/Applications/sage/local/lib/python2.7/site-packages/sage/misc/randstate.so, 2): Library not loaded: libcsage.dylib
Referenced from: /Applications/sage/local/lib/python2.7/site-packages/sage/misc/randstate.so
Reason: image not found

Stefan van Zwam

unread,
Jun 20, 2013, 12:24:26 PM6/20/13
to sage-s...@googlegroups.com
Try

./sage -b

otherwise I'm out of my depth. You can (should be able to) go back to the original revision with

./sage -b main

--Stefan.

Michael Welsh

unread,
Jun 20, 2013, 4:23:03 PM6/20/13
to sage-s...@googlegroups.com
On 21/06/2013, at 4:10 AM, Smitty Horne <phi...@gmail.com> wrote:
>
> Unfortunately, now my sage won't run... I am getting the following error: FYI it was running previously before I ran the -clone mymatroid command.

Do you have XCode and the command-line tools installed?

Smitty Horne

unread,
Jun 20, 2013, 6:13:21 PM6/20/13
to sage-s...@googlegroups.com
Yes, actually I do. I ended up dumping the installation I had (which I had downloaded as a binary) and starting over, building it from the ground up. It has been running several hours, but I think perhaps doing it this way will resolve my issues. I hope so, at any rate! Thank you so much.
Message has been deleted

Smitty Horne

unread,
Jun 20, 2013, 10:19:57 PM6/20/13
to sage-s...@googlegroups.com
Superb!!! Building from the source solved my problem so, for the moment, I am up and running. Thanks to those who were patient with my questions!

-Smitty
Reply all
Reply to author
Forward
0 new messages