Adding LRS Library On SageMath

113 views
Skip to first unread message

Advay Goel

unread,
Dec 29, 2021, 12:12:47 AM12/29/21
to sage-devel
Hi All,

I use macOS Big Sur Version 11.1, and need to use the LRS Library for a project: 

def getVolume(self,eng='lrs'): """ needs Sage 5.9 for 'lrs' engine """ return self.poly.volume(engine=eng)*factorial(self.poly.dim())

Currently, whenever I run this function, I get 0, and I believe it is because LRS Library is not properly installed on my system (I checked using this code: link and it said LRS is not present). However, this doesn't make much sense to me as there is an LRS folder in my sage folder. Its location is Applications>SageMath>build>pkgs>lrslib.

Regardless, I downloaded LRS again and am trying to build Sage from source. To do that, I am running the following code:

make configure ./configure --enable-lrslib -q make -s V=0

However, every time I do this, the "make V=0" line fails. Specifically, the package
Scipy-1.6.3 fails to install. I attached the error message in the log file to this email and here is the message I get on terminal:

[scipy-1.6.3] installing. Log file: /Applications/SageMath/logs/pkgs/scipy-1.6.3.log

  [scipy-1.6.3] error installing, exit status 1. End of log file:

  [scipy-1.6.3]       Enabled     : AVX512F AVX512CD AVX512_KNL AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL

  [scipy-1.6.3]       Generated   : none

  [scipy-1.6.3]     CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/pv/fllpf5t54kx02fh87shrw79wvdtffs/T/pip-req-build-konopatv/build/temp.macosx-11.1-x86_64-3.9/ccompiler_opt_cache_clib.py

  [scipy-1.6.3]     Building wheel for scipy (PEP 517): finished with status 'error'

  [scipy-1.6.3]     ERROR: Failed building wheel for scipy

  [scipy-1.6.3]   Failed to build scipy

  [scipy-1.6.3]   ERROR: Failed to build one or more wheels

  [scipy-1.6.3]   Exception information:

  [scipy-1.6.3]   Traceback (most recent call last):

  [scipy-1.6.3]     File "/Applications/SageMath/local/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 180, in _main

  [scipy-1.6.3]       status = self.run(options, args)

  [scipy-1.6.3]     File "/Applications/SageMath/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 204, in wrapper

  [scipy-1.6.3]       return func(self, options, args)

  [scipy-1.6.3]     File "/Applications/SageMath/local/lib/python3.9/site-packages/pip/_internal/commands/wheel.py", line 174, in run

  [scipy-1.6.3]       raise CommandError(

  [scipy-1.6.3]   pip._internal.exceptions.CommandError: Failed to build one or more wheels

  [scipy-1.6.3]   Removed build tracker: '/private/var/folders/pv/fllpf5t54kx02fh87shrw79wvdtffs/T/pip-req-tracker-my_qdfh8'

  [scipy-1.6.3]   ********************************************************************************

  [scipy-1.6.3]   Error building a wheel for scipy-1.6.3

  [scipy-1.6.3]   ********************************************************************************

  [scipy-1.6.3]   

  [scipy-1.6.3]   real 4m19.931s

  [scipy-1.6.3]   user 5m43.471s

  [scipy-1.6.3]   sys 0m48.724s

  [scipy-1.6.3]   ************************************************************************

  [scipy-1.6.3]   Error installing package scipy-1.6.3

  [scipy-1.6.3]   ************************************************************************

  [scipy-1.6.3] Full log file: /Applications/SageMath/logs/pkgs/scipy-1.6.3.log

make[4]: *** [scipy-SAGE_VENV-no-deps] Error 1

make[3]: *** [/Applications/SageMath/local/var/lib/sage/installed/scipy-1.6.3] Error 2

make[2]: *** [all-start] Error 2

real 4m46.343s

user 5m56.467s

sys 0m57.756s

***************************************************************

Error building Sage.

The following package(s) may have failed to build (not necessarily

during this run of 'make all-start'):

* package:         scipy-1.6.3

  last build time: Dec 28 21:25

  log file:        /Applications/SageMath/logs/pkgs/scipy-1.6.3.log

  build directory: /Applications/SageMath/local/var/tmp/sage/build/scipy-1.6.3

It is safe to delete any log files and build directories, but they

contain information that is helpful for debugging build problems.

WARNING: If you now run 'make' again, the build directory of the

same version of the package will, by default, be deleted. Set the

environment variable SAGE_KEEP_BUILT_SPKGS=yes to prevent this.

make[1]: *** [all-start] Error 1

make: *** [all] Error 2

Does anybody know how to fix this so that I can properly use the LRS engine? Also, after downloading the lrslib file again, is there a specific place I am supposed to put it in the SageMath folder to ensure it runs correctly?

Thank you so much for any help!

Screen Shot 2021-12-28 at 9.40.20 PM.png

Dima Pasechnik

unread,
Dec 29, 2021, 6:58:49 AM12/29/21
to sage-devel
On Wed, Dec 29, 2021 at 5:12 AM Advay Goel <adva...@gmail.com> wrote:
>
> Hi All,
>
> I use macOS Big Sur Version 11.1, and need to use the LRS Library for a project:
>
> def getVolume(self,eng='lrs'): """ needs Sage 5.9 for 'lrs' engine """ return self.poly.volume(engine=eng)*factorial(self.poly.dim())
>
> Currently, whenever I run this function, I get 0, and I believe it is because LRS Library is not properly installed on my system (I checked using this code: link and it said LRS is not present). However, this doesn't make much sense to me as there is an LRS folder in my sage folder. Its location is Applications>SageMath>build>pkgs>lrslib.
>
> Regardless, I downloaded LRS again and am trying to build Sage from source.

it appears you are trying to do this using a binary distribution.
Instead, you should be using a source distribution.
https://doc.sagemath.org/html/en/installation/source.html
> --
> 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 sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/37268ccb-4530-453e-8246-6ea37ec71e87n%40googlegroups.com.

Advay Goel

unread,
Dec 29, 2021, 12:23:15 PM12/29/21
to sage-devel
Regarding the actual library itself, is that already on my system or will I have to download lrslib again? 

Samuel Lelievre

unread,
Jan 2, 2022, 4:26:17 AM1/2/22
to sage-devel
2021-12-29 04:12 UTC, Advay Goel on sage-devel:

>
> Hi All,
>
> I use macOS Big Sur Version 11.1, and need to use
> the LRS Library for a project:
>
> def getVolume(self,eng='lrs'):
>     """ needs Sage 5.9 for 'lrs' engine """
>     return self.poly.volume(engine=eng)*factorial(self.poly.dim())
>
> Currently, whenever I run this function, I get 0, and I believe
> it is because LRS Library is not properly installed on my system
> (I checked using this code: link and it said LRS is not present).
> However, this doesn't make much sense to me as there is an LRS
> folder in my sage folder. Its location is
> /Applications/SageMath/build/pkgs/lrslib

>
> Regardless, I downloaded LRS again and am trying to build Sage from source.

Inside the Sage source folder, build/pkgs contains a folder
for each "Sage package" (or "spkg"), whether standard, optional
or experimental, that Sage can install. For example, in your case,
the folder

  /Applications/SageMath/build/pkgs/lrslib

has the information about the `lrslib` spkg. That includes:

- `type`, which in this case contains the word "optional"
- `package-version.txt`, which has the version that Sage
  will try to install if it does not find a good enough
  system package to use
- `spkg-configure.m4`, which is in charge of detecting whether
  there is an appropriate system lrslib that Sage can use,
  instead of building lrslib specially for Sage; that file
  was added in Sage Trac ticket #27804, merged in Sage 9.3.rc3:
  https://trac.sagemath.org/ticket/27804

When you build Sage on macOS, it helps to first install
Homebrew, and to install many packages using Homebrew.

The Homebrew installation instructions are at

  http://brew.sh

(installing Homebrew is one line to cut and paste from that
website into a terminal).

Then, in a terminal, from your Sage folder, get the latest
development version of Sage:

    $ git checkout develop
    $ git pull origin develop --tags -q
    $ git branch -vv

Then make Sage aware of Homebrew and configure for the build:

    $ source .homebrew-build-env
    $ make configure
    $ ./configure --enable-lrslib

The output of that last command will contain suggestions
of packages to install via Homebrew for Sage to use rather
than having to build them; and it will indicate a command
to be run after installing extra Homebrew packages, to take
them into account when building Sage. Once you have followed
these suggestions, run

    $ MAKE='make -j8'  # to run 8 jobs in parallel
    $ make -s V=0

Then you should have a fully functional Sage with lrslib.

Don't hesitate if you have more questions.   --Samuel

Advay Goel

unread,
Jan 10, 2022, 10:39:34 AM1/10/22
to sage-devel

Thank you so much for your help!

I installed Homebrew and executed the code that you wrote out. However, when I ran the make -s V = 0 line, it still crashed in the same place. For some reason, it is unable to build the Scipy-1.6.3 package. I attached a screenshot of the error message to this email. Do you know what I'm doing incorrectly? 

Thanks,
Advay 
Screen Shot 2022-01-10 at 10.39.26 AM.png

Justin C. Walker

unread,
Jan 10, 2022, 3:11:10 PM1/10/22
to SAGE Development


> On Jan 10, 2022, at 07:39 , Advay Goel <adva...@gmail.com> wrote:
>
>
> Thank you so much for your help!
>
> I installed Homebrew and executed the code that you wrote out. However, when I ran the make -s V = 0 line, it still crashed in the same place. For some reason, it is unable to build the Scipy-1.6.3 package. I attached a screenshot of the error message to this email. Do you know what I'm doing incorrectly?

If you literally ran “make -s V = 0”, the problem is the spaces following V and =. With spaces, the “make” program sees 4 arguments: “-s”, “V”, “=“, and “0”. I think the last three should be one, i.e., “V=0”, no spaces.

HTH

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income
--------
When LuteFisk is outlawed,
Only outlaws will have LuteFisk
--------



Samuel Lelievre

unread,
Jan 10, 2022, 5:16:46 PM1/10/22
to sage-devel
One way to keep a good record of this failed build would be
```
$ THE_REPORT=sage-9-5-b9-fail-openblas
$ REPORTS=$HOME/sage-reports

$ REPORT=$REPORTS/$THE_REPORT
$ mkdir -p $REPORT

$ brew config > $REPORT/brew-config.txt
$ brew list --versions > $REPORT/brew-list-versions.txt

$ xcode-select -p > $REPORT/xcode-select-p.txt
$ xcode-select --version > $REPORT/xcode-select-version.txt
$ xcodebuild -version > $REPORT/xcodebuild-version

$ sysctl -n hw.ncpu > $REPORT/ncpu.txt
$ CLTOOLS=com.apple.pkg.CLTools_Executables
$ pkgutil --pkg-info=$CLTOOLS > $REPORT/cltools.txt

$ cd /Applications/SageMath
$ rsync -a config.log $REPORT
$ rsync -a logs/install.log $REPORT
$ rsync -a logs/pkgs/scipy*.log $REPORT
$ rsync -a logs/pkgs/openblas*.log $REPORT

$ (cd $REPORTS $$ tar cJf $THE_REPORT.tar.xz $THE_REPORT)
```

This will produce a compressed archive called
`~/sage-reports/sage-9-5-b9-fail-openblas.tar.xz`
which if you want you can upload somewhere (like dropbox,
wetransfer, etc) and email a link to for someone to have
a look; or you could even send it as an attachment,
as it should have a very moderate size.

After doing that, I would suggest to try the following.

Get a few more packages from Homebrew
```
$ brew update
$ brew upgrade
$ brew install \
  arb autoconf automake bdw-gc boost bzip2 cbc cmake curl ecl \
  flint fplll freetype gcc gd gengetopt gettext git glpk gmp \
  gpatch graphviz gsl igraph isl libatomic_ops libffi libiconv \
  libmpc libpng libtool libxml2 llvm mpfi mpfr nauty ncurses \
  ninja ntl openblas openssl pari pari-elldata pari-galdata \
  pari-galpol pari-seadata pcre pdf2svg pkg-config ppl python3 \
  qhull r readline singular sqlite suite-sparse texinfo tox xz \
  zeromq zlib
```

Get the latest development version of Sage
```
$ cd /Applications/SageMath

$ git checkout develop
$ git pull origin develop --tags -q
```

Check branch (should say SageMath 9.5.rc0)
```
$ git branch -vv
```

Clean up the last build attempt and start from scratch
```
$ export MAKE='make -j8'
$ export V=0
$ make -s distclean
$ source .homebrew-build-env
$ ./bootstrap -q
$ ./configure --enable-lrslib
$ make -s
```

If this fails, you could produce a report as above,
but naming the report differently, for instance
```
$ THE_REPORT=sage-9-5-rc0-2022-01-10
```
and adapting which log files you include (usually
it's good to include config.log and logs/install.log,
and select from logs/pkgs/*.log those that failed).

Of course feel free to adapt what information you
want to include in your report.  --Samuel
Reply all
Reply to author
Forward
0 new messages