Why can I not create a wheel in python?
Solution 1
Install the wheel
package first:
pip install wheel
The documentation isn't overly clear on this, but "the wheel project provides a bdist_wheel command for setuptools" actually means "the wheel package...".
Solution 2
I also ran into the error message invalid command 'bdist_wheel'
It turns out the package setup.py used distutils rather than setuptools. Changing it as follows enabled me to build the wheel.
#from distutils.core import setup
from setuptools import setup
Solution 3
Update your setuptools, too.
pip install setuptools --upgrade
If that fails too, you could try with additional --force
flag.
Solution 4
I also ran into this all of a sudden, after it had previously worked, and it was because I was inside a virtualenv, and wheel
wasn’t installed in the virtualenv.
Solution 5
Update your pip
first:
pip install --upgrade pip
for Python 3:
pip3 install --upgrade pip
Related videos on Youtube
vitiral
I am a professional software developer, focusing on improving developer's lives through testing and design documentation. Check out my favorite personal project, https://github.com/vitiral/artifact
Updated on July 25, 2020Comments
-
vitiral almost 4 years
Here are the commands I am running:
$ python setup.py bdist_wheel usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid command 'bdist_wheel' $ pip --version pip 1.5.6 from /usr/local/lib/python3.4/site-packages (python 3.4) $ python -c "import setuptools; print(setuptools.__version__)" 2.1 $ python --version Python 3.4.1 $ which python /usr/local/bin/python
Also, I am running a mac with homebrewed python
Here is my setup.py script: https://gist.github.com/cloudformdesign/4791c46fe7cd52eb61cd
I'm going absolutely crazy -- I can't figure out why this wouldn't be working.
-
Martijn Pieters over 9 yearsAnd you have installed the
wheel
package as Thomas' answer advises? -
hunter over 8 yearsI have the same problem. But it seems that i didn't use sudo before the commend. After use the commend with administrate permission. it worked.
-
-
vitiral over 9 yearsSo that spit out the file: nioblocks-1.01-cp34-cp34m-macosx_10_9_x86_64.whl -- will this work with any OS, or is there something else I have to do to get it to work? (the "package" is just a bunch of dependencies for pip to install right now)
-
Thomas Orozco over 9 years@GarrettLinux I wouldn't know, I'm sorry, but I'd encourage you to ask a separate question for that ; )
-
vitiral over 9 yearsI fixed that problem too -- adding any file to the setup.py file gave it a general wheel. Check out the updated code in my question for example.
-
vitiral over 9 yearsyup, I had that problem at one time as well! Very important, and the error message is poor.
-
JamesD almost 9 years@geographika yes this is command also the documentation on docs.python.org/2/distutils/setupscript.html would replicate the issues you are seeig as it uses disutils
-
nycynik about 8 yearsmy setuptools was removed, or something was wrong. So I had to do : pip install setuptools --upgrade --force
-
eseglem over 7 yearsMay also be necessary to change
from distutils.core import Extension, Command
tofrom setuptools import Extension, Command
at least for package I was working with. -
Oliver over 7 yearsYou can get the OP's error even with wheel installed, if the setup.py somehow uses distutils instead of setuptools (as was case for me), see the answer by geographika.
-
haridsv about 7 yearsI got this error for pycrypto and it wasn't even importing setup. However, I added
from setuptools import setup
at the beginning and it fixed the issue. -
Ryu_hayabusa almost 7 yearsFor me the problem was old version of pip. fixed by
pip install --upgrade pip
-
CodeBrew almost 7 yearsOne may also need
sudo pip install wheel
if encountering permission problems. -
vitiral about 6 years@CodePlumber my favorite is
pip install wheel --user
for installing "globally". -
theferrit32 over 5 yearsThis is the most useful answer now. Newer versions of pip install don't use bdist_wheel, so just upgrading pip worked for me, without needing to install/update setuptools or wheel
-
La Cordillera about 3 yearsI was having the same issue, and
pip install wheel
didn't do anything, butconda install wheel
solved it.