twintproject / twint

An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.
MIT License
15.66k stars 2.72k forks source link

[Question] COLAB cannot find twint module #1153

Open MarkPadley opened 3 years ago

MarkPadley commented 3 years ago

Opened Google COLAB and installed twint using...

! pip3 uninstall twint ! pip3 install --user --upgrade git+https://github.com/twintproject/twint.git@origin/master#egg=twint

In the very next cell, COLAB tells me it cannot recognise 'twint'! I want to perform some GPU intensive NLP, hence the requirement for a COLAB. Please help!

ModuleNotFoundError Traceback (most recent call last)

in () 4 nest_asyncio.apply() 5 ----> 6 import twint 7 # Code below courtesy of Deepak from twint 'issues' 8 config = twint.Config() ModuleNotFoundError: No module named 'twint' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. - Python version is 3.8.8 Windows 10
krisbolton commented 3 years ago

I have the same issue if I use the ! pip3 install --user --upgrade git+https://github.com/twintproject/twint.git@origin/master#egg=twint method, however ! pip3 install twint works.

I think it doesn't work because of the warning: "The script twint in installed in '/root/.local/bin which is not on PATH", so when you import twint, it can't find it. This stack overflow Q&A might be of use if you want to try to solve the issue, but ! pip3 install twint works.

PraveenRJ908 commented 3 years ago

I have the same issue if I use the ! pip3 install --user --upgrade git+https://github.com/twintproject/twint.git@origin/master#egg=twint method, however ! pip3 install twint works.

I think it doesn't work because of the warning: "The script twint in installed in '/root/.local/bin which is not on PATH", so when you import twint, it can't find it. This stack overflow Q&A might be of use if you want to try to solve the issue, but ! pip3 install twint works.

This isn't working. I tried ! pip3 install twint and installed the library. However, in the next step, I am getting, there is no module named Twint. Kindly clarify what should be done?

Branch-h commented 3 years ago

This works for me:

import os
!pip install twint
!pip uninstall twint -y
!git clone --depth=1 https://github.com/twintproject/twint.git
%cd twint/
!pip3 install . -r requirements.txt
%cd ..

and if you need c.Limit then use:

import os
from google.colab import output
!pip install twint
!pip uninstall twint -y
!git clone --depth=1 https://github.com/twintproject/twint.git
%cd twint/twint/
!sed -i 's/tweet_count = 100/tweet_count = 100 if not config.Limit else config.Limit/g' url.py
%cd ..
!pip3 install . -r requirements.txt
%cd ..
output.clear()
PraveenRJ908 commented 3 years ago

import os !pip install twint !pip uninstall twint -y !git clone --depth=1 https://github.com/twintproject/twint.git %cd twint/ !pip3 install . -r requirements.txt %cd ..

Thanks this worked :)

agombert commented 3 years ago

Works pretty well ! thanks @Branch-h.

ManalBenchrif commented 3 years ago

! pip3 install twint

Work pretty well, Thank you