Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAC OS nfldb Installation #238

Open
cminton opened this issue May 6, 2017 · 18 comments
Open

MAC OS nfldb Installation #238

cminton opened this issue May 6, 2017 · 18 comments

Comments

@cminton
Copy link

cminton commented May 6, 2017

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.

  1. I have followed Russ Brooks' guide to install PostgreSQL and I think that is good.
  2. 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?

@BurntSushi
Copy link
Owner

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.

@cminton
Copy link
Author

cminton commented May 7, 2017

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

@BurntSushi
Copy link
Owner

@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:https://www.russbrooks.com/2010/11/25/install-postgresql-9-on-os-x

@caskam
Copy link

caskam commented May 7, 2017 via email

@cminton
Copy link
Author

cminton commented May 7, 2017

@BurntSushi I saw that, but I do not know how to log in as user postgres.

@cminton
Copy link
Author

cminton commented May 7, 2017

@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.

@BurntSushi
Copy link
Owner

@caskam Comments like that are completely inappropriate on this issue tracker. Please do not do it again.

@BurntSushi
Copy link
Owner

@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.

@cminton
Copy link
Author

cminton commented May 7, 2017

@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.

@andr3w321
Copy link

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

@cminton
Copy link
Author

cminton commented May 7, 2017

@andr3w321 Thanks. This is very helpful. More interested in ease of use than speed at the moment. I'll try it.

@ochawkeye
Copy link
Contributor

@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.

@cminton
Copy link
Author

cminton commented May 7, 2017

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.

@cminton
Copy link
Author

cminton commented May 7, 2017

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.

@AndrewRook
Copy link

AndrewRook commented May 7, 2017

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!

@cminton
Copy link
Author

cminton commented May 7, 2017

Thanks. I was trying to do this at the end of last year. I put it down and picked it back up.

@ryantuck
Copy link

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:

  1. download the database dump from here: http:https://burntsushi.net/stuff/nfldb/nfldb.sql.zip

  2. 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
  1. unzip the data dump:
⚡  ~/Downloads ⚡  unzip nfldb.sql.zip
Archive:  nfldb.sql.zip
  inflating: nfldb.sql
  1. 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
  1. connect and query away.

@cminton hope that helps.

@cminton
Copy link
Author

cminton commented Jul 17, 2017

Thanks Ryan. I'll try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants