Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "SageMath"

From Funtoo
Jump to navigation Jump to search
m (horizontal alignment to wrap text around thumbnail)
m
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
SageMath is mathematical software with features covering many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.
SageMath is mathematical software with features covering many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.
http://www.sagemath.org


[[File:Screenshot SageMath.png|right|300px|thumbnail|Screenshot from SageMath]]
[[File:Screenshot SageMath.png|right|300px|thumbnail|Screenshot from SageMath]]


== Installation ==
== Installation ==
There are two overlays that are needed to get Sage installed. The science-overlay and the sage-on-gentoo-overlay.
SageMath ebuilds are not present in the Funtoo portage tree. Instead these are available through separate overlays (repositories). To install SageMath on Funtoo Linux the overlay '''sage-on-gentoo''' is required, together with dependencies found in the overlay '''science'''.


=== Install and configure layman and overlays ===
Gentoo users will be familiar with the science overlay from Gentoo's Science Project (https://wiki.gentoo.org/wiki/Project:Science).
 
=== Install Required Overlays ===
====Using layman====
====Using layman====
The preferred way of getting sage-on-gentoo is layman. Make sure layman is installed with USE=git and correctly configured. You may find a guide for layman at: http://www.gentoo.org/proj/en/overlays/userguide.xml
The easiest (fastest) method of installing the required overlays is via the package layman ({{package|app-portage/layman}}). Make sure layman is installed with USE=git and correctly configured. You may find a guide for layman at: http://www.gentoo.org/proj/en/overlays/userguide.xml
 
Update your layman list:
Update your layman list:
{{console|body=
{{console|body=
Line 14: Line 19:
}}
}}


This overlay depends on science overlay. You will also need to add it, if not already installed:
Add the two overlays to Funtoo. Firstly is the science overlay (if not already installed):
{{console|body=
{{console|body=
###i## layman -a science
###i## layman -a science
}}
}}


Finally, add this overlay:
Finally, add the SageMath overlay:
{{console|body=
{{console|body=
###i## layman -a sage-on-gentoo
###i## layman -a sage-on-gentoo
}}
}}
====Ebuilds unmask====
Before being able to install you may need to unmask the required ebuilds. You can use already-made files, shipped with overlay, such as:
<code>sage-on-gentoo/package.unmask/sage</code>


To use this file permanently, place symbolic link to this file into your <code>/etc/portage/package.unmask</code> directory as shown below.
====(Alternative) Using Portage Repositories====
Users may add the '''science''' and '''sage-on-gentoo''' overlays as ''repositories'' in portage without the need for layman. Both overlays are available via https://github.com and portage is able to sync with them.
 
If not already present, first create a location for portage to store a local clone of the overlays.
{{console|body=
###i## mkdir /path/to/local-repos
}}
 
Before configuring portage we will manually clone the two repositories into this local folder using {{Package|dev-vcs/git}}. Starting with '''science''' for SageMath dependencies
{{console|body=
###i## cd /path/to/local-repos
###i## git clone https://github.com/gentoo-science/sci.git science
}}
and then '''sage-on-gentoo''' for the actual SageMath ebuilds
{{console|body=
###i## git clone https://github.com/cschwan/sage-on-gentoo.git
}}
 
The final step is to configure portage to be able to use these additional repositories. This is achieved by adding appropriate configuration settings to files saved within {{f|/etc/portage/repos.conf/}}. (More information on repositories can be found by reading {{c|man portage}}).
 
Using your favorite text editor, create and save the following file in {{f|/etc/portage/repos.conf/}} for the '''science''' repository.
{{file|name=/etc/portage/repos.conf/science.conf|body=
[science]
priority = 50
location = /path/to/local-repos/science
sync-type = git
sync-uri = https://github.com/gentoo-science/sci.git
auto-sync = Yes
}}
 
