AttributeError: module 'pkg_resources' has no attribute 'safe_name' oauthlib install
<p>I'm trying to install tweepy (and by extension oauthlib), and I'm getting the following error when attempting to install:</p>

<pre><code>Collecting requests-oauthlib&gt;=0.4.1 (from tweepy)
Using cached requests_oauthlib-0.7.0-py2.py3-none-any.whl
Collecting oauthlib&gt;=0.6.2 (from requests-oauthlib&gt;=0.4.1-&gt;tweepy)
  Using cached oauthlib-2.0.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
  File "/private/var/folders/t7/751h0y1102z99ysr6659yjcr0000gn/T/pip-build-aoklhwtw/oauthlib/setup.py", line 70, in &lt;module&gt;
    'Topic :: Software Development :: Libraries :: Python Modules',
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/dist.py", line 263, in __init__
    self.patch_missing_pkg_info(attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/dist.py", line 246, in patch_missing_pkg_info
    key = pkg_resources.safe_name(str(attrs['name'])).lower()
AttributeError: module 'pkg_resources' has no attribute 'safe_name'
</code></pre>

<p>Interestingly, the <code>/private/var/folders/t7/751h0y1102z99ysr6659yjcr0000gn/T/pip-build-aoklhwtw/oauthlib/</code> folder does not exist, so I can
t even delete that/look at it closer.</p>

<p>Any ideas what might cause this?</p>

<p>Found the solution. I had to upgrade setuptools, so: </p>

<pre><code>$ sudo pip install --upgrade setuptools
</code></pre>

python