How to fix `error: invalid command 'bdist_wheel'`?
Asked Answered
G

1

47

I try to install watchman on Ubuntu 20.04.01:

guettli@yoga15:~/tmp$ python3 -m venv pywatchman-test
guettli@yoga15:~/tmp$ cd pywatchman-test
guettli@yoga15:~/tmp/pywatchman-test$ . bin/activate

(pywatchman-test) guettli@yoga15:~/tmp/pywatchman-test$ pip install pywatchman

Fails:

Collecting pywatchman
  Using cached pywatchman-1.4.1.tar.gz (29 kB)
Building wheels for collected packages: pywatchman
  Building wheel for pywatchman (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/guettli/tmp/pywatchman-test/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-on_zbadt/pywatchman/setup.py'"'"'; __file__='"'"'/tmp/pip-install-on_zbadt/pywatchman/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9np2rv_b
       cwd: /tmp/pip-install-on_zbadt/pywatchman/
  Complete output (6 lines):
  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'
  ----------------------------------------
  ERROR: Failed building wheel for pywatchman
  Running setup.py clean for pywatchman
Failed to build pywatchman
Installing collected packages: pywatchman
    Running setup.py install for pywatchman ... done
Successfully installed pywatchman-1.4.1

I found a way to solve this: If I uninstall pywatchman and install wheel it works fine.

I would like to create a patch for watchman, so that this works right of the box.

How could this be solved, so that in future this does not happen any more?

Related: https://github.com/facebook/watchman/issues/876

Geostatic answered 13/12, 2020 at 6:40 Comment(2)
Does this answer your question? Why is python setup.py saying invalid command 'bdist_wheel' on Travis CI?Specious
@AbhigyanJaiswal 's comment should be posted and accepted as the answer to the problem.Beane
I
84

Running

pip install wheel

or

pip3 install wheel

or

python3 -m pip install wheel

solved the issue for me

Impeccable answered 20/5, 2021 at 9:6 Comment(5)
It works for me.Gawk
Correct answer!!!!Jester
especially when running within a virtual environment, installing wheel first makes it work. the wheel installed in the global python scope does not get used hence this has to be done first.Caritacaritas
What does wheel do and why do I have to install a <1.0 package to get others to work?Whippoorwill
I humbly suggest python -m pip install wheel for the sake of sanity.Alien

© 2022 - 2024 — McMap. All rights reserved.