nfldb icon indicating copy to clipboard operation
nfldb copied to clipboard

nfldb Mac installation

Open cminton opened this issue 8 years ago • 33 comments

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

cminton avatar Dec 03 '16 14:12 cminton

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 .

BurntSushi avatar Dec 03 '16 15:12 BurntSushi

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?

cminton avatar Dec 03 '16 15:12 cminton

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 .

BurntSushi avatar Dec 03 '16 15:12 BurntSushi

@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 avatar Dec 03 '16 19:12 AndrewRook

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

cminton avatar Dec 03 '16 19:12 cminton

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.

AndrewRook avatar Dec 03 '16 20:12 AndrewRook

I figured it was looping. I should have thought of opening another terminal window. That was dumb of me.

cminton avatar Dec 03 '16 21:12 cminton

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'

cminton avatar Dec 03 '16 22:12 cminton

I got that error running

pip2 install nfldb

cminton avatar Dec 03 '16 22:12 cminton

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.

AndrewRook avatar Dec 04 '16 02:12 AndrewRook

Then I use a virtual environment to continue the installation or every time I use nfldb?

cminton avatar Dec 04 '16 13:12 cminton

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.

AndrewRook avatar Dec 04 '16 19:12 AndrewRook

Hey all, getting stuck at this part of this guide:

http://nflwin.readthedocs.io/en/stable/nfldb.html

screen shot 2017-08-18 at 9 48 26 pm

Ash-Digital avatar Aug 19 '17 04:08 Ash-Digital

Ok and then I got to here

screen shot 2017-08-18 at 9 54 13 pm

Ash-Digital avatar Aug 19 '17 04:08 Ash-Digital

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 avatar Aug 19 '17 04:08 cminton

@cminton can you help me do that? or are there instructions anywhere for how to do that?

Ash-Digital avatar Aug 19 '17 04:08 Ash-Digital

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 avatar Aug 19 '17 05:08 cminton

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

Ash-Digital avatar Aug 19 '17 05:08 Ash-Digital

@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 avatar Aug 19 '17 13:08 cminton

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

Ash-Digital avatar Aug 20 '17 21:08 Ash-Digital

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

cminton avatar Aug 20 '17 22:08 cminton

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 avatar Aug 21 '17 00:08 AndrewRook

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

screen shot 2017-08-20 at 10 11 12 pm

This is the section I am confused about:

screen shot 2017-08-20 at 10 12 02 pm

Ash-Digital avatar Aug 21 '17 05:08 Ash-Digital

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 .

donlaur avatar Aug 21 '17 05:08 donlaur

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.

screen shot 2017-08-21 at 4 06 57 pm screen shot 2017-08-21 at 4 07 42 pm

Ash-Digital avatar Aug 21 '17 23:08 Ash-Digital

@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 avatar Aug 22 '17 01:08 AndrewRook

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

screen shot 2017-08-21 at 9 50 22 pm

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

screen shot 2017-08-21 at 9 52 37 pm

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. screen shot 2017-08-21 at 10 15 19 pm screen shot 2017-08-21 at 10 15 35 pm

Ash-Digital avatar Aug 22 '17 04:08 Ash-Digital

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.

ochawkeye avatar Aug 22 '17 13:08 ochawkeye

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 .

donlaur avatar Aug 22 '17 13:08 donlaur

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

screen shot 2017-08-25 at 9 00 16 pm

Ash-Digital avatar Aug 26 '17 04:08 Ash-Digital