nfldb
nfldb copied to clipboard
Error installing nfldb Python module
When I tried to install the Python module I'm getting the below error. I've searched my machine and do not have a pg_config file anywhere. I'm using the Postgres DB Mac app (Postgres v9.5.3.0) the closest thing I've found is a postgresql.conf file in the Postgres data directory.
(complete results from the install command) pip2 install --no-cache-dir nfldb
Collecting nfldb Downloading nfldb-0.2.17.tar.gz (1.3MB) 100% |████████████████████████████████| 1.3MB 1.5MB/s Collecting nflgame>=1.2.20 (from nfldb) Downloading nflgame-1.2.20.tar.gz (34.0MB) 100% |████████████████████████████████| 34.0MB 9.4MB/s Collecting psycopg2 (from nfldb) Downloading psycopg2-2.6.2.tar.gz (376kB) 100% |████████████████████████████████| 378kB 2.6MB/s Complete output from command python setup.py egg_info: running egg_info creating pip-egg-info/psycopg2.egg-info writing pip-egg-info/psycopg2.egg-info/PKG-INFO writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt' warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/bb/ch562gmn17131gw8_d59bbkm0000gn/T/pip-build-JptrOC/psycopg2/
Not sure but, Try adding the path to your config file to "def config" in db.py . For example to add 'C:\Python27\share\nfldb\config.ini')
def config(config_path=''): paths = [ config_path, path.join(sys.prefix, 'share', 'nfldb', 'config.ini'), path.join(_config_home, 'nfldb', 'config.ini'), 'C:\Python27\share\nfldb\config.ini' ]
Hmmmmm. I don’t find a file named db.py or a nfldb config.ini anywhere on my machine. I’m running a Mac. My Python (2.7) install doesn’t have anything like the folder structure you have in the example. My python path looks more like this: /Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/EGG-INFO
I was already running the Postgres app so I didn’t follow the Russ Brooks postgres install steps referenced in the install guide. I ran the DB scripts for NFLDB to import the data into an existing DB/Schema for the app I’m building.
Eventually I want to be able to use the Python module in a Heroku environment to update nfldb tables on a Heroku/Postgres instance. Or am I barking up the wrong tree here and need to find a different source for the NFL game data?
On Nov 29, 2016, at 5:58 AM, D3Design [email protected] wrote:
Not sure but, Try adding the path to your config file to "def config" in db.py . For example to add 'C:\Python27\share\nfldb\config.ini')
def config(config_path=''): paths = [ config_path, path.join(sys.prefix, 'share', 'nfldb', 'config.ini'), path.join(_config_home, 'nfldb', 'config.ini'), 'C:\Python27\share\nfldb\config.ini' ]
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BurntSushi/nfldb/issues/205#issuecomment-263576588, or mute the thread https://github.com/notifications/unsubscribe-auth/ASezvC5uq9aGw0JN3A8gW7PbrSemmcnEks5rDC-DgaJpZM4KgmoM.
@keithfabean @D3Design's suggestion is unfortunately off the mark. (You don't have the directory structure that @D3Design showed because you haven't successfully installed nfldb
.) The error message you're seeing is a result of not having the appropriate PostgreSQL libraries installed. Namely, just because you have PostgreSQL the app installed doesn't mean you have the necessary libraries to write programs against it. Unfortunately, I'm not a mac user so I don't know what the proper path is for getting the necessary libraries. On Linux distros, this is usually the part where you install something like postgresql-dev
or libpq-dev
or similar.
Or am I barking up the wrong tree here and need to find a different source for the NFL game data?
You're not barking up the wrong tree. nfldb
is a bog-standard Python module that makes bog-standard use of PostgreSQL. Unfortunately, bog-standard use of PostgreSQL in Python-land means using a C library, and using a C library means you need to figure out how such things are installed on your platform.