twine command not found

In this troubleshooting guide we learn how to fix twine command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

twine: command not found

or when using sudo you get the following error message

sudo: twine: command not found

Solutions to twine: command not found

How To Fix twine: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu twine is provided by twine package.

twine is:

Twine is a tool for uploading distributions (in the Python meaning) to PyPi.

Why should twine be used over the traditional approach?

The biggest reason to use twine is that python setup.py upload uploads files over plaintext. This means anytime you use it you expose your username and password to a MITM attack. Twine uses only verified TLS to upload to PyPI protecting your credentials from theft.

Secondly it allows you to precreate your distribution files. python setup.py upload only allows you to upload something that you’ve created in the same command invocation. This means that you cannot test the exact file you’re going to upload to PyPI to ensure that it works before uploading it.

Finally it allows you to pre-sign your files and pass the .asc files into the command line invocation (twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc). This enables you to be assured that you’re typing your gpg passphrase into gpg itself and not anything else since you will be the one directly executing gpg –detach-sign -a .

Features:

  • Verified HTTPS Connections
  • Uploading doesn’t require executing setup.py
  • Uploading files that have already been created, allowing testing of distributions before release
  • Supports uploading any packaging format (including wheels).

To fix this problem, we can install more using the command below.

sudo apt-get -y install twine

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install twine.

sudo apt -y install twine

Or if you have aptitude installed you can use the following command.

sudo aptitude install twine

Summary

In this tutorial we learn how to fix twine command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.