Make sure that SageMath is installed. Also, we will use the following Python libraries, which will be installed in Sage shell (see Install below).
The following libraries will be used outside of Sage (for ML experiments).
To use external python libraries in Sage, you need to install them through Sage shell:
-
Open Sage shell in terminal as
sage --sh -
Use
piporpip3to installpolarsandlmfdb-lite. If you are using Mac OS, you probably need to installpolars-lts-cpu, see this issue.pip3 install polars-lts-cpu tqdm scikit-learn matplotlib numpy pip3 install -U "lmfdb-lite[pgbinary] @ git+https://github.com/roed314/lmfdb-lite.git" -
Exit the Sage shell.
exit
Now you can use these libraries in Sage as:
$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.3, Release Date: 2024-03-19 │
│ Using Python 3.11.8. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: import polars as pl
sage: df = pl.DataFrame()
sage: df
shape: (0, 0)
┌┐
╞╡
└┘
python3 -m venv .venv
source .venv/bin/activate
pip3 install polars-lts-cpu scikit-learn matplotlib numpy ipykernel
cd src
sage nf_query.sage
Data will be stored in the directory src/data_nf. This would take about 3 hours.
See src/README.md.