Fixed: “virtualenv”: No such file or directory

When we were running some python based test applications, we got following error,

Cannot run program "virtualenv": error=2, No such file or directory

Solution :

This problem is because your application is trying to use the virtualenv binary to setup some environment , but it was not able to find it on our Ubuntu Linux machine.

So to make sure we are using correct package to install this, we used below command to search the package database,

$ sudo apt-cache search virtualenv

This returned list of large number of packages based on virtualenv, but as we could see from below, we identified it as base package which we need to install.

python3-virtualenv - Python virtual environment creator

So, we installed this package as below, and our test program started working.

$ sudo apt-get install python3-virtualenv

Leave a Comment