nfldb
nfldb copied to clipboard
nfldb Mac installation
Has anyone installed nfldb on the mac? I have installed postgres and pgAdmin. I am at the point where I create the actual postgresql db. The following command is not recognized:
systemd-tmpfiles --create postgresql.conf
Systemd is a Linux init system. It wouldn't be available on a Mac.
On Dec 3, 2016 09:09, "Charlie Minton" [email protected] wrote:
Has anyone installed nfldb on the mac? I have installed postgres and pgAdmin. I am at the point where I create the actual postgresql db. The following command is not recognized:
systemd-tmpfiles --create postgresql.conf
— 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/215, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb34kinENehFLB07J0uKU1g5wVMN_GVks5rEXf-gaJpZM4LDTSY .
Thanks Andrew. I am trying to set up nfldb, so I can move to it. I am excellent at application development, but very out of touch with systems, so not so good at this type of set up. Does anyone know what steps I take from this point to be able to use nfldb on a Mac?
It sounds like you need to find a generic tutorial for setting up postgres on a mac. You'll probably also want to look up how to install the psycopg2 python module for mac.
On Dec 3, 2016 10:17, "Charlie Minton" [email protected] wrote:
Thanks Andrew. I am trying to set up nfldb, so I can move to it. I am excellent at application development, but very out of touch with systems, so not so good at this type of set up. Does anyone know what steps I take from this point to be able to use nfldb on a Mac?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BurntSushi/nfldb/issues/215#issuecomment-264645065, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb34qvK-mrvD3q1cLVT9eEE1tp2D8Eeks5rEYgggaJpZM4LDTSY .
@cminton I wrote up the steps I had to go through to get nfldb working on my Mac here. It's mostly written so I wouldn't forget how to do it myself, but it might have some useful tips.
@AndrewRook thank you. When I get to
postgres -D /usr/local/var/postgres
It just seems to hang there. Is it waiting for something from me?
Yeah, that's normal - that command is running the database in the foreground (the pg_ctl -D /usr/local/var/postgres -l logfile start
command right below it is to run the db in the background, although I prefer running postgres in the foreground so I can kill it easily).
If you decide you're happy running postgres in the foreground (ctrl-c should kill it if you want to try the background command) you'll need to open up a new terminal window (command+n) or tab (command+t) and continue there.
I figured it was looping. I should have thought of opening another terminal window. That was dumb of me.
Any idea what this error is? I am superuser, so do not think it is permissioning...
Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784, in install **kwargs File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files isolated=self.isolated, File "/Library/Python/2.7/site-packages/pip/wheel.py", line 377, in move_wheel_files clobber(source, dest, False, fixer=fixer, filter=filter) File "/Library/Python/2.7/site-packages/pip/wheel.py", line 316, in clobber ensure_dir(destdir) File "/Library/Python/2.7/site-packages/pip/utils/init.py", line 83, in ensure_dir os.makedirs(path) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/share'
I got that error running
pip2 install nfldb
Looks like this is a security feature in El Cap. The simple answer (as recommended in that SO question) is to use a virtual environment. The SO answer recommends virtualenv
which is a perfectly fine choice, but personally I recommend Miniconda, which will make it way easier if you want to either run multiple versions of Python simultaneously or use libraries like numpy or scipy.
Then I use a virtual environment to continue the installation or every time I use nfldb?
Both, basically. You'll install nfldb (and any other packages you need) into the virtual environment, and then whenever you want to use nfldb you'll activate the virtual environment and work from there. Personally I use a new virtual environment for every project - that way you never have to worry about dependencies conflicting between projects.
One caveat, however - the nfldb database will be visible across virtual environments, which is actually kind of nice - if you use nfldb in multiple projects you shouldn't have to remake the database for each one.
Hey all, getting stuck at this part of this guide:
http://nflwin.readthedocs.io/en/stable/nfldb.html

Ok and then I got to here

