ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 23 Mar 2021 06:00:29 +0100How to load .sobj files into Jupyter Notebookhttps://ask.sagemath.org/question/56331/how-to-load-sobj-files-into-jupyter-notebook/Hello! I am medium-new with Sage, and I'm trying to figure out how best to load a list across notebooks. I want to keep one notebook up and computing further entries of a list, while saving what I have so far so that I can use it in other codes. However, I can't figure out how to load .sobj files.
When I'm in a notebook, I save my file by `save(list,'list')` and I see list.sobj in my Jupyter Home directory. But I can't figure out how to load it into another notebook. I've tried `load('list.sobj')` and various iterations of `load('C:\Users\myusername\list.sobj')`but it keep getting the same error:
`'(list.sobj)' was not found in history, as a file, url, nor in the user namespace.`
What am I missing?elcardinTue, 23 Mar 2021 06:00:29 +0100https://ask.sagemath.org/question/56331/can't load a saved filehttps://ask.sagemath.org/question/53724/cant-load-a-saved-file/ I saved a function as hypotenuse.sobj and it shows up in the local directory listing. Then I tried
load("hypotenuse.sobj") and get this error:
AttributeError: Can't get attribute 'dist' on <module 'sage.all_cmdline' from '/opt/sagemath-9.1/local/lib/python3.7/site-packages/sage/all_cmdline.py'>
cybervigilanteMon, 05 Oct 2020 02:20:24 +0200https://ask.sagemath.org/question/53724/Save/load huge dictionaryhttps://ask.sagemath.org/question/45651/saveload-huge-dictionary/I have a huge dictionary about 50 GB. After generating this dictionary, I do not have any space left on my memory. I still run Sagemath standard `save(mydict, 'myfile')`. However, the save runs almost forever.
What should I do? Storing it in multiple files is also fine to me. I really need to load it again to use in the future.
Maybe another approach is helpful. Besides the above dictionary, I have another huge redundant dictionary `mydict2`, which I tried using `del mydict2` to get some extra memory for the above Sagemath `save`; however, the memory usage still stays the same as before calling `del mydict2`. I guess its keys are still stored in memory. I do not need keys from `mydict2`, but its value is used in `mydict`.imnvshMon, 04 Mar 2019 17:08:10 +0100https://ask.sagemath.org/question/45651/problem loading large filehttps://ask.sagemath.org/question/42124/problem-loading-large-file/I have a file which was generated and saved from a Sage notebook worksheet:
`save(G,'G4D200')`
where `G` is a list of vectors of length roughly 20 million, and the file 'G4D200.sobj` is about 370Mb.
When I try to load this file later to do some analysis
`new_G = load('/path_of_file.../G4D200.sobj')`
my computer goes deep into swap memory (with python eating it all up) and basically freezes. I have done the exact same thing for smaller file sizes (<10Mb) with no issues. I've tried waiting over 30 minutes and nothing seems to happen. Is this possibly a memory issue? Something with Sage? Possible workaround? I'm running the Sage notebook in fedora linux with an older laptop with 8Gb of RAM.
Thanks!Daniel LSun, 22 Apr 2018 20:45:13 +0200https://ask.sagemath.org/question/42124/Transferring variables between worksheets?https://ask.sagemath.org/question/11014/transferring-variables-between-worksheets/How can I save an expression from one worksheet and load it in another? I can certainly do
save(myvar,"myvar")
so that it will be available for future uses of the worksheet, but I want to open it up in *another* worksheet (basically I don't want to clog up this second worksheet with all the machinery used to create this variable). Can this be done easily?
AlasdairSun, 09 Feb 2014 07:08:05 +0100https://ask.sagemath.org/question/11014/save command in SAGEhttps://ask.sagemath.org/question/10496/save-command-in-sage/I'm trying to save a 'big' rational matrix in SAGE, but I'm running into problems.
After computing my matrix A, which has size 5 x 10,000 and each entry contains rational numbers in fraction form with total number of digits for numerator and denominator more than 10 pages, I run the following command:
save(A, DATA + 'A').
This gives me the following error message:
Traceback(most recent call last):
...
RuntimeError: Segmentation fault.
After this, I can't access A at all any more. In other words, when I try to compute say A[2,3], I get an error. However, before running the save command I was able to compute this entry. Also, I tried the same save command with a 'smaller' matrix and that worked fine. I should also note that I'm using a laptop with 64-bit operating system, x64-based processor, Windows 8, i7 CPU @ 2.40 GHz and 8 GB RAM. Let me know if you need further information. My questions are:
1. Why can't I save my matrix? Why do I get the above error message? What does it mean?
2. How can I save my matrix A? Is there any other way I can save it?Sandi XhumariSun, 01 Sep 2013 18:07:15 +0200https://ask.sagemath.org/question/10496/How to save a list to a file, with sage objects in it?https://ask.sagemath.org/question/8560/how-to-save-a-list-to-a-file-with-sage-objects-in-it/Hi, I am trying to save intermediate step of my calculation into a file, so that next time I can read the file to resume the calculation. Say, I need to save
f = function('a',var('t'))
s = [f] # together with other things in the list
How to save s to a file?
I tried two ways:
(1) Standard python module pickle cannot save sage objects, thus fails
(2) I converted s to a python object:
s = Sequence([f])
Now I can use s.save('file_name'). However, there is a bug that I cannot load using load('file_name')
RuntimeError: unknown function 'a' in archive
It is a known bug: http://trac.sagemath.org/sage_trac/ticket/11919 .
Unfortunately I am not expert enough to fix that bug, and I really want to get my work done before waiting for the fix. Is there any other way to save the list s currently?
In the bug report it is mentioned that an older version of Pynac doesn't have this bug. If there is no other work around, is it possible to downgrade Pynac within sage or I have to downgrade the whole sage?
Thanks!
tririverThu, 15 Dec 2011 19:59:22 +0100https://ask.sagemath.org/question/8560/save and loadhttps://ask.sagemath.org/question/8039/save-and-load/I have an algorithm which has a list of size 10^6 as output. I would like to run this program in one fast computer and then to upload this list and work in my compute. Can I do this? Have I to save the list as text?
Thanks.-.emiliocbaFri, 28 Oct 2011 09:05:11 +0200https://ask.sagemath.org/question/8039/Data files on public servers accesshttps://ask.sagemath.org/question/7866/data-files-on-public-servers-access/Hello!
I use public Sage servers from time to time and I have a question about their work.
For example, let's imagine I created a sheet which got a number 3. The corresponding folder with the same name is created on the server's hard disk. Then all what I do on that sheet is stored in that folder, right?
- If I want to store some data into a file or to create a text file with some table in it to use it further with other software, those files are also stored in the folder "3", right? If so, then can these files be accessed to only from this sheet or from another my sheets too?
- Who is the owner of such files? As far as I understand, when I open any one of my sheets, a new user is logged into a system and all the files created by this user during this session belong to this user.
- Can other users access my files if they get the same username under which I had saved those files?v_2eThu, 13 Jan 2011 09:09:11 +0100https://ask.sagemath.org/question/7866/