Many thanks to all of you for your helpful suggestions. The structures that
cause the problems in all cases appear indeed to be integer matrices.
However, much of the saved data is composite, and I will probably use a
slightly different approach to conversion for each individual case.
The most complicated stored objects are directed graphs. For those I
currently plan to relabel them, save the labelling-map separately and
reattach the old labels in the new version of sage.
If this sort of incompatibility of unpickling reoccurs in the future
complex objects will be a pain to save, because the most abstract
structures will be the most painful to restore again or save in an
elementary form.
In case you are curious, for the submitted toy-example the command
.relabel(return_map=True)
returns the labelling map for the encoded directed graph:
{Free module of degree 3 and rank 1 over Integer Ring Echelon basis matrix:
[0 1 0]: 1, Free module of degree 3 and rank 2 over Integer Ring Echelon
basis matrix: [ 1 0 -1] [ 0 1 -1]: 0, Free module of degree 3 and rank 1
over Integer Ring Echelon basis matrix: [ 1 -1 1]: 2, Free module of degree
3 and rank 1 over Integer Ring Echelon basis matrix: [1 0 0]: 4, Free
module of degree 3 and rank 2 over Integer Ring Echelon basis matrix: [1 0
0] [0 0 1]: 3, Free module of degree 3 and rank 2 over Integer Ring Echelon
basis matrix: [1 0 0] [0 1 0]: 12, Free module of degree 3 and rank 1 over
Integer Ring Echelon basis matrix: [ 1 0 -1]: 8, Free module of degree 3
and rank 1 over Integer Ring Echelon basis matrix: [ 0 1 -1]: 6, Free
module of degree 3 and rank 1 over Integer Ring Echelon basis matrix: [ 1
-1 0]: 9, Free module of degree 3 and rank 2 over Integer Ring Echelon
basis matrix: [ 1 -1 0] [ 0 0 1]: 7, Free module of degree 3 and rank 2
over Integer Ring Echelon basis matrix: [ 1 0 0] [ 0 1 -1]: 10, Free module
of degree 3 and rank 1 over Integer Ring Echelon basis matrix: [0 0 1]: 11,
Free module of degree 3 and rank 2 over Integer Ring Echelon basis matrix:
[0 1 0] [0 0 1]: 5}
Nils Bruin schrieb am Samstag, 25. Juli 2020 um 03:26:13 UTC+2:
> On Friday, July 24, 2020 at 3:03:07 PM UTC-7, Udo Baumgartner wrote:
>>
>> I have lots of precomputed data computed by sage8.9 and before that I
>> rely on. The reason I save that data is that it took a lot of computation
>> time to obtain it. The data is saved as .sobj-files.
>>
>> Suddenly I get "invalid pickle data"-errors when trying to load some of
>> that data with the new version of sage. I am therefore unable to do
>> computations on top of the precomputed data.
>>
>> I strongly suspect that this issue is due to basing sage9.x on Python3.
>>
>> How do I convert the data so that I can use it in the new version of sage?
>>
> One way would be:
> - load it in a sage version where you still can
> - write the data in a text format (something json-like?)
> - use that to reconstruct the data in sage 9.x
>
> from that point you could use pickle again or, being burnt by it once, you
> might decide to stick with a more text-based format.
>
> An alternative is to use the pickle toolchain that exists on python (and
> to which sage adds quite a bit!) to analyse and debug the unpickling on
> sage 9.x. Pickle is a well-defined format with good specifications and
> override procedures to make "outdated" pickles readable. It would be a
> fairly custom job in principle, but you might find it's just a few things
> that have changed. Or someone else has already discovered that and can
> describe a few steps that likely make your pickle readable again (although
> I'm not aware of any work in that direction -- and here is a good place to
> post)
>
> In your case the problem seems to be with a matrix with integer entries.
> That's a data structure for which json could work really well, so if you
> can arrange access to an older sage version, the json route may be fairly
> easy. Otherwise, you'd have to intercept the call pickle makes to the
> unpickler routine the error is generated in and make sure the data is
> parsed in the old way. That's probably doable, but will require a
> significant time investment. It might be helpful to look in the git history
> of the routine
> sage.matrix.matrix_integer_dense.Matrix_integer_dense._unpickle, since
> may well show what changed (and what you need to undo to make it work!)
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-devel/ce01eb3d-0835-4e5a-9c3d-f15604ec1418n%40googlegroups.com.