1

I have just installed Ubuntu 22.04 and tried to install Sagemath from

https://sagemanifolds.obspm.fr/install_ubuntu.html

with the following commands: sudo apt install sagemath-jupyter

Unfortunately a message with writing I have unmet dependencies appeared:

sudo apt-get install  sagemath 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: python3-rpy2 : Depends: python3 (< 3.9) but 3.10.6-1~22.04 is to be installed E: Unable to correct problems, you have held broken packages.

The command sudo apt update gives the following message in the end that might be helpful:

W: https://cloud.r-project.org/bin/linux/ubuntu/focal-cran40/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

My python version is python 3.10.6, yet I have installed an older version of python 3.7 as it is written on the above message. When I tried to install again the same message occured.

Furthermore, I tried to build Sagemath 9.7 from source as in the above site but my laptop stacks at the final command

MAKE="make -j8" make

at some point and I forced to shut it down. Could you please help me?

  • 1
    A quick scan of https://packages.ubuntu.com/jammy/sagemath-jupyter and I don't see the requirements you've pasted, as following links I get to no restriction of python3 eg. https://packages.ubuntu.com/jammy/sagemath that isn't met by https://packages.ubuntu.com/jammy/python3 thus I'd suggest reading all the messages you didn't provide for us. We're limited to reading only what you paste, and from what you pasted I don't see an issue (assuming you've not corrupted your sources) – guiverc Jan 16 '23 at 07:25
  • Having synaptic package manager in your system is handy when you encounter problems like these. Try the commands as described in this article: https://www.makeuseof.com/how-to-find-and-fix-broken-packages-on-linux/#how-to-find-and-fix-broken-packages – rusty Jan 16 '23 at 07:30
  • Ask for more help if needed. – rusty Jan 16 '23 at 07:31
  • If you check my first comment, sagemath-jupyter has no such requirement for python3-rpy2 thus the message you're getting relates to either badly added sources (read your sudo apt update messages) or other packages you've installed. The package python3-rpy2 is not found in Ubuntu repositories, thus is not required for any Ubuntu package like sagemath-jupyter found in Ubuntu repositories (if requirements don't exist, it won't build). Your error relates to details you've not pasted. You could explore using apt-cache policy python3-rpy2 to see where you got it, but it's not Ubuntu – guiverc Jan 16 '23 at 08:40
  • FYI: If you look at the jammy package found in Ubuntu (22.04) repositories ; you see https://packages.ubuntu.com/jammy/python3-rpy2 which requires "python3 (>= 3~)" and not what your messages show... – guiverc Jan 16 '23 at 08:44

2 Answers2

0

Try this:

sudo dpkg -l | grep '^.[^i]'

Then for each packages which have something other than ii in the first and second column, or an ..R in the third column, remove them using:

sudo dpkg --remove --force-all package_name
sudo apt-get clean
sudo apt-get update
sudo apt-get --fix-broken install

Hopefully, this should fix the broken package.

rusty
  • 16,327
0

I used sudo aptitude install sagemath

and gave me more than one solution to the unmet dependencies. I kept installing packages with aptitude and finally sagemath is now installed.

Thank you all!