Skip to content
Advertisement

Why do I need to do a “pip install” after “git clone..”?

I am following a (my company’s internal) guide to installing some custom libraries from Bitbucket. I am instructed to do on the command line:

# Install custom libraries.
git clone ssh://git@bitbucket.company.net:{number}/~js/company-libraries /tmp/company-libraries

When I do

ls /tmp/company-libraries

I see that there is a README.md file and a directory called CompanyLibraries

I am then instructed to do

sudo -H pip3 install /tmp/company-libraries/CompanyLibraries

My question is that after doing “git clone..” why do we then need to do “pip3 install..”? What is pip doing in this case? The CompanyLibraries directory exists so I am unsure why we need to install again?

I have never used git and this guide doesn’t assume any knowledge in git – it just wants me to copy and paste the commands.

Advertisement

Answer

So basically, in Your case pip3 is simply installing some libraries most probably proprietary to Your company.

Your company has some git repository that is used for development of internal libraries for Python. But cloning the git repository doesn’t mean that the Python is automatically able to use the libraries, You need to install them to proper folders, that’s what pip3 is doing when You invoke the command plus also probably some dependencies are installed.

Python looks for libraries in some predefined folders, so If they are not there it simply assumes that they are not installed. The fact that You clone them somewhere doesn’t mean that it is able to find them.

Advertisement