Now repeat the previous step for a second file in {{f|/etc/portage/repos.conf/}} corresponding to the '''sage-on-gentoo''' repository.
{{file|name=/etc/portage/repos.conf/sage.conf|body=
[sage-on-gentoo]
priority = 50
location = /path/to/local-repos/sage-on-gentoo
sync-type = git
sync-uri = https://github.com/cschwan/sage-on-gentoo.git
auto-sync = Yes
}}
{{important|The sage-on-gentoo repository has the repo_name 'sage-on-gentoo'. Setting the name in this .conf file to something else (e.g. "[sagemath]") will cause portage to complain.}}


Default directory for layman overlays, if not set manually, is <code>/var/lib/layman</code>.
If these previous steps are successful, portage will be able to access and update ebuilds within these two repositories. Initiate these repositories by simply running
{{console|body=
{{console|body=
###i##   ln -s /var/lib/layman/sage-on-gentoo/package.unmask/sage  /etc/portage/package.unmask/sage
###i## emerge --sync
}}
}}
Notice, that in this example, portage's package.unmask is directory , make sure to apply masks entries according to your preferred way of masks handle (directory or a flat file).


====Use flags====
===Apply Required package.use and package.unmask Settings===  
Since Sage's ebuild requires its dependencies to be built with several USE- flags a standard package.use file is provided as well:
{{note|This section favors {{f|/etc/portage/package.use}} and {{f|/etc/portage/package.unmask}} being '''directories''' instead of files which is a common case. Portage allows these to be directories and will processes the files contained within as if one single package.use or package.unmask file.}}
 
Before users must manually unmask dependencies and apply per-package USE flags required by SageMath. Fortunately the required settings are available in ready-made files shipped with the sage-on-gentoo overlay. Three files are required:
* <code>sage-on-gentoo/package.unmask/sage</code>
* <code>sage-on-gentoo/package.use/sage</code>
* <code>sage-on-gentoo/package.use/sage-unstable</code>
 
To use these files permanently, we will create symbolic links within <code>/etc/portage/</code>. Updates made to these files within the sage-on-gentoo overlay will transfer to your system with each {{c|emerge --sync}}.
 
The default directory for layman overlays, if not set manually, is <code>/var/lib/layman</code>. If a portage repository was used instead of layman, use the appropriate {{f|/path/to/local-repo}}. For the layman example we will create a symbolic links for the package.unmask file:
 
{{console|body=
{{console|body=
###i##   ln -s <path-to-layman>/sage-on-gentoo/package.use/sage /etc/portage/package.use/sage
###i## ln -s /var/lib/layman/sage-on-gentoo/package.unmask/sage /etc/portage/package.unmask/sage
}}
}}


On a stable build installations you may also need following file:
Similarly create a symbolic link for each of the two package.use files:
 
{{console|body=
{{console|body=
###i##   ln -s <path-to-layman>/sage-on-gentoo/package.use/sage-unstable /etc/portage/package.use/sage-unstable
###i## ln -s /var/lib/layman/sage-on-gentoo/package.use/sage  /etc/portage/package.use/sage
###i## ln -s /var/lib/layman/sage-on-gentoo/package.use/sage-unstable /etc/portage/package.use/sage-unstable
}}
}}


{{Note|With sage 6.8 a <code>99sage-doc-bin</code> file installed that makes it easy to use pre-built html documentation. This is recommended for ~arch users.}}
===Installing SageMath===
   
