11

So im trying to get oauth2 to work with python. So i downloaded it from github, and ran the setup.py file but that didn't exactly work. I googled some more and found a question here and the answer said to put the folder in python27/Lib/site-packages with a .pth file in the /site-packages folder. The .pth folder has the name of the module folder (oauth2). So that worked... until i went to run it and it said oauth wouldn't run because i didn't have httplib2. So i downlaoded that, did the same exact thing, but ti doesn't work for httplib2? what in hell is going on here? Im way over my gead,a ll i want is the Yahoo Fantasy API to work with python so i can do one simple thing.

Heres where i got the .pth deal: Installing the Swampy Python module on Windows

Community
  • 1
  • 1
gta0004
  • 508
  • 4
  • 11
  • 29
  • Regarding the question you referenced, did you try what this answer -> http://stackoverflow.com/questions/5531850/installing-the-swampy-python-module-on-windows/6464146#6464146 suggested? I have installed oauth before, and never created a .pth file. I just put the modulesin site-packages. – WilHall Oct 15 '11 at 23:04
  • 14
    `pip install oauth2`. Or `easy_install oauth2`. – Cat Plus Plus Oct 15 '11 at 23:05
  • @Willhall: I copied all the files from oath to sitepackages in once, but when i had to install httplib2 and mvoed the files, they had similar files (like setup.py). i thought i did something wrong so i undid everything – gta0004 Oct 15 '11 at 23:09
  • @cat plus plus: i have no clue where do input those commands, or if i even have to download something for it. ive seen them everywhere but i have no clue what im doing – gta0004 Oct 15 '11 at 23:10
  • Be more specific about what doesn't work. Paste the error messages into your question. – Michael Dillon Oct 15 '11 at 23:12
  • its the usual "Importerror: no module named xxxxx" deal – gta0004 Oct 15 '11 at 23:17

1 Answers1

33

I think that you need to go back to square one.

Did you try easy_install oauth2?

Did you try pip install oauth2?

If neither of those work, then you need to install it manually. Having read through the readme on github you know that oauth2 depends on httplib2 so start by installing and testing httplib2. Don't go any further until you know that httplib2 is installed and functioning correctly.

Next step is to manually install oauth2. Lots of Python modules have a setup.py script so you can just change to their directory and run python setup.py install to get the module properly installed. In fact, oauth2 does have such a module so you should try that first.

Then if it still doesn't work it is a matter of making sure that the oauth2 directory is on your search path. Most people would put it in their site-packages directory, but it is OK to just add the oath2 directory (the one containing __init__.py, to the Python path. That is what .pth files do.

If you don't have easy_install or pip, the easiest way to solve this problem is to download http://python-distribute.org/distribute_setup.py and execute it on your system. This will install both pip and easy_install for you.

Michael Dillon
  • 31,973
  • 6
  • 70
  • 106
  • where do i try 'easy_install oauth2' or 'pip install oauth2' and where do i try 'python setup.py install' ? ill remove oauth2 and do httplib2 right now i guess – gta0004 Oct 15 '11 at 23:15
  • 2
    @gta0004: ... on the command line, of course (you'll need to install `setuptools` for `easy_install`, but it's worth it). How were you running setup.py before? – Cameron Oct 15 '11 at 23:22
  • @Michael Dillon: is it normal for the httplib2 folder to not that the `__init__.py`? everything else in the site-packages folder has it, httplib2 is the only one that doesn't, and its the only one that dont work. – gta0004 Oct 16 '11 at 00:25
  • C:\tmp\oauth2-1.5.211>pip 'pip' is not recognized as an internal or external command, operable program or batch file. C:\tmp\oauth2-1.5.211>easy_install 'easy_install' is not recognized as an internal or external command, operable program or batch file. – Qi Fan Jul 23 '12 at 18:18
  • How long does it normally take to install distribute? – Soumyajit Jul 03 '14 at 15:57