Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is python setup.py saying invalid command 'bdist_wheel' on Travis CI?

My Python package has a setup.py which builds fine locally on Ubuntu Trusty and on a fresh Vagrant Ubuntu Trusty VM when I provision it like this:

sudo apt-get install python python-dev --force-yes --assume-yes --fix-broken curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7 sudo -H pip install setuptools wheel virtualenv --upgrade 

But when I do the same on a Travis CI Trusty Beta VM:

- sudo apt-get install python python-dev --force-yes --assume-yes --fix-broken - curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7 - sudo -H pip install setuptools wheel virtualenv --upgrade 

I get:

python2.7 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' 

This Why can I not create a wheel in python? is related but note I am installing wheel and upgrading setuptools.

like image 874
nokome Avatar asked Jan 15 '16 20:01

nokome


People also ask

What is python setup py bdist_wheel?

python setup.py bdist_wheel. This will build any C extensions in the project and then package those and the pure Python code into a . whl file in the dist directory.

Where is setup py located?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

What does setup py do?

Use of Setup.py It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on. Secondly, it serves as the command line interface via which packaging commands may be executed.

Is setup py deprecated?

You may still find advice all over the place that involves invoking setup.py directly, but unfortunately this is no longer good advice because as of the last few years all direct invocations of setup.py are effectively deprecated in favor of invocations via purpose-built and/or standards-based CLI tools like pip, build ...


2 Answers

Had to install the wheel package. Everything was up to date but still giving the error.

pip install wheel 

then

python setup.py bdist_wheel  

worked without issues.

like image 176
frmdstryr Avatar answered Oct 12 '22 23:10

frmdstryr


On a AWS Ubuntu 18.04 new machine, below installations are required:

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 

Especially the last line is a must.
However before 3 lines might be required as prerequisites.

like image 43
Manohar Reddy Poreddy Avatar answered Oct 13 '22 01:10

Manohar Reddy Poreddy