Python shows the
error: invalid command 'bdist_wheel' message when the
wheel package is not installed or available in the current Python environment.
To fix this error, you need to install the
wheel package using
Suppose you try to run the
setup.py file using Python as follows:
python3 setup.py bdist_wheel
Without having the
wheel package installed on your computer, Python responds with the following error:
usage: setup.py ... or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid command 'bdist_wheel'
The solution is to install the
wheel package with
pip using one of the commands below:
# Upgrade pip to the latest version first pip install --upgrade pip # Use pip to install wheel pip install wheel # Or pip3 pip3 install wheel # If pip isn't available in PATH python -m pip install wheel # Or with python3 python3 -m pip install wheel # For Windows without pip in PATH py -m pip install wheel
In Linux Ubuntu or Debian, you might also need to install the prerequisites to the
sudo apt-get install gcc libpq-dev -y sudo apt-get install python-dev python-pip -y sudo apt-get install python3-dev python3-pip python3-venv python3-wheel -y pip3 install wheel
apt-get should install the prerequisites automatically when you install Python, but they may be skipped if you install Python with the
Also, upgrade the
setuptools package to the latest version:
pip install --upgrade setuptools # or pip3 install --upgrade setuptools
Finally, make sure that you are using the latest stable Python version.
You can check the Python version using the following commands:
python --version # Python 2.7.18 # or python3 --version # Python 3.10.9
You can download the latest Python version from python.org website.
Once you have the
wheel package, you should be able to run the
setup.py file using the