BurntSushi / nfldb

A library to manage and update NFL data in a relational database.
The Unlicense
1.08k stars 264 forks source link

newb having some trouble #33

Closed roodhouse closed 10 years ago

roodhouse commented 10 years ago

First, thank you for putting this together. I am excited about it.

However, as stated I am a newb and I've found myself lost.

I made it through the install instructions for Windows however each time a try to run either the top-ten-qbs.py or nfldb-update I get an error that says: "ImportError: No module named pytz"

Not sure what I have done wrong or missed. Could you help me troubleshoot.

Thank you! -John

ochawkeye commented 10 years ago

@roodhouse have a look at #21 and let me know if it helps. If that doesn't get you going I'm sure I can help set your environment up.

roodhouse commented 10 years ago

Thank you. Not sure what it did. But now when I try to run nfldb-update it says 'nfldb-update' is not recongizned as an internal or external command, operable program or batch file."

I first ran it as python nfldb-update and got the same message.. Thank you for walking me through this.

roodhouse commented 10 years ago

and I am using Windows..

roodhouse commented 10 years ago

Based on your answer to the question you reference I tried : C:\Python27\Scripts> pip install nfldb

It did a few things but ended with "ImportError: No module named _vendor"

Am I missing files? I downloaded a bunch of stuff, so forgive me if I missed something obvious.

BurntSushi commented 10 years ago

Can you open Python IDLE (it is an interactive interpreter) and try typing:

import nfldb

And hit enter. Does it work? If so, then nfldb is installed.

If nfldb-update can't be found, then either nfldb is not installed or you are experiencing PATH issues. @ochawkeye I think nfldb-update should end up in the bin or scripts directory?

BurntSushi commented 10 years ago

The pytz error means you haven't installed nfldb's dependencies. If you installed nfldb via pip, then this should have been done automatically.

I have no idea what that pip error means. It's almost as if your pip install is borked, which is very troubling.

roodhouse commented 10 years ago

From Python I get "ImportError: No module named pytz"

I see nfldb-update in scripts folder for python.

BurntSushi commented 10 years ago

If you're completely lost, I would suggest removing all Python stuff on your machine and starting over. Focus on installing pip and getting 'pip install nfldb' to work.

