When I use sudo pip to install software I get the message "the directory... is not owned by the current user"

Solution 1:

When you run sudo your environment is passed along while the effective user switches to root. Your environment includes that your ~/ or home directory (the value of the environment variable HOME) is /home/bijay.

pip looks for an http cache before downloading packages. Probably for a combination of security, sanity and privacy reasons pip disables the cache so as not to write to a cache directory not owned by the current user. It's just telling you that it did that.

As it hints, using sudo -H would set the HOME environment variable before executing the command passed to sudo, using root's home directory /root as $HOME instead of your user's. The cache could then be written in /root/.cache/pip/http with no errors.

As a sidenote, you probably shouldn't be running pip as root anyway.