Manually installing a Python package like pyhackrf without using pip involves downloading the source code and installing it manually. Here's how you can do it:
🔧 Step-by-Step Guide to Manually Install pyhackrf
✅ Prerequisites
Before proceeding, ensure the following are installed on your system:
- HackRF One hardware
- libhackrf-dev (Linux) or libhackrf (Windows/macOS)
- Python 3.x
- setuptools, wheel (optional but helpful)
- Git (to clone the repo)
📥 Step 1: Install libhackrf (C Library)
pyhackrf is a Python wrapper for the HackRF library (libhackrf), so you need the C library first.
On Debian/Ubuntu:
sudo apt update
sudo apt install libhackrf-dev
On macOS (using Homebrew):
brew install hackrf
On Windows:
Use HackRF One Windows drivers or use a prebuilt libhackrf via MSYS2 or similar.
📦 Step 2: Clone pyhackrf from GitHub
Open a terminal and run:
git clone https://github.com/mossmann/pyhackrf.git
cd pyhackrf
If you don't have Git, download the ZIP file from:
👉 https://github.com/mossmann/pyhackrf/archive/refs/heads/master.zip
Then extract it:
unzip pyhackrf-master.zip
cd pyhackrf-master
🛠️ Step 3: Install Using setup.py
Ensure you're in the pyhackrf directory that contains setup.py.
To install the package globally:
sudo python3 setup.py install
Or install locally for your user:
python3 setup.py install --user
Alternatively, you can build and install from a wheel if supported.
🧪 Step 4: Test Installation
Create a test Python script or open a Python shell:
import pyhackrf
print(pyhackrf.__version__)
If no error occurs, the installation was successful.
📝 Notes
- If you're working in a virtual environment, activate it before running
python3 setup.py install.
- You may need to install other dependencies such as
numpy, cython, or pyusb. These can be manually downloaded and installed similarly.
- The
pyhackrf package does not provide wheels directly, so source install is standard.
🚫 Troubleshooting
ImportError: No module named 'pyhackrf'
Make sure the path where the package was installed is in your PYTHONPATH.
You can check with:
python3 -c "import sys; print(sys.path)"
Add the install directory if necessary:
export PYTHONPATH=/home/youruser/.local/lib/python3.x/site-packages:$PYTHONPATH
Let me know if you want this guide tailored for Windows, macOS, or virtual environments specifically!