Installing the Python code should be the easiest part, compared to setting up the database. :(

BurntSushi commented 10 years ago

Can you run nfldb-update from inside the scripts directory?

BurntSushi commented 10 years ago

How did you install nfldb if pip isn't working for you?

roodhouse commented 10 years ago

tell me how to install nfldb via pip and I can tell you if I did it. I really don't remember and starting over is something I have been coming back to.

I cant run nfldb from anywhere at this point.

I have no idea how installed if pip wasn't working.

roodhouse commented 10 years ago

everything was rolling until after this step...

nfldb=# \d List of relations Schema | Name | Type | Owner
--------+-------------+-------+------- public | drive | table | nfldb public | game | table | nfldb public | meta | table | nfldb public | play | table | nfldb public | play_player | table | nfldb public | player | table | nfldb public | team | table | nfldb (7 rows)

I saw that message in my prompt. Since then I have been lost..

BurntSushi commented 10 years ago

If pip is installed, then follow the instructions here: https://github.com/BurntSushi/nfldb/wiki/Windows-Install

These look like decent instructions for installing pip: https://pip.pypa.io/en/latest/installing.html

BurntSushi commented 10 years ago

@ochawkeye Windows is really annoying. Do you know of any way to bundle everything up into one executable?

roodhouse commented 10 years ago

I am sorry, but I have been on those websites for the past 4 hours. I thought I followed the instructions correctly...

roodhouse commented 10 years ago

Thinks went askew for me on step 12 of the windows install page you linked

BurntSushi commented 10 years ago

You aren't really on step 12 though because nfldb just isn't properly installed.

It seems like you got the database setup, which is great and usually the most difficult part.

I'm not sure how else I can help you with the detail you've given so far. If you start over, I'd suggest keeping a more detailed record of the steps you went through and what exactly went wrong.

I know it's frustrating, but the Python experience on Windows is unfortunately pretty grim.

roodhouse commented 10 years ago

No worries.

I will start over. Uninstall everything I installed yesterday. Keep notes through the reinstall and follow ochawkeye's window's installation step by step. When I resurface I will let you know how it went and where I stand..

Thanks for yall's help!

On Tue, Jul 29, 2014 at 10:44 PM, Andrew Gallant notifications@github.com wrote:

You aren't really on step 12 though because nfldb just isn't properly installed.

It looms like you got the database setup, which is great and usually the most difficult part.

I'm not sure how else I can help you with the detail you've given so far. If you start over, I'd suggest keeping a more detailed record of the steps you went through and what exactly went wrong.

I know it's frustrating, but the Python experience on Windows is unfortunately pretty grim.

— Reply to this email directly or view it on GitHub https://github.com/BurntSushi/nfldb/issues/33#issuecomment-50570534.

ochawkeye commented 10 years ago

Apologies for offering to help and then promptly falling asleep - ah, the life of someone with a ~2 year old.

Nuking it and starting over is an extreme step and I'm pretty sure we could get you going with what you have. But my schedule is kind of booked this morning for the next 6 hours or so. If you do start over and arrive at the same problem, we can have a TeamViewer session for me to review your environment.

BurntSushi commented 10 years ago

@ochawkeye is awesome. :D

roodhouse commented 10 years ago

HA! 2 kids under 3.5 and a 7 month pregnant wife here.

All 3 girls.

I am currently nuking it, but I will be in touch again later today. If I am still in trouble we can do a teamview.

Thanks man!

On Wed, Jul 30, 2014 at 6:59 AM, Andrew Gallant notifications@github.com wrote:

@ochawkeye https://github.com/ochawkeye is awesome. :D

— Reply to this email directly or view it on GitHub https://github.com/BurntSushi/nfldb/issues/33#issuecomment-50605257.

ochawkeye commented 10 years ago

A couple of things I would be interested in reviewing:

Do the following commands from a command prompt do the same thing for you?

C:\Users\Ben>c:\Python27\python.exe
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\Ben>python
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

Same question for pip:

C:\Users\Ben>c:\Python27\Scripts\pip.exe install
You must give at least one requirement to install (see "pip help install")

C:\Users\Ben>pip install
You must give at least one requirement to install (see "pip help install")

What version of Python are you running? (From my example above you can see I have Python 2.7.6 32 bit)

teamfball commented 10 years ago

I’m also a novice and struggled a bit. But I found that installing with pip to be key. Take a look at both install instructions, not just the one for windows.

Installing the nfldb Python module
If you've made it this far, congratulations—the hard part is over! The nfldb Python module should be installed through pip from PyPI:
pip2 install nfldb
It will automatically install dependencies for you (which include nflgame, psycopg2, pytz and enum34).

Also I reverted to Ochawkeye’s tutoring here,

issue BurntSushi/nflgame#29

Good luck.

ochawkeye commented 10 years ago

https://github.com/BurntSushi/nflgame/issues/29

roodhouse commented 10 years ago

@teamfball thank you, I will take a look.

@ochawkeye, when I get to that point in my reinstalls I will see if those commands works.

Before I do anything else though.....

Do I need nflgame up and running in order to have nfldb up and running?

On Wed, Jul 30, 2014 at 7:22 AM, ochawkeye notifications@github.com wrote:

BurntSushi/nflgame#29 https://github.com/BurntSushi/nflgame/issues/29

— Reply to this email directly or view it on GitHub https://github.com/BurntSushi/nfldb/issues/33#issuecomment-50607092.

BurntSushi commented 10 years ago

@roodhouse If you're using pip to install nfldb (you should be), then nflgame will get installed automatically. In theory, you shouldn't even need to know that nflgame is on your system.

ochawkeye commented 10 years ago

All 3 girls.

@roodhouse Man I feel for you. Frozen has already been played twice beginning to end here and it's not even 10am. And I only have one girl. 2 month old son can't grow up fast enough for me :family:

roodhouse commented 10 years ago

frozen. do you want to build a snowman? ride your bike around the hall?

I am done with the windows install page. I am going to copy my notes below. First I will attach them to this email string to see if that works to cut down on clutter.

As you can see I have the same result..

On Wed, Jul 30, 2014 at 9:54 AM, ochawkeye notifications@github.com wrote:

All 3 girls. @roodhouse https://github.com/roodhouse Man I feel for you. Frozen has already been played twice beginning to end here and it's not even 10am. And I only have one girl. 2 month old son can't grow up fast enough for me [image: :family:]

— Reply to this email directly or view it on GitHub https://github.com/BurntSushi/nfldb/issues/33#issuecomment-50625817.

  1. Uninstall Python 2.7.8
  2. Uninstall Python 2.7 pscopg2-2.5.3
  3. Uninstall Python 2.7 pip-1.5.6
  4. Uninstall PostgreSQL 9.3 (x86)
    • note: The Data directory (c:\program files(x86)\postgresql\9.3\data) has not been removed

Windows Install not switching b/w the main install page and the windows install page

  1. manually installing pyscopg v. psycopg2-2.5.3.win32-py2.7.exe a. python 2.7 not found in directory.
  2. intalling python 2.7.8 via windows x86 msi installer
  3. manually installing pyscopg v. psycopg2-2.5.3.win32-py2.7.exe
  4. Diverting from instructions and installing compiled pip binary frm question #21 v. pip-1.5.6.win32-py2.7.exe
  5. Download/install PostgreSQL a. an existing data dir has been found @ c:....\9.3\data set to use port 5432. This dir & its config will be used for this instl b. Stack builder 3.1.1 launched. Not sure what to install from this. Installed the Add-ons category, I dont know why. c. skipped the intstall of these add-ons bc it wanted a postgresql password and i dont have one yet.
  6. Uninstalling PostgreSQL a. something doesnt seem right re: 5a & I was never prompted to create a password as step 4 of windows install instructions said i would be. b. got same warning as i did about in unstall step 4 note. c. attempting to manually delete all files located in postgresql folder d. reboot
  7. Download/install PostgreSQL a. did ask me to set up password b. warning msg: A non-fatal error occured whilst loading database modules. Please ck the instl long in C:....\Temp for details. c. no msg this time about Stack Builder
  8. Navigating to "C:\Program Files (x86)\PostgreSQL\9.3\bin" vis cmd prompt
  9. Step 5 seemed to work.
  10. Step 6 seemed to work.
  11. step 7 seemed to work.
  12. step 8 seemed to work. I now see nfldb=> in my cmd prompt
  13. step 9 worked.
  14. for step 10 leaving nfldb=> and going back to C:\Program Files (x86)\PostgreSQL\9.3\bin> a. using this to import: C:\Program Files (x86)\PostgreSQL\9.3\bin>psql.exe -U nfldb nfldb < C:\Users\Rugh\Desktop\nfldb\nfldb.sql b. database started @ 10:05, ended @ 10.14 c. Got these Warnings: WARNING: no privileges could be revoked for "public" REVOKE WARNING: no privileges could be revoked for "public" REVOKE WARNING: no privileges were granted for "public" GRANT WARNING: no privileges were granted for "public" GRANT
  15. step 11 already done, somehow files from previous install returned..
  16. in config.ini set time zone like this (could be wrong): [US/Central]

    The time zone to use in the PostgreSQL session by default.

    #

  17. in config.ini placed password here: ....

    indexes and types.

    user = nfldb password = xxxxxx#....

  18. step 13 file also has returned.. but i am moving it to a new location
  19. beginning step 14: a. using this: C:\Python27\Scripts>python "C:\Users\Rugh\Desktop\nfldb\top-ten-qbs.py"
    1. Here is what happened c:\Python27\Scripts>python "C:\Users\Rugh\Desktop\nfldb\top-ten-qbs.py" Traceback (most recent call last): File "C:\Users\Rugh\Desktop\nfldb\top-ten-qbs.py", line 1, in import nfldb File "C:\Python27\lib\site-packages\nfldbinit.py", line 61, in from nfldb.db import pdoc as db_pdoc File "C:\Python27\lib\site-packages\nfldb\db.py", line 14, in import pytz ImportError: No module named pytz
  20. trying step 15 a. got same message from my step 19 above
roodhouse commented 10 years ago

all attaching did was paste my notes here.. sorry about that..

I am waiting instruction now..

ochawkeye commented 10 years ago

Looks like you've installed pip but have not installed nfldb. Try this from a command prompt:

c:\python27\scripts\pip.exe install nfldb
roodhouse commented 10 years ago

after doing that here is my next error..

c:\Python27\Scripts>pip.exe install nfldb Traceback (most recent call last): File "c:\Python27\Scripts\pip-script.py", line 9, in load_entry_point('pip==1.5.6', 'console_scripts', 'pip')() File "c:\Python27\pip.py", line 17445, in main bootstrap(tmpdir=tmpdir) File "c:\Python27\pip.py", line 17415, in bootstrap cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem")) File "c:\Python27\lib\pkgutil.py", line 578, in get_data loader = get_loader(package) File "c:\Python27\lib\pkgutil.py", line 464, in get_loader return find_loader(fullname) File "c:\Python27\lib\pkgutil.py", line 474, in find_loader for importer in iter_importers(fullname): File "c:\Python27\lib\pkgutil.py", line 430, in iter_importers import(pkg) ImportError: No module named _vendor

On Wed, Jul 30, 2014 at 10:37 AM, ochawkeye notifications@github.com wrote:

Looks like you've installed pip but have not installed nfldb. Try this from a command prompt:

c:\python27\scripts\pip.exe install nfldb

— Reply to this email directly or view it on GitHub https://github.com/BurntSushi/nfldb/issues/33#issuecomment-50632502.

ochawkeye commented 10 years ago

Ho - lee crap :( Scary!

You installed the 32-bit version of pip. Do you have the 32-bit version of Python? Can confirm from c:\python27\python.exe

roodhouse commented 10 years ago

c:\Python27>python.exe Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win 32

yet i am running a 64 bit ver of windows......?

ochawkeye commented 10 years ago

yet i am running a 64 bit ver of windows......?

That's just fine. So am I. There are some packages I use that are only stable in 32-bit. I'm going to upgrade from 2.7.6 to 2.7.8 to see if it breaks anything.

I'm happy to remote into your system to see if I can't identify the problem as well. If you want me to do that you can use that TeamViewer link I sent you and send the credentials directly to me: benjamin.j.schroeder@gmail.com

roodhouse commented 10 years ago

let me know if anything breaks for you with 2.7.8 and then if not we can remote... cool?

ochawkeye commented 10 years ago

Nope, no ill effects there...

C:\Users\Ben>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\Ben>pip uninstall nfldb
Uninstalling nfldb:
  d:\python27\lib\site-packages\nfldb-0.2.0-py2.7.egg-info
  d:\python27\lib\site-packages\nfldb\__init__.py
  d:\python27\lib\site-packages\nfldb\__init__.pyc
  d:\python27\lib\site-packages\nfldb\category.py
  d:\python27\lib\site-packages\nfldb\category.pyc
  d:\python27\lib\site-packages\nfldb\db.py
  d:\python27\lib\site-packages\nfldb\db.pyc
  d:\python27\lib\site-packages\nfldb\query.py
  d:\python27\lib\site-packages\nfldb\query.pyc
  d:\python27\lib\site-packages\nfldb\sql.py
  d:\python27\lib\site-packages\nfldb\sql.pyc
  d:\python27\lib\site-packages\nfldb\team.py
  d:\python27\lib\site-packages\nfldb\team.pyc
  d:\python27\lib\site-packages\nfldb\types.py
  d:\python27\lib\site-packages\nfldb\types.pyc
  d:\python27\lib\site-packages\nfldb\version.py
  d:\python27\lib\site-packages\nfldb\version.pyc
  d:\python27\scripts\nfldb-update
  d:\python27\share\doc\nfldb\doc\index.html
  d:\python27\share\doc\nfldb\doc\nfldb-condensed.pdf
  d:\python27\share\doc\nfldb\doc\nfldb-condensed.png
  d:\python27\share\doc\nfldb\doc\nfldb-short.pdf
  d:\python27\share\doc\nfldb\doc\nfldb-short.png
  d:\python27\share\doc\nfldb\doc\nfldb.pdf
  d:\python27\share\doc\nfldb\doc\nfldb.png
  d:\python27\share\doc\nfldb\longdesc.rst
  d:\python27\share\doc\nfldb\readme.md
  d:\python27\share\doc\nfldb\unlicense
  d:\python27\share\nfldb\config.ini.sample
Proceed (y/n)? y
  Successfully uninstalled nfldb

C:\Users\Ben>pip install nfldb
Downloading/unpacking nfldb
  Running setup.py (path:c:\users\ben\appdata\local\temp\pip_build_Ben\nfldb\set
up.py) egg_info for package nfldb

Requirement already satisfied (use --upgrade to upgrade): nflgame>=1.2.2 in d:\p
ython27\lib\site-packages (from nfldb)
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in d:\python2
7\lib\site-packages (from nfldb)
Requirement already satisfied (use --upgrade to upgrade): enum34 in d:\python27\
lib\site-packages (from nfldb)
Requirement already satisfied (use --upgrade to upgrade): pytz in d:\python27\li
b\site-packages (from nfldb)
Requirement already satisfied (use --upgrade to upgrade): httplib2 in d:\python2
7\lib\site-packages (from nflgame>=1.2.2->nfldb)
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in d:\p
ython27\lib\site-packages (from nflgame>=1.2.2->nfldb)
Installing collected packages: nfldb
  Running setup.py install for nfldb

Successfully installed nfldb
Cleaning up...

I don't think we have a problem with nfldb (yet). We need to get past this pip issue; Does pip freeze work for you? (You will need the full path if you haven't setup your ENVIRONMENT VARIABLES) c:\python27\scripts\pip.exe freeze

C:\Users\Ben>pip freeze
beautifulsoup4==4.3.2
enum34==1.0
httplib2==0.9
nfldb==0.2.0
nflgame==1.2.6
psycopg2==2.5.3
pytz==2014.4
requests==2.3.0
selenium==2.42.1
virtualenv==1.11.6
roodhouse commented 10 years ago

no here is the result...

c:\Python27\Scripts>pip.exe freeze Traceback (most recent call last): File "c:\Python27\Scripts\pip-script.py", line 9, in load_entry_point('pip==1.5.6', 'console_scripts', 'pip')() File "c:\Python27\pip.py", line 17445, in main bootstrap(tmpdir=tmpdir) File "c:\Python27\pip.py", line 17415, in bootstrap cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem")) File "c:\Python27\lib\pkgutil.py", line 578, in get_data loader = get_loader(package) File "c:\Python27\lib\pkgutil.py", line 464, in get_loader return find_loader(fullname) File "c:\Python27\lib\pkgutil.py", line 474, in find_loader for importer in iter_importers(fullname): File "c:\Python27\lib\pkgutil.py", line 430, in iter_importers import(pkg) ImportError: No module named _vendor


One thing to note is that I did not follow any steps on the regular nfldb page. Therefore the step on that page that begins with:

Installing the nfldb Python module

If you've made it this far, congratulations—the hard part is over! The nfldb Python module should be installed through pip from PyPI:

has not been done.

ochawkeye commented 10 years ago

That's the exact step we're trying to do (which equates to step 3 in the Windows installation page). But with a non-functioning pip we're not able to do it...

BurntSushi commented 10 years ago

Could you uninstall only pip and then try reinstalling it using this method?

You should only have to run the first command, python get-pip.py (note that you have to download get-pip.py from the link I gave you. After you run that, could you try pip install nfldb again?

I'm not seeing anything helpful on the Internet about your weird _vendor import error.

@ochawkeye Do you have an updated pip? 1.5.6 I think is the latest.

ochawkeye commented 10 years ago

Are you positive you installed pip‑1.5.6.win32‑py2.7.exe? Mine came with a _vendor subfolder.
image

You should be able to confirm the file name you downloaded in your Downloads folder.

roodhouse commented 10 years ago

So at this point installing the nfldb Python module is redundant?

Where should I be able to locate these?

It will automatically install dependencies for you (which include nflgame, psycopg2, pytz and enum34).

ochawkeye commented 10 years ago

So at this point installing the nfldb Python module is redundant?

Not at all - you haven't been able to successfully install the python module because the install method pip is failing. Once you get pip to work, installing nfldb will be a breeze.

BurntSushi commented 10 years ago

So at this point installing the nfldb Python module is redundant?

No. You can't install nfldb without a functioning pip.

Let me explain it to you.

Python is the programming language that nfldb was written in. This is required in order to run Python programs that use nfldb.

pip is a tool, written in Python, that installs other Python libraries. One such library is nfldb. Without pip, you cannot easily install nfldb. Without Python, you cannot have pip.

Therefore, at this point in time, since your pip is not working, that must be fixed before we can move on to anything else.

Once it is working, you should be able to install nfldb with pip install nfldb. This will also install pytz, nflgame, etc.

roodhouse commented 10 years ago

@BurntSushi got it

@ochawkeye i did install the correct pip. and i too have a _vendor folder

image

roodhouse commented 10 years ago

going to uninstall & reinstall pip now..

roodhouse commented 10 years ago

i want to make sure i am installing pip correctly from the link above...

i copy and paste all this code into a file with ext .py?

where does the code begin and end? with the 3 " marks? or with ZIPFILE? ends with the final 3 " marks? or ends with the last line of text "main ()"?

BurntSushi commented 10 years ago

@roodhouse Right click on the link and click "Save link as..." or "Save target as..."

Avoid copy and pasting. That can introduce errors.

roodhouse commented 10 years ago

@BurntSushi right click? how?

BurntSushi commented 10 years ago

Uh...

Here: https://bootstrap.pypa.io/get-pip.py <-- Right click on that link. There should be an option to "Save target as..." (Or "Save link as...")

roodhouse commented 10 years ago

sorry.. bad joke.

I downloaded it as get-pip.py ... now i need to run it in cmd prompt with c:\python27\scripts>python get-pip.py ?