Forums

Tweepy version 2.1

I need to use Tweepy 2.1 as the search function in 2.0 uses the old, deactivated version of the Twitter API.

I tried installing Tweepy 2.1 locally following the instructions under 'How do I install new Python modules?" here: https://www.pythonanywhere.com/help/. I was using variations of the command:

pip install tweepy lxml==2.1 --user

However, when I start Python and import tweepy, the version is still 2.0.

What am I doing wrong?

Alternatively, are there any plans for the default tweepy module to be upgraded to 2.1?

Hmmm, it looks like version 2.1 hasn't been released yet -- here's the GitHub release page and here's the current list of releases on PyPI. When they release the next version they we'll pick it up automatically (so long as it doesn't break anything else).

In the meantime, if you want to use the GitHub master (that is, the unreleased dev version) then I think the best thing to do is to create a virtualenv, switch to it, then git clone Tweepy and install it manually:

git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install

Actually you don't need to use a local checkout if you don't wish, you can just use pip with a remote repository directly (make sure you're in a virtualenv first!):

pip install git+https://github.com/tweepy/tweepy.git

This does a local checkout in a temporary directory and then installs it normally from there, cleaning up the temporary directory afterwards. This approach has the advantage you can easily upgrade it later:

pip install --upgrade git+https://github.com/tweepy/tweepy.git

And also uninstall it:

pip uninstall tweepy

The disadvantage is that if you wish to create a new virtualenv later and do another install, it will always use the latest HEAD revision from the repository so your environment isn't quite so repeatable. If you use your own repository, you can control when you fetch from it so you have a little more control, at the expense of a little more hassle. In this case, I would still use pip for uninstall support - you can do an editable install like this:

git clone https://github.com/tweepy/tweepy.git
pip install -e ./tweepy

This basically just links the repository code into your virtualenv so that you can import it like a regular module, but any edits or updates you make to the repository will be immediately reflected in your environment. If you want to do a regular install of a local checkout instead of an editable one (i.e. where it installs a copy into the local environment instead of linking direct to the repo) then just omit the -e.

See pip's VCS support documentation for more details of supported repository types.

Why can I not install tweepy? I have checked that I'm using python 3.8 but every time I try to install tweepy using: pip install git+https://github.com/tweepy/tweepy.git and other variations, the same error comes up:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date . A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/dev elopment/release-process/#python-2-support Looking in links: /usr/share/pip-wheels Obtaining file:///home/xxx/tweepy ERROR: Package 'tweepy' requires a different Python: 2.7.12 not in '>=3.5'

Am I not using python 3.8 or something?

If you use the command pip then it will try to install for Python 2.7; to install for Python 3.8, use pip3.8. See this help page for more details.