0

I have looked at all the forums, but nothing has worked so far. I have spent hours trying to install it so any help would be appreciated. i have downloaded and unzipped tweepy, went on to the command prompt, typed "cd tweepy-master". This works, but when i type "python setup.py install" or "python setup.py build".

When i type "python setup.py install" the error says.

Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from setuptools import setup, find_packages
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\__init__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\extension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\dist.py", line 103
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

When i type "python setup.py build"

Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from setuptools import setup, find_packages
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\__init__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\extension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\dist.py", line 103
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

I saw alot of people saying to use pip, but i am struggling to install that to. Thanks for the help

Sociopath
  • 13,068
  • 19
  • 47
  • 75
Sam
  • 65
  • 4
  • 7

2 Answers2

0

pip is the good way to install a package. If you are not interested then you can install from source.

But you have to remember that, If you are using virtualenv or virtualenvwrapper then you can use python setup.py install otherwise you should use sudo python setup.py install.

If you are windows user then, open your cmd with administator privilege and type python setup.py install.

0

Have you installed Python using the Windows installer from python.org?

Cause this comes with pip already bundled into it. (I can not check the exact location atm, as I am on a Mac, but according to this SO post it should be located under C:\PythonX.X\Scripts, if you kept the default install location - otherwise it should be located in <path-to-python>\Scripts of course).

Otherwise pip can easily installed using this script. Simply call python get-pip.py in the script location and pip should be available afterwards (if not directly from commandline with pip, than at least by using python -m pip.) Having pip finally available, you should be able to easily install tweepy calling pip install tweepy (or python -m pip install tweepy respectively).

For further information on pip and the other options to install it, check https://pip.pypa.io/en/stable/installing/.

PS. If installing the package via pip does not work, this may be a compatibility issue. According to the tweepy github-page python 3.2 is not amongst the supported python versions. So if your portable python really has an interpreter versioned 3.2.... (you can check the version of your interpreter running python from cmd, which should print something like > Python 3.X.X), the package may not run properly at all (even if you can install it without a problem).

As the portable python apparently is no longer supported anyways, it may be worth trying a different solution. There are plenty suggested on the portable python website (I just know about Anaconda, but this works flawlessly). But if you only want to use python with tweepy and don't need anything like scipy or numpy, I'd suggest simply downloading the installer from the official website. As said, pip gets shipped with the standard installation and can be used to easily install most of the packages you will need. (Except for e.g. the abovementioned scipy/numpy, which require additional non-python libraries whose "manual" installation may not be worth the trouble and hence legitimates the use of a more comprehensive environment like Anaconda).

Community
  • 1
  • 1
Kim
  • 1,361
  • 3
  • 18
  • 24
  • I downloaded 3.5 python from the python.org website and it says it installed pip. But i have tried typing "pip install tweepy" and "python -m pip install tweepy" in the admin command prompt but it says "'pip' is not recognized as an internal or external command, operable program or batch file." – Sam Sep 17 '16 at 11:08
  • You need to add the `pip` executable to the System path. On Windows 8/10 this can be done by rightclicking the Windows-Icon, then select "System" → “Advanced system settings” → “Environment Variables”. Then add the above mentioned python script-location to the path, restart your cmd and you should be ready to go. PS. According to this SO [post](http://stackoverflow.com/questions/6318156/adding-python-path-on-windows-7) in Windows 7 you could also add the location to the path by executing `setx path "%path%;C:\Python35\Scripts;"`. May be worth a try :-) – Kim Sep 18 '16 at 16:09
  • FYI: If you are using Python 3 use `pip3` instead of just `pip`. `pip` is Python 2 – DowntownDev Jan 13 '17 at 04:42