I can't get the NFL db to work either. However, I have a lot of code to pull stats using the API.
Charlie
On Aug 18, 2017, at 9:54 PM, Arrashg [email protected] wrote:
Ok and then I got to here
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@cminton can you help me do that? or are there instructions anywhere for how to do that?
Happy to. I am on a trip, but back Sunday. What data are you looking for?
On Aug 18, 2017, at 9:57 PM, Arrashg [email protected] wrote:
@cminton can you help me do that? or are there instructions anywhere for how to do that?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@cminton Not sure 100% what the etiquette is so I won't post links but I have a site full of NFL teams, schedule, games played and player profiles I need to populate with standard data such as catches, yards, etc after every game.
What I would also like is targets, red zone targets, yards after contact, aDOT on top of that. Goal is to build a daily fantasy stacking tool and eventually a game center that updates.
@Arrashg I have Python code to pull all of that data. What is "aDOT"?
Others who use nflgame say that the db is a much better way to go, so it may be worth your time to get that to work. That said, happy to give you my code.
Charlie
On Aug 18, 2017, at 10:23 PM, Arrashg [email protected] wrote:
@cminton Not sure 100% what the etiquette is so I won't post links but I have a site full of NFL teams, schedule, games played and player profiles I need to populate with standard data such as catches, yards, etc after every game.
What I would also like is targets, red zone targets, yards after contact, aDOT on top of that. Goal is to build a daily fantasy stacking tool and eventually a game center that updates.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@cminton Average Depth of Target for receivers.
Ok thank you. I'll utilize your code and also keep trying to get the DB up and running at the same time.
@Arrashg,
Just landed. Give me a few hours. I have the code for that.
Charlie
On Aug 20, 2017, at 5:47 PM, Arrashg [email protected] wrote:
@cminton Average Depth of Target for receivers.
Ok thank you. I'll utilize your code and also keep trying to get the DB up and running at the same time.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hey @Arrashg, going back to this comment, is your username "home"? If that's the case, it looks like you may have missed the step directly after starting up postgres for the first time:
$ createdb `whoami`
That will create a database based on your username, which should solve the does not exist error you got.
@AndrewRook Thanks a lot. Made a lot of progress and now I am at the final step of which I am confused about regarding "default configuration directory. I moved it to "Application Support" but not sure this is the correct place. I am an OSX newbie. When I added my password and saved the file, I tried the last few instructions but ended up with this:

This is the section I am confused about:

Download the default config.ini.sample file. https://github.com/BurntSushi/nfldb/blob/master/config.ini.sample
Edit your details. Save to one of those paths that it stated that it is looking for the config file at such as /Users/home/.config/nfldb/config.ini
On Mon, Aug 21, 2017 at 1:14 AM, Arash Ghaemi [email protected] wrote:
@AndrewRook https://github.com/andrewrook Thanks a lot. Made a lot of progress and now I am at the final step of which I am confused about regarding "default configuration directory. I moved it to "Application Support" but not sure this is the correct place. I am an OSX newbie. When I added my password and saved the file, I tried the last few instructions but ended up with this:
[image: screen shot 2017-08-20 at 10 11 12 pm] https://user-images.githubusercontent.com/20796673/29504473-d4af327c-85f4-11e7-9196-80f64f5fea55.png
This is the section I am confused about:
[image: screen shot 2017-08-20 at 10 12 02 pm] https://user-images.githubusercontent.com/20796673/29504478-ddd65f2e-85f4-11e7-88f3-e8dc4b90c6fb.png
— 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/215#issuecomment-323648088, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCil7wCzRrSgY30ZrX8WiQ8FTTFVLG-ks5saRImgaJpZM4LDTSY .
I'm starting to think that nfldb was saved to the wrong folder. When I try and run it, it says no module named nfldb. I'm still unsure of which .config file to save it to. I tried moving it to .config and then to run it and I get the same problem. I have attached images of where I currently tried to add it.
I'm so close thanks to everyone's help.


@Arrashg if you're getting an ImportError
when you try to import nfldb you probably have problems with how you installed the module itself, beyond just the config file. How did you install nfldb?
@AndrewRook I followed these steps http://nflwin.readthedocs.io/en/stable/nfldb.html It seemed like that all worked as I'm able to connect to nfldb.

I also tried what was suggested and the list of relations show up fine

After that, I moved on to these https://github.com/BurntSushi/nfldb/wiki/Installation#importing-the-nfldb-database
I did not notice any errors during install and did not run into anymore snags until the .config section. I'm open to uninstalling and going back thru the steps again but not sure if that is the best solution.
Something I noticed is the file path it tried to follow when I ran nfldb-update, doesn't exist when I try and follow it in finder. After "Python.framework", there should be Versions/2.7/share/nfldb/ where I can add the .config file.
None of the steps in the directions on http://nflwin.readthedocs.io explicitly has you install the python nfldb
library. Looks to me like you've got the Postgres database imported, but not the Python nfldb
package installed.
Try pip install nfldb
.
On the mac I had a better time with
sudo pip install --user nfldb
On Tue, Aug 22, 2017 at 9:16 AM, ochawkeye [email protected] wrote:
None of the steps in the directions on http://nflwin.readthedocs.io explicitly has you install the python nfldb library. Looks to me like you've got the Postgres database imported, but not the Python nfldb package.
Try pip install nfldb.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BurntSushi/nfldb/issues/215#issuecomment-324022659, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCil78aHk0J3MuUtoS2nXQetoDUVbuTks5satSogaJpZM4LDTSY .
@ochawkeye Getting close here. Now when I run the command "import nfldb" it says command not found. When I run "nfldb-update" it updates the db!
