Install with pip

The recommended way to install pyqog is via pip from PyPI:

pip install pyqog

This will install pyqog along with all required dependencies.

Requirements

Requirement Minimum Version Description
Python 3.9+ Python interpreter
pandas 1.5.0+ Data manipulation and analysis
requests 2.28.0+ HTTP library for downloading data

pyqog is intentionally minimal and only depends on pandas and requests. Both are widely used packages that you likely already have installed.

Development Installation

If you want to contribute to pyqog or install the latest development version:

# Clone the repository
git clone https://github.com/prof-danny-idp/pyqog.git
cd pyqog

# Install in development mode (editable)
pip install -e .

# Install test dependencies
pip install pytest

Installing with -e (editable mode) means that changes you make to the source code will take effect immediately without needing to reinstall.

Verify Installation

After installation, verify that everything is working:

import pyqog

# Check the list of available datasets
print(pyqog.list_datasets())

# Download a small dataset to test connectivity
df = pyqog.read_qog(which_data="basic", data_type="cross-sectional")
print(df.shape)
print(df.head())

If the above commands run without errors, you are ready to go. The first download may take a moment depending on your internet connection. After that, data is cached locally for fast offline access.

Troubleshooting

pip: command not found

Try using pip3 instead of pip, or run python -m pip install pyqog.

Permission denied

Use pip install --user pyqog to install for your user only, or use a virtual environment (recommended):

python -m venv venv
source venv/bin/activate   # On Windows: venv\Scripts\activate
pip install pyqog
SSL or connection errors

pyqog downloads data from the QoG servers. Make sure you have an internet connection for the first download. After that, cached data is available offline. If you are behind a proxy or firewall, configure your system proxy settings.

ImportError: No module named 'pyqog'

Make sure you installed pyqog in the same Python environment you are running your script in. Check with python -c "import pyqog; print('OK')".