title: How can I fix Heroku error: "Command errored out with exit status 1"?
body: <p>I want to host my Discord Bot on Heroku for free. I tried building it but I get an error while hosting the bot, that I can't solve.</p>
  <p>This is the activity log of Discord Bot while publishing it into Heroku:</p>
  <p>Building on the Heroku-20 stack</p>
  <pre><code>Using buildpack: Heroku/python
  
  Python app detected
  
  No Python version was specified. Using the same version as the last build: python-3.9.5
  
  To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
  
  Requirements file has been changed, clearing cached dependencies
  
  Installing python-3.9.5
  
  Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
  
  Installing SQLite3
  
  Installing requirements with pip
  
  
     Collecting setuptools==49.6.0
  
       Downloading setuptools-49.6.0-py3-none-any.whl (803 kB)
  
     Collecting discord.py==1.7.2
  
       Downloading discord.py-1.7.2-py3-none-any.whl (786 kB)
  
     Collecting discord
  
       Downloading discord-1.0.1-py3-none-any.whl (1.1 kB)
  
     Collecting dotenv
  
       Downloading dotenv-0.0.5.tar.gz (2.4 kB)
  
         ERROR: Command errored out with exit status 1:
  
          command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'/tmp/pip-install-06xhzdfv/dotenv/setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'/tmp/pip-install-06xhzdfv/dotenv/setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' egg_info --egg-base /tmp/pip-pip-egg-info-m_r1ttd_
  
              cwd: /tmp/pip-install-06xhzdfv/dotenv/
  
         Complete output (51 lines):
  
             ERROR: Command errored out with exit status 1:
  
              command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'/tmp/pip-wheel-9yg4cjho/distribute/setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'/tmp/pip-wheel-9yg4cjho/distribute/setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' egg_info --egg-base /tmp/pip-pip-egg-info-3dj58cd9
  
                  cwd: /tmp/pip-wheel-9yg4cjho/distribute/
  
             Complete output (15 lines):
  
             Traceback (most recent call last):
  
               File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  
               File &quot;/tmp/pip-wheel-9yg4cjho/distribute/setuptools/__init__.py&quot;, line 2, in &lt;module&gt;
  
                 from setuptools.extension import Extension, Library
  
               File &quot;/tmp/pip-wheel-9yg4cjho/distribute/setuptools/extension.py&quot;, line 5, in &lt;module&gt;
  
                 from setuptools.dist import _get_unpatched
  
               File &quot;/tmp/pip-wheel-9yg4cjho/distribute/setuptools/dist.py&quot;, line 7, in &lt;module&gt;
  
                 from setuptools.command.install import install
  
               File &quot;/tmp/pip-wheel-9yg4cjho/distribute/setuptools/command/__init__.py&quot;, line 8, in &lt;module&gt;
  
                 from setuptools.command import install_scripts
  
               File &quot;/tmp/pip-wheel-9yg4cjho/distribute/setuptools/command/install_scripts.py&quot;, line 3, in &lt;module&gt;
  
                 from pkg_resources import Distribution, PathMetadata, ensure_directory
  
               File &quot;/tmp/pip-wheel-9yg4cjho/distribute/pkg_resources.py&quot;, line 1518, in &lt;module&gt;
  
                 register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
  
             AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
  
             ----------------------------------------
  
         ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  
         Traceback (most recent call last):
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/setuptools/installer.py&quot;, line 128, in fetch_build_egg
  
             subprocess.check_call(cmd)
  
           File &quot;/app/.heroku/python/lib/python3.9/subprocess.py&quot;, line 373, in check_call
  
             raise CalledProcessError(retcode, cmd)
  
         subprocess.CalledProcessError: Command '['/app/.heroku/python/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp6e4wiu5n', '--quiet', 'distribute']' returned non-zero exit status 1.
  
         
  
         During handling of the above exception, another exception occurred:
  
         
  
         Traceback (most recent call last):
  
           File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  
           File &quot;/tmp/pip-install-06xhzdfv/dotenv/setup.py&quot;, line 13, in &lt;module&gt;
  
             setup(name='dotenv',
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/setuptools/__init__.py&quot;, line 160, in setup
  
             _install_setup_requires(attrs)
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/setuptools/__init__.py&quot;, line 155, in _install_setup_requires
  
             dist.fetch_build_eggs(dist.setup_requires)
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/setuptools/dist.py&quot;, line 695, in fetch_build_eggs
  
             resolved_dists = pkg_resources.working_set.resolve(
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/pkg_resources/__init__.py&quot;, line 781, in resolve
  
             dist = best[req.key] = env.best_match(
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/pkg_resources/__init__.py&quot;, line 1066, in best_match
  
             return self.obtain(req, installer)
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/pkg_resources/__init__.py&quot;, line 1078, in obtain
  
             return installer(requirement)
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/setuptools/dist.py&quot;, line 754, in fetch_build_egg
  
             return fetch_build_egg(self, req)
  
           File &quot;/app/.heroku/python/lib/python3.9/site-packages/setuptools/installer.py&quot;, line 130, in fetch_build_egg
  
             raise DistutilsError(str(e))
  
         distutils.errors.DistutilsError: Command '['/app/.heroku/python/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp6e4wiu5n', '--quiet', 'distribute']' returned non-zero exit status 1.
  
         ----------------------------------------
  
     ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  </code></pre>
  <p>!     Push rejected, failed to compile Python app.</p>
  <p>!     Push failed</p>