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

Beginner question #21

Closed
micahstone20 opened this issue May 12, 2014 · 3 comments
Closed

Beginner question #21

micahstone20 opened this issue May 12, 2014 · 3 comments

Comments

@micahstone20
Copy link

Hey,

I am something of a beginner at programming, but I think I managed to follow every step in terms of the installation of the postgres and SQL stuff. I just cant seem to get the nfldb to run in python, I keep getting this error: ImportError: No module named nfldb.

I managed to get the nflgame data to work, but I cant seem to get this done! Like I said, I'm not super experienced so I am very likely missing something very obvious. Anything that you think I might be missing, please let me know!

Thanks

@BurntSushi
Copy link
Owner

This is going to be tricky to debug. Which operating system are you using? What were the exact steps you followed to install nfldb? What steps did you follow to install nflgame? (I ask because you said nflgame is working but nfldb is not. So perhaps we can find the problem by looking at how you installed them.)

Basically, the idea is that Python can't find the nfldb module. Usually this means it isn't installed. More insidious reasons include difficult to debug path issues where Python isn't looking in the right place.

It's also extremely important to make sure you're using python 2.7. For example, if you installed nfldb on Python 2.7, but you're trying to import it from Python 3, then it won't work.

@ochawkeye
Copy link
Contributor

@micahstone20 The easiest way to get nfldb installed (and kept up to date) is with pip.

In the Linux world, in order to use pip one would need only to open up a terminal window and sudo apt-get install python-pip. With pip installed, getting nfldb installed is as simple as pip install nfldb. Updating is just as simple: pip install --upgrade nfldb.

But based on your comments, I presume you're working in a Windows world.
One thing missing from the Windows environment that everyone else has is a native package manager that allows you to quickly install desired libraries & packages. You will find various pip installation instructions on the web, and all of those would probably get you to where you are trying to go, but having recently re-installed my OS, I can confidently say that the easiest method is to install with the compiled pip binary for your version of Python.

After installing that, you will have everything you need installed to use pip if you navigate to your python scripts folder (ie. C:\Python27\Scripts> pip install nfldb). One thing people do to make using pip more convenient is to add pip's execution path to their environment variables so they don't need to navigate to C:\Python27\Scripts every time they want to use it. Depending on your version of Windows, you should be able to search for "Environment Variables" and then Edit the system environment variables.

image

Navigate to Path in the bottom panel labelled System variables and Edit that entry.
image

Add ;C:\Python\Scripts (or whatever your Python scripts folder is) to the end. Now you can use pip regardless of your current working directory in your command prompt window.

Apologies if you are not running Windows, but the completionist in me saw this issue has been open for a couple months and my skin started tingling :)

@BurntSushi
Copy link
Owner

Closing due to inactivity from OP. @micahstone20 If you're still having trouble, please re-open this issue or create a new one. Thanks!

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

3 participants