pyasn_util_asnames.py command not found

In this troubleshooting guide we learn how to fix pyasn_util_asnames.py command not found error message

Introduction

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

pyasn_util_asnames.py: command not found

or when using sudo you get the following error message

sudo: pyasn_util_asnames.py: command not found

Solutions to pyasn_util_asnames.py: command not found

How To Fix pyasn_util_asnames.py: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pyasn_util_asnames.py is provided by python3-pyasn package.

python3-pyasn is:

pyasn is a Python extension module that enables very fast IP address to Autonomous System Number lookups. Current state and Historical lookups can be done, based on the MRT/RIB BGP archive used as input.

pyasn is different from other ASN lookup tools in that it provides offline and historical lookups. It provides utility scripts for users to build their own lookup databases based on any MRT/RIB archive. This makes pyasn much faster than online dig/whois/json lookups.

The module is written in C and Python, and cross-compiles on Linux and Windows. Underneath, it uses a radix tree data structure for storage of IP addresses. In the current version, it borrows code from py-radix to support both IPV4 and IPV6 network prefixes. The current release is a beta. Compared to the previous version, it provides support for Python 2 and 3; adds new functionality, performance improvements, and unit-tests.

pyasn is developed and maintained by researchers at the Economics of Cybersecurity research group at Delft University of Technology (http://econsec.tbm.tudlft.nl). The package is used on an almost daily basis and bugs are fixed pretty quickly. The package is largely developed and maintained by Hadi Asghari and Arman Noroozian. Please report any bugs via GitHub (https://github.com/hadiasghari/pyasn) or email the developers.

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

sudo apt-get -y install python3-pyasn

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

You can also use apt command to install python3-pyasn.

sudo apt -y install python3-pyasn

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

sudo aptitude install python3-pyasn

Summary

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