CodeMonkey
CodeMonkey

Reputation: 2295

Installing Python setup tools on Unix to run Tweepy Twitter client for Python

I am trying to run Tweepy client for Twitter on my Unix account. whenever i try to run setup for Tweepy using the command:

python setup.py

I get this error:

Traceback (most recent call last):
File "setup.py", line 3, in ?
from setuptools import setup, find_packages
ImportError: No module named setuptools

Now i searched on some forums and found i need to add setup tools file. The file i found

setuptools-0.6c11-py2.7.egg

I FTP - ed this file to my unix directory where i have Tweepy client directory and my program which is using Tweepy.

Now, whenever i try to install setup tools using the command

python setuptools-0.6c11-py2.7.egg

I get the error :

python setuptools-0.6c11-py2.7.egg
  File "setuptools-0.6c11-py2.7.egg", line 2
    if [ `basename $0` = "setuptools-0.6c11-py2.7.egg" ]
                   ^
SyntaxError: invalid syntax

Any clues/suggestions what i must be doing wrong here ?

Upvotes: 2

Views: 1915

Answers (3)

jfs
jfs

Reputation: 414905

To install tweepy, run inside a virtualenv:

(venv) $ pip install tweepy

To create a virtual environment and install setuptools/distribute/easy_install, pip, and virtualenv, run:

$ curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
$ python virtualenv.py venv
$ source ./venv/bin/activate

taken from here

Upvotes: 1

Kugel
Kugel

Reputation: 19864

Don't use setuptools, use distribute. Setuptools is old and deprecated. Until python 3.4 with packaging/distutils2 is around use distribute, which is a fork of old setuptools/distutils.

Simply download the distribute source tarball, unpack and run python setup.py install. Alternatively, you can download distribute-setup.py and just run it.

Upvotes: 3

David L.
David L.

Reputation: 2103

The setuptools documentation suggest using sh setuptools-0.6c11-py2.7.egg instead of python setuptools-0.6c11-py2.7.egg.

You get a SyntaxError from python because setuptools-0.6c11-py2.7.egg begins as a shell script:

#!/bin/sh
if [ `basename $0` = "setuptools-0.6c11-py2.7.egg" ]
then exec python2.7 -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from setuptools.command.easy_install import bootstrap; sys.exit(bootstrap())" "$@"
else
  echo $0 is not the correct name for this egg file.
  echo Please rename it back to setuptools-0.6c11-py2.7.egg and try again.
  exec false
fi
PK\00\00\00\00F\A3\E...

Upvotes: 0

Related Questions