Python Facebook SDK: 'module' object has no attribute 'GraphAPI'

I tried what @thefourtheye suggested but pip wasn't uninstalling everything. Instead, I just cleaned out the Facebook packages via

rm -rf /path/to/my/venv/lib/python2.7/site-packages/facebook* && rm -rf /path/to/my/venv/lib/python2.7/site-packages/Facebook* 

WARNING: check that you don't have any other packages that start with facebook before you go removing anything. In my case I had

facebook/    
Facebook-0.0-py2.7.egg-info/   
facebook.py    
facebook.pyc 
facebook_sdk-0.4.0-py2.7.egg-info/ 

I had the same problem when messing around with facebook-sdk for python the first time. It occured I named my python file "facebook.py", and made unconsiously a name clash.


I have the same problem. I renamed the file from facebook.py to first.py (You can choose your one name.)So, my conclusion is don't save file with a module name.


If you are using Ubuntu or Debian, Just execute the following commands to get this working

sudo pip uninstall facebook
sudo pip uninstall facebook-sdk
sudo pip install facebook-sdk

For other operating systems, just remove facebook and facebook-sdk packages and install only facebook-sdk.

And then execute that program, it will work. Looks like facebook module is a dummy module. What we actually need is facebook-sdk only.