====Installing Sage====
{{console|body=
{{console|body=
  ###i## emerge -va sage
  ###i## emerge -va sci-mathematics/sage
}}
}}
Please, note that this will pull in a lot of dependencies. If you can not proceed with this step (because of circular dependencies, missing USE-flags, and so on), report this behavior.
Please, note that this will pull in a lot of dependencies. If you can not proceed with this step (because of circular dependencies, missing USE-flags, and so on), report this behavior.
==Testing your SageMath install==
From the console:
{{console|body=
###i## sage
}}
You will be asked to create password for SageMath's 'admin' account.
If successful, the command {{c|notebook()}} should launch the SageMath notebook in a new browser session (assuming that you are running X).
The command {{c|quit()}} will exit SageMath.
==Troubleshooting==
===USE flags===
When attempting to merge SageMath, portage is likely to indicate that certain packages require per-package USE flags to be set.
Read each message carefully. When appling per-package USE flags, save these to a file inside of {{f|/etc/portage/package.use/}} that is ''other than'' the two files that are symbolic links since changes could be overwritten with each overlay sync.
For example, add per-package use settings to a file {{f|/etc/portage/package.use/my-package-use}}.
===Circular Dependencies when installing===
This is an example of a circular dependency encountered when attempting to merge SageMath
{{console|body=
###i## emerge -pv sci-mathematics/sage
These are the packages that would be merged, in order:
Calculating dependencies... done!
[nomerge      ] sci-mathematics/sage-7.5.1-r1::sage-on-gentoo  USE="X doc-html sagenb -bliss -debug -doc-pdf -latex -libbraiding -libhomfly -modular_decomposition -testsuite" L10N="en -ca -de -fr -hu -it -ja -pt -ru -tr" PYTHON_TARGETS="python2_7"
[nomerge      ]  dev-python/ipython-5.3.0::gentoo  USE="notebook smp -doc -examples -matplotlib -mongodb -nbconvert -qt4 {-test} -wxwidgets" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6"
[ebuild  N    ]  dev-python/ipywidgets-6.0.0-r1::sage-on-gentoo  USE="{-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5
-python3_6" 817 KiB
[ebuild  N    ]    dev-python/widgetsnbextension-2.0.0::gentoo  PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 558
KiB
[ebuild  N    ]  dev-python/ipyparallel-6.0.2::gentoo  USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 2,312 KiB
[ebuild  N    ] sci-mathematics/sage-7.5.1-r1::sage-on-gentoo  USE="X doc-html sagenb -bliss -debug -doc-pdf -latex -libbraiding -libhomfly -modular_decomposition -testsuite" L10N="en -ca -de -fr -hu -it -ja -pt -ru -tr" PYTHON_TARGETS="python2_7" 20,944
KiB
[nomerge      ] dev-python/ipyparallel-6.0.2::gentoo  USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6"
[ebuild  N    ]  dev-python/notebook-4.4.1::gentoo  USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 10,135 KiB
[ebuild  N    ]  dev-python/ipykernel-4.5.2::gentoo  USE="{-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6"
87 KiB                                                                                                                                       
[ebuild  N    ]    dev-python/ipython-5.3.0::gentoo  USE="notebook smp -doc -examples -matplotlib -mongodb -nbconvert -qt4 {-test} -wxwidgets" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 4,852 KiB                                                                         
                                                                                                                                             
Total: 7 packages (7 new), Size of downloads: 39,702 KiB                                                                                     
                                                                                                                                             
* Error: circular dependencies:                                                                                                             
                                                                                                                                             
(dev-python/ipython-5.3.0:0/0::gentoo, ebuild scheduled for merge) depends on                                                                 
(dev-python/notebook-4.4.1:0/0::gentoo, ebuild scheduled for merge) (runtime)                                                               
  (dev-python/ipykernel-4.5.2:0/0::gentoo, ebuild scheduled for merge) (buildtime)                                                           
  (dev-python/ipython-5.3.0:0/0::gentoo, ebuild scheduled for merge) (buildtime)                                                             
                                                                                                                                             
* Note that circular dependencies can often be avoided by temporarily                                                                       
* disabling USE flags that trigger optional dependencies.                   
}}
The issue here is with {{c|dev-python/ipython}}. A successful workaround is to first merge it separately with the 'notebook' USE flag disabled.
{{console|body=
###i## USE="-notebook" emerge --ask --oneshot --verbose dev-python/ipython
}}
Now continue with the install of SageMath
{{console|body=
###i## emerge -va sci-mathematics/sage
}}

Latest revision as of 06:36, March 22, 2017

SageMath is mathematical software with features covering many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.

http://www.sagemath.org

Screenshot from SageMath

Installation

SageMath ebuilds are not present in the Funtoo portage tree. Instead these are available through separate overlays (repositories). To install SageMath on Funtoo Linux the overlay sage-on-gentoo is required, together with dependencies found in the overlay science.

