title: How do I fix setuptools not available in build environment when trying to install libraries in python?
body: <p>I'm trying to install a requirements.txt file in Docker, and I make it about 30 packages in when I get this error when trying to install importlib:</p>
  <p>Can not execute <code>setup.py</code> since setuptools is not available in the build environment.</p>
  <p>Here is the full error message:</p>
  <pre><code>Collecting importlib==1.0.4
  #9 14.42   Downloading importlib-1.0.4.zip (7.1 kB)
  #9 14.43   Preparing metadata (setup.py): started
  #9 14.45   Preparing metadata (setup.py): finished with status 'error'
  #9 14.45   error: subprocess-exited-with-error
  #9 14.45   
  #9 14.45   × python setup.py egg_info did not run successfully.
  #9 14.45   │ exit code: 1
  #9 14.45   ╰─&gt; [1 lines of output]
  #9 14.45       ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
  #9 14.45       [end of output]
  #9 14.45   
  #9 14.45   note: This error originates from a subprocess, and is likely not a problem with pip.
  #9 14.45 error: metadata-generation-failed
  #9 14.45 
  #9 14.45 × Encountered error while generating package metadata.
  #9 14.45 ╰─&gt; See above for output.
  #9 14.45 
  #9 14.45 note: This is an issue with the package mentioned above, not pip.
  #9 14.45 hint: See above for details.
  </code></pre>
  <p>In the Dockerfile, I have tried installing setuptools before installing the packages:</p>
  <pre><code>RUN python3 -m pip install setuptools
  RUN python3 -m pip install -r requirements.txt
  </code></pre>
  <p>Some further details: my python version is 3.9, pip version is 22.1.2</p>
  <p>When I do</p>
  <pre><code>easy_install --version
  </code></pre>
  <p>, I get</p>
  <pre><code>setuptools 41.0.1 from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (Python 2.7)
  </code></pre>
  <p>However, when I try to install setuptools with pip, it says I have version 62.3.3 for python3.9</p>
  <pre><code>Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (62.3.3)
  </code></pre>
  <p>Any help is greatly appreciated, and let me know if I should provide any further details.</p>