mkvirtualenv command not found on Ubuntu - How to fix this error

Are you trying to resolve the error 'mkvirtualenv: command not found'?

This guide is for you.

virtualenvwrapper is a set of shell functions defined in Bourne shell compatible syntax. virtualenv is what enables you to create many different Python environments in your Linux / macOS system. 

With virtualenvwrapper you can automate tests run under the following shells on a Linux or OS X machine.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix Python related errors.

In this context, we shall look into the causes of this error and methods to fix it.

More information about mkvirtualenv

mkvirtualenv is a command that is a part of virtualenvwrapper. It is mainly used to create a new virtualenv (virtual environment). 

Also, it gets installed as part of virtualenvwrapper.

virtualenvwrapper a set of extension commands for Python virtual environment management.

Moreover, it works in several shell environments for Linux, OSX, and Windows. 

These include: bash, zsh, Powershell, and the windows command prompt.

Fixes for the error 'mkvirtualenv: command not found' ?

One of our customers installed virtualenv and virtualenvwrapper, but still received the 'mkvirtualenv: command not found' error message. 

Here are the steps to properly install virtualenvwrapper.

1. Define the path virtualenvwrapper in the “.bashrc” so that the shell knows where the bash script resides. 

So locate where script is.

By default, the virtualenvwrapper is installed in the path:


2. After running the “pip install virtualenvwrapper” command, first create a directory where all the virtual environments will reside. 

Here, we are putting them in “~/.environments”:

mkdir ~/.environments

3. Now open the “~/.bashrc” or “~/.profile” file and add the following to the end of the file:

export WORKON_HOME=~/.environments
source /usr/local/bin/

4. Finally, we need to inform the bash about the changes we made. 

For that, run the following command to re-load the .bashrc configuration OR just simply close the shell and re-open it:

source ~/.bashrc

Now, you must be able to run the mkvirtualenv command without any error.

[Need urgent assistance in fixing Python errors? – We are here to help you. ]


This article covers solution to the #error 'mkvirtualenv: command not found' which happens while running mkvirtualenv #command.

You'll need to install virtualenvwrapper package into the same global site-packages area where virtualenv is installed. 

Administrative privileges are required for this installation. 

Ensure you're logged in as root user or standard user with sudo privileges.

Start by Updating the System package list:

$ sudo apt update

Then install #Python build tools.

# Python 2

$ sudo apt-get install python-pip python-dev build-essential

# Python 3

$ sudo apt-get install python3-pip python3-dev build-essential

Then install virtualenv and virtualenvwrapper packages.

With APT package manager:

$sudo apt install virtualenv virtualenvwrapper

With Pip:

# Python 2

$ sudo pip install virtualenv virtualenvwrapper

# Python 3

$ sudo pip3 install virtualenv virtualenvwrapper

For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on

Also for Tech related tips, Visit or General Technical tips on