Gentoo users will be familiar with the science overlay from Gentoo's Science Project (https://wiki.gentoo.org/wiki/Project:Science).

Install Required Overlays

Using layman

The easiest (fastest) method of installing the required overlays is via the package layman (app-portage/layman). Make sure layman is installed with USE=git and correctly configured. You may find a guide for layman at: http://www.gentoo.org/proj/en/overlays/userguide.xml

Update your layman list:

root # layman -L

Add the two overlays to Funtoo. Firstly is the science overlay (if not already installed):

root # layman -a science

Finally, add the SageMath overlay:

root # layman -a sage-on-gentoo

(Alternative) Using Portage Repositories

Users may add the science and sage-on-gentoo overlays as repositories in portage without the need for layman. Both overlays are available via https://github.com and portage is able to sync with them.

If not already present, first create a location for portage to store a local clone of the overlays.

root # mkdir /path/to/local-repos

Before configuring portage we will manually clone the two repositories into this local folder using dev-vcs/git. Starting with science for SageMath dependencies

root # cd /path/to/local-repos
root # git clone https://github.com/gentoo-science/sci.git science

and then sage-on-gentoo for the actual SageMath ebuilds

root # git clone https://github.com/cschwan/sage-on-gentoo.git

The final step is to configure portage to be able to use these additional repositories. This is achieved by adding appropriate configuration settings to files saved within /etc/portage/repos.conf/. (More information on repositories can be found by reading man portage).

Using your favorite text editor, create and save the following file in /etc/portage/repos.conf/ for the science repository.

   /etc/portage/repos.conf/science.conf
[science]
priority = 50
location = /path/to/local-repos/science
sync-type = git
sync-uri = https://github.com/gentoo-science/sci.git
auto-sync = Yes

Now repeat the previous step for a second file in /etc/portage/repos.conf/ corresponding to the sage-on-gentoo repository.

   /etc/portage/repos.conf/sage.conf
[sage-on-gentoo]
priority = 50
location = /path/to/local-repos/sage-on-gentoo
sync-type = git
sync-uri = https://github.com/cschwan/sage-on-gentoo.git
auto-sync = Yes
   Important

The sage-on-gentoo repository has the repo_name 'sage-on-gentoo'. Setting the name in this .conf file to something else (e.g. "[sagemath]") will cause portage to complain.

If these previous steps are successful, portage will be able to access and update ebuilds within these two repositories. Initiate these repositories by simply running

root # emerge --sync

Apply Required package.use and package.unmask Settings

   Note

This section favors /etc/portage/package.use and /etc/portage/package.unmask being directories instead of files which is a common case. Portage allows these to be directories and will processes the files contained within as if one single package.use or package.unmask file.

Before users must manually unmask dependencies and apply per-package USE flags required by SageMath. Fortunately the required settings are available in ready-made files shipped with the sage-on-gentoo overlay. Three files are required:

  • sage-on-gentoo/package.unmask/sage
  • sage-on-gentoo/package.use/sage
  • sage-on-gentoo/package.use/sage-unstable

To use these files permanently, we will create symbolic links within /etc/portage/. Updates made to these files within the sage-on-gentoo overlay will transfer to your system with each emerge --sync.

The default directory for layman overlays, if not set manually, is /var/lib/layman. If a portage repository was used instead of layman, use the appropriate /path/to/local-repo. For the layman example we will create a symbolic links for the package.unmask file:

root # ln -s /var/lib/layman/sage-on-gentoo/package.unmask/sage  /etc/portage/package.unmask/sage

Similarly create a symbolic link for each of the two package.use files:

root # ln -s /var/lib/layman/sage-on-gentoo/package.use/sage  /etc/portage/package.use/sage
root # ln -s /var/lib/layman/sage-on-gentoo/package.use/sage-unstable /etc/portage/package.use/sage-unstable

Installing SageMath

root # emerge -va sci-mathematics/sage

