tastypie -- OAuthAuthentication -- python-oauth2 import issue
Question: I am wishing to use OAuthAuthentication in tastypie. In my ModelResource, I
do: (showing only the relevant portion)

    
    
    `from tastypie.authentication import OAuthAuthentication
    class FooResource(ModelResource):
        class Meta:
            authentication = OAuthAuthentication()`
    

And I get an error saying: The 'python-oauth2' package could not be imported.
It is required for use with the 'OAuthAuthentication' class.

Before this, I did a pip install of python-oauth(below), but subsequently, it
continues the complaint above. Do I need to do anything else in my resource or
anywhere else to explicitly import this?

    
    
    `pip install -r http://code.daaku.org/python-oauth/reqs
    Obtaining urlencoding from git+git://github.com/nshah/python-urlencoding.git#egg=urlencoding (from -r http://code.daaku.org/python-oauth/reqs (line 1))
      Cloning git://github.com/nshah/python-urlencoding.git to ./src/urlencoding
      Running setup.py egg_info for package urlencoding
    Obtaining oauth from git+git://github.com/nshah/python-oauth.git#egg=oauth (from -r http://code.daaku.org/python-oauth/reqs (line 2))
      Cloning git://github.com/nshah/python-oauth.git to ./src/oauth
      Running setup.py egg_info for package oauth
    Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/lib/python2.6/site-packages (from urlencoding->-r http://code.daaku.org/python-oauth/reqs (line 1))
    Downloading/unpacking setuptools-git (from urlencoding->-r http://code.daaku.org/python-oauth/reqs (line 1))
      Downloading setuptools-git-0.4.2.tar.gz
      Running setup.py egg_info for package setuptools-git
    Installing collected packages: urlencoding, oauth, setuptools-git
      Running setup.py develop for urlencoding
        Creating /usr/lib/python2.6/site-packages/urlencoding.egg-link (link to .)
        Adding urlencoding 0.0.1 to easy-install.pth file
    
        Installed /usr/lib/python2.6/site-packages/tastypie/src/urlencoding
      Running setup.py develop for oauth
        Creating /usr/lib/python2.6/site-packages/oauth.egg-link (link to .)
        Adding oauth 0.0.1 to easy-install.pth file
    
        Installed /usr/lib/python2.6/site-packages/tastypie/src/oauth
      Running setup.py install for setuptools-git
    Successfully installed urlencoding oauth setuptools-git
    Cleaning up...`
    


Answer: It seems that you're installing "python-oauth" instead of "python-oauth2". The
error clearly states that. To solve this issue, you should simply install
"python-oauth2" which is a different library from "python-oauth".

Try this:

    
    
    pip install oauth2
    

