nfldb
nfldb copied to clipboard
MAC OS nfldb Installation
Has anyone written a start to finish set of instructions for setting up nfldb on a MAC? I am very good at tech and very good at programming, but I am by no means an OS savvy guy. I just do not understand what I am doing to set this up and do not understand the errors I am getting. Also, the instructions seem to jump from one type of installation to the other and I cannot follow where I should go.
To me, nfldb is an SQL database. I simply need the db and code that understands the structure of the db, so I can make sql queries against it. I just do not understand what the other installation is for. Maybe PostgreSQL needs other libraries. Sorry for the rant.
- I have followed Russ Brooks' guide to install PostgreSQL and I think that is good.
- I have installed pgAdmin 4 and created a local user db.
Nothing else seems to work after that point and I do not understand the errors I get. Can anyone help?
If you don't tell us the commands you've tried and if you don't tell us the errors you get when you try them, then we cannot help you.
It sounds like you're having trouble install the nfldb Python module. For that, you need Python 2.7 and pip.
sh-3.2# initdb -D /var/lib/postgres/data --locale=en_US.UTF-8 --encoding=UNICODE initdb: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
[~] systemctl enable postgresql -bash: systemctl: command not found [~] createuser -U postgres -E -P nfldb Enter password for new role: Enter it again: createuser: could not connect to database postgres: FATAL: role "postgres" does not exist
@cminton If a command doesn't work, then you shouldn't just ignore it and move on. You need to stop and figure out why and look at the error messages. The first command you run, initdb -D ... tells you exactly what the problem is: you can't run that command as root. The Linux instructions tell you to login as the postgres user. I don't know whether you need to do that on the Mac. I think you should take another look at the PostgreSQL directions for the Mac (or look elsewhere for better instructions): http://www.russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
.... you're "very good at programming" ...
On Sat, May 6, 2017 at 10:27 PM, Andrew Gallant [email protected] wrote:
@cminton https://github.com/cminton If a command doesn't work, then you shouldn't just ignore it and move on. You need to stop and figure out why and look at the error messages. The first command you run, initdb -D ... tells you exactly what the problem is: you can't run that command as root. The Linux instructions tell you to login as the postgres user. I don't know whether you need to do that on the Mac. I think you should take another look at the PostgreSQL directions for the Mac (or look elsewhere for better instructions): http://www.russbrooks.com/ 2010/11/25/install-postgresql-9-on-os-x
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BurntSushi/nfldb/issues/238#issuecomment-299678029, or mute the thread https://github.com/notifications/unsubscribe-auth/AHkDBns49LIan9DmEaz6rTaWJZ1Cwg9bks5r3SwBgaJpZM4NS7em .
@BurntSushi I saw that, but I do not know how to log in as user postgres.
@caskam, there is a large difference between being able to programming in C++ or Python using a well defined API and understanding the guts of an OS well enough to know how to install software so that it can be used. As I said, I do not know anything about the MAC OS.
@caskam Comments like that are completely inappropriate on this issue tracker. Please do not do it again.
@cminton I'm afraid you're on your own. Logging in as another user can be done with sudo su postgres, assuming the postgres account already exists. Otherwise I think you'll need to find additional instructions for setting up postgres on mac.
@BurntSushi thanks. I try that, but it needs a password and I do not know what the password is. I have to figure that out.
It will be slower to query but if it you just want a quick and easy solution you can create a db and user with cpanel on a host provider like bluehost/godaddy etc
@andr3w321 Thanks. This is very helpful. More interested in ease of use than speed at the moment. I'll try it.
@cminton Strictly out of curiosity, what has forced you to use MAC OS exclusively? In the past, you had a few detailed questions that implied you were up and running in a working environment.
I have used the nflgame API with very good success. However, the docs, while very good, are not always complete and I do bump into issues. It has been suggested that I move to nfldb - that it would be easier. I am also concerned that at some point, I will be forced to nfldb if the API becomes deprecated. I am good with APIs and also with SQL. I thought I should move to nfldb. Unfortunately, I am a complete novice with respect to MAC OS and am stumped with how to install and setup nfldb. This is a hobby - not my day job.
I am extremely appreciative for nflgame. It is fantastic and has allowed me to do a lot of fun analysis for fantasy football. I do not want anyone to think I am complaining.
Edit: looks like I already linked you to this as part of #215, I knew your name was familiar! Sorry for the accidental re-post. I haven't updated that guide since I last linked you to it, so I can't imagine it'll be any help.
@cminton I wrote down some instructions for installing nfldb on a Mac as part of documentation for a package I wrote that uses nfldb as a data source. It was mostly notes to myself if I ever needed to re-install from scratch and is now over a year old so I can't promise it will be able to help you, but if you want to take a look you can find them here. Good luck!
Thanks. I was trying to do this at the end of last year. I put it down and picked it back up.
i've also found that I have no use for the python module myself - I'd rather just write straight SQL to do my analysis.
If you already have a postgres database set up that you can access via psql, then:
-
download the database dump from here: http://burntsushi.net/stuff/nfldb/nfldb.sql.zip
-
create a database where you'll put everything:
⚡ ~/Downloads ⚡ psql
psql (9.6.2)
Type "help" for help.
ryan.tuck=# create database blah;
CREATE DATABASE
- unzip the data dump:
⚡ ~/Downloads ⚡ unzip nfldb.sql.zip
Archive: nfldb.sql.zip
inflating: nfldb.sql
- load the data into your newly-created database (this will take a while because there's a bunch of data but it will show you a whole lot of output).
⚡ ~/Downloads ⚡ psql -d blah < nfldb.sql
- connect and query away.
@cminton hope that helps.
Thanks Ryan. I'll try that.