Difference between pip3 and `python3 setup.py install` regarding cmdclass argument : <p>I tried to configure my package such that a script is executed on the installation process. Therefore, I inherited from setuptools.command install and created my custom class <code>ActionOnInstall</code> to do stuff when package is installed. This class is called via setuptools <code>setup()</code> argument <code>cmdclass</code> as described <a href="https://cbuelter.wordpress.com/2015/10/25/extend-the-setuptools-install-command/comment-page-1/" rel="noreferrer">here</a>.</p>

<p>A minimal example of such a setup.py file looks like</p>

<pre><code>from setuptools import find_packages, setup
from setuptools.command.install import install


class ActionOnInstall(install):
    def run(self):
        print("Call install.run(self) works!")
        install.run(self)


setup(name='name',
      cmdclass={
      'install': ActionOnInstall})
</code></pre>

<p>Building the package by executing </p>

<pre><code>pip3 install &lt;path-to-dir-with-setup.py&gt;
</code></pre>

<p>runs successfully but does not execute commands specified in <code>ActionOnInstall.run()</code>. More directly calling this setup.py by </p>

<pre><code>python3 setup.py install 
</code></pre>

<p>executes commands specified in <code>ActionOnInstall.run()</code>.</p>

<p>Then, I found myself asking: what is the actual difference of these both approaches to install a package. I know, like other posts tell us, pip makes life easier regarding package installation. But how these both approaches treat the <code>cmdclass</code> argument of <code>setup()</code> differently is not explained. Thus, I would highly appreciate to hear from you guys.</p>
