3

I am running XUbuntu 14.04 and today I issued sudo apt-get upgrade on my system and the output was

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up sagemath-upstream-binary (6.7ppa7) ...
Running Sage once as root to set paths
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.7, Release Date: 2015-05-17                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
File "/usr/lib/sagemath/src/bin/sage-ipython", line 7, in <module>
from sage.repl.interpreter import SageTerminalApp
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/__init__.py", line 3, in <module>
from sage.repl.ipython_extension import load_ipython_extension
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/repl/ipython_extension.py", line 59, in <module>
from IPython.core.magic import Magics, magics_class, line_magic
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/__init__.py", line 45, in <module>
from .config.loader import Config
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/__init__.py", line 6, in <module>
from .application import *
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/application.py", line 9, in <module>
import json
File "/usr/lib/sagemath/local/lib/python/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/usr/lib/sagemath/local/lib/python/json/decoder.py", line 5, in <module>
import struct
File "/usr/lib/sagemath/local/lib/python/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing package sagemath-upstream-binary (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
sagemath-upstream-binary
E: Sub-process /usr/bin/dpkg returned an error code (1)

It appears that there is something wrong with sage and indeed issuing sage returns

┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.7, Release Date: 2015-05-17                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
File "/usr/lib/sagemath/src/bin/sage-ipython", line 7, in <module>
from sage.repl.interpreter import SageTerminalApp
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/__init__.py", line 3, in <module>
from sage.repl.ipython_extension import load_ipython_extension
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/repl/ipython_extension.py", line 59, in <module>
from IPython.core.magic import Magics, magics_class, line_magic
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/__init__.py", line 45, in <module>
from .config.loader import Config
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/__init__.py", line 6, in <module>
from .application import *
File "/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/config/application.py", line 9, in <module>
import json
File "/usr/lib/sagemath/local/lib/python/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/usr/lib/sagemath/local/lib/python/json/decoder.py", line 5, in <module>
import struct
File "/usr/lib/sagemath/local/lib/python/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct

Does anyone have an idea what is wrong with my system? If so, how can I fix it?

Calcius
  • 238
  • 3
  • 11

2 Answers2

1

It looks like there is a problem in the build uploaded to the mirror. They are trying to fix it. A temporary fix is to revert back to a previous version by using the following command

sudo apt-get install sagemath-upstream-binary=6.6ppa1
sudo apt-mark hold sagemath-upstream-binary 

For more information about it go to This link. You can also follow the discussion there as they will post the fix when it is done.

Calcius
  • 238
  • 3
  • 11
  • Thanks for the info, but 6.6ppa1 no longer works. Now you need: wget https://launchpad.net/~aims/+archive/ubuntu/sagemath/+build/7362961/+files/sagemath-upstream-binary_6.6ppa1_amd64.deb sudo dpkg -i sagemath-upstream-binary_6.6ppa1_amd64.deb sudo apt-mark hold sagemath-upstream-binary – jaia Jun 01 '15 at 01:32
  • 1
    Things are resolved now. You can just upgrade your system as usual. And if you used the command with "holding" the upstream binary then just use the following to unhold it. sudo apt-mark unhold sagemath-upstream-binary – Calcius Jun 04 '15 at 23:35
0

Well it appears a single application is causing this problem from lack of dependencies and/or broken packages. This can happen from time to time.

As a possible fix you can try copying and executing the script below to see if it re-mediates your problem. Since the script does not pass control back to the command-line-interface, as running individual commands does, the package manager should build and fix the dependencies as the script is executed with out having broken packages.

#! /bin/bash

sudo apt-get update

sudo apt-get -f install -y

sudo updatedb

sudo apt-get -f upgrade -y

sudo apt-get -f install -y 

sudo updatedb

exit

Copy the script into gedit and save it. Then from command line, change the mode of access to executable and execute the script using the sudo command:

:~$ chmod +x scriptname.sh

:~$ sudo ./scriptname.sh

If this does not re-mediate your problem, purge sage and it will remove all your dependencies for the application. Then reinstall sage.

:~$ sudo apt-get purge sage

:~$ sudo apt-get autoremove -y

:~$ sudo apt-get install sage

NOTICE: I did not put the -y flag on the apt-get purge sequence because sage could be linked to ubuntu-desktop package which inturn will take your whole desktop environment. To avoid this you will be prompted with a (Yes/No) option. If you see *XUbuntu-desktop as one of the packages to be removed then enter no as the option.

If this not successful re-post and the Ubuntu Universe will help you with another work around!

Good Luck and Go Ubuntu!

oOpSgEo
  • 541
  • 2
  • 9