These instructions are for macOS 10.12 or later.
Using Homebrew:
brew install python3 pypy3 postgresql ossp-uuidAlternatively, you can install these packages manually:
Make sure pip and virtualenv are up to date:
pip3 install --upgrade pip
pip3 install --upgrade virtualenvCheck out source code using git:
cd ~
git clone https://github.com/mideind/Greynir
cd ~/GreynirCreate and activate virtual environment, install required Python packages:
virtualenv -p /usr/local/bin/pypy3 venv
source venv/bin/activate
pip install -r requirements.txtConnect to PostgreSQL database:
psqlCreate user (replace your_name with your username):
create user reynir with password 'reynir';
create user your_name;
alter role your_name with superuser;
Create database:
create database scraper with encoding 'UTF8' LC_COLLATE='is_IS.UTF-8' LC_CTYPE='is_IS.UTF-8' TEMPLATE=template0;
Enable uuid extension:
\c scraper
create extension if not exists "uuid-ossp";
Verify that the uuid extension is enabled:
select * from pg_extension;
and then \q to quit the postgres client.
Finally, create the database tables used by Greynir (this will only create the tables if needed, and no existing data is erased):
cd ~/Greynir
python scraper.py --initChange to the Greynir repo directory and activate the virtual environment:
cd ~/Greynir
source venv/bin/activateDefaults to running on localhost:5000 but this
can be changed in config/Greynir.conf.
python main.pypython scraper.pyNB: Due to issues with Python's fork() in recent versions of macOS, you
may need to run the following shell command in order for scraping to work:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES./shell.shStarts an IPython shell with a database session (s),
the Greynir parser (r) and all SQLAlchemy database models preloaded. For
more info, see Using the Greynir Shell.