Please, note that this will pull in a lot of dependencies. If you can not proceed with this step (because of circular dependencies, missing USE-flags, and so on), report this behavior.

Testing your SageMath install

From the console:

root # sage

You will be asked to create password for SageMath's 'admin' account.

If successful, the command notebook() should launch the SageMath notebook in a new browser session (assuming that you are running X). The command quit() will exit SageMath.

Troubleshooting

USE flags

When attempting to merge SageMath, portage is likely to indicate that certain packages require per-package USE flags to be set.

Read each message carefully. When appling per-package USE flags, save these to a file inside of /etc/portage/package.use/ that is other than the two files that are symbolic links since changes could be overwritten with each overlay sync.

For example, add per-package use settings to a file /etc/portage/package.use/my-package-use.

Circular Dependencies when installing

This is an example of a circular dependency encountered when attempting to merge SageMath

root # emerge -pv sci-mathematics/sage

These are the packages that would be merged, in order:

Calculating dependencies... done!


[nomerge       ] sci-mathematics/sage-7.5.1-r1::sage-on-gentoo  USE="X doc-html sagenb -bliss -debug -doc-pdf -latex -libbraiding -libhomfly -modular_decomposition -testsuite" L10N="en -ca -de -fr -hu -it -ja -pt -ru -tr" PYTHON_TARGETS="python2_7"
[nomerge       ]  dev-python/ipython-5.3.0::gentoo  USE="notebook smp -doc -examples -matplotlib -mongodb -nbconvert -qt4 {-test} -wxwidgets" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6"
[ebuild  N     ]   dev-python/ipywidgets-6.0.0-r1::sage-on-gentoo  USE="{-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5
-python3_6" 817 KiB
[ebuild  N     ]    dev-python/widgetsnbextension-2.0.0::gentoo  PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 558
KiB
[ebuild  N     ]   dev-python/ipyparallel-6.0.2::gentoo  USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 2,312 KiB
[ebuild  N     ] sci-mathematics/sage-7.5.1-r1::sage-on-gentoo  USE="X doc-html sagenb -bliss -debug -doc-pdf -latex -libbraiding -libhomfly -modular_decomposition -testsuite" L10N="en -ca -de -fr -hu -it -ja -pt -ru -tr" PYTHON_TARGETS="python2_7" 20,944
KiB
[nomerge       ] dev-python/ipyparallel-6.0.2::gentoo  USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6"
[ebuild  N     ]  dev-python/notebook-4.4.1::gentoo  USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 10,135 KiB
[ebuild  N     ]   dev-python/ipykernel-4.5.2::gentoo  USE="{-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6"
87 KiB                                                                                                                                         
[ebuild  N     ]    dev-python/ipython-5.3.0::gentoo  USE="notebook smp -doc -examples -matplotlib -mongodb -nbconvert -qt4 {-test} -wxwidgets" PYTHON_TARGETS="python2_7 python3_4 -python3_5 -python3_6" 4,852 KiB                                                                          
                                                                                                                                               
Total: 7 packages (7 new), Size of downloads: 39,702 KiB                                                                                       
                                                                                                                                               
 * Error: circular dependencies:                                                                                                               
                                                                                                                                               
(dev-python/ipython-5.3.0:0/0::gentoo, ebuild scheduled for merge) depends on                                                                  
 (dev-python/notebook-4.4.1:0/0::gentoo, ebuild scheduled for merge) (runtime)                                                                 
  (dev-python/ipykernel-4.5.2:0/0::gentoo, ebuild scheduled for merge) (buildtime)                                                             
   (dev-python/ipython-5.3.0:0/0::gentoo, ebuild scheduled for merge) (buildtime)                                                              
                                                                                                                                               
 * Note that circular dependencies can often be avoided by temporarily                                                                         
 * disabling USE flags that trigger optional dependencies.

The issue here is with dev-python/ipython. A successful workaround is to first merge it separately with the 'notebook' USE flag disabled.

root # USE="-notebook" emerge --ask --oneshot --verbose dev-python/ipython

Now continue with the install of SageMath

root # emerge -va sci-mathematics/sage