kevinabrandon / AboveTustin

ADS-B Twitter Bot. Uses dump1090-mutability to track airplanes and then tweets whenever an airplane flies overhead.
MIT License
72 stars 21 forks source link

How to install? #10

Closed regis57 closed 7 years ago

regis57 commented 7 years ago

I got the phamtomJS installed already.

But sorry to be this noob, I have no glue on how to install the twitter. What are the command lines?

Same for aboveTustin, does a git clone is enough? with edition of the config file?

thank you for the details.

kevinabrandon commented 7 years ago

Yeah, I need to add a how to install section in the readme, but here's a quick answer for you.

First copy the config.ini.sample and name it config.ini.

Take a look at the file and update the receiver latitude longitude and timezone. If your data and map urls are different, make sure to update them. Feel free to change the tweet_template so it will say whatever you want it to.

For the twitter section in the ini file you need to copy and paste 4 key strings from twitter. The Consumer Key, the Consumer Secret, the Access Token, and the Access Token Secret. Here's how you get them:

  1. Create a new twitter account, or use an existing one. Log in to your account.
  2. Go to https://apps.twitter.com/ and click Create New App.
  3. Give your app a name, description and website, agree to their terms and click "Create you Twitter application".
  4. Now that the app is created, you should be in its settings page. Find and click the tab that says "Keys and Access Tokens".
  5. In the "Application Settings" section there should be two keys, the "Consumer Key" and the "Consumer Secret". Copy and paste those keys to the config.ini file.
  6. At the bottom of that same page is a section called "Your Access Token". Click the button that says "Create my access token".
  7. Now there should be two keys called "Access Token" and "Access Token Secret". Copy and paste those keys into the ini file.

Make sure you never share those secret keys anywhere.

That's it. Assuming all the dependencies are installed (like the python twitter package, and selenium), you should be able to run it by going to the command line and typing "python3 tracker.py".

Good luck, and let me know if it works.

regis57 commented 7 years ago

Hi Kevin, I manage to set up my adsbreceiver back online after few hiccups. Looking at selenium and python twitter package, do I need to install firefox as well? I have no GUI (no startx), will it still manage to screen capture picture for twitter? -Regis

Jestre commented 7 years ago

@regis57 The Selenium package will create an in-memory representation of the website, and that is from where the screenshot is taken. No need to install Firefox.

Though get the pre-compiled one linked above, rather than trying to build it yourself, unless you have a lot of free time :)

Best of luck

regis57 commented 7 years ago

pi@raspberrypi:~/AboveTustin $ sudo python3 tracker.py Traceback (most recent call last): File "tracker.py", line 9, in from twitter import * ImportError: No module named 'twitter' pi@raspberrypi:~/AboveTustin $

thank you. Using pip I install Twitter and Selenium. Now I got the error above. I have setup the config.ini file with my details (GPS, time zone, the 4 lines of twitter app code). Do I still need the phantomJS package or Twitter and Selenium are enough?

For info: is that enough to install the twitter?

sudo pip install -U twitter Collecting twitter Downloading twitter-1.17.1-py2.py3-none-any.whl (55kB) 100% |████████████████████████████████| 61kB 839kB/s Installing collected packages: twitter Successfully installed twitter-1.17.1

regis57 commented 7 years ago

https://github.com/jprochazka/phantomjs-linux-armv7l

Installed PhamtomJS using this method.

It added 2GB data. But I got same error as above.

I have no idea what I am suppose to do now with this:

sudo python3 tracker.py Traceback (most recent call last): File "tracker.py", line 9, in from twitter import * ImportError: No module named 'twitter'

Jestre commented 7 years ago

@regis57

You don't (or shouldn't) need sudo when running the script.

What does a simple pip list show? Are you installing these libraries in a virtualenv? Or into the system default?

Also, while I can't get to my instance from here, it seems to me there is a shell script to run the whole thing, what happens if you try that, i.e. ./run_tracker.sh.

regis57 commented 7 years ago

@Jestre @kevinabrandon

*pi@raspberrypi:~ $ cd AboveTustin pi@raspberrypi:~/AboveTustin $ python3 tracker.py Traceback (most recent call last): File "tracker.py", line 9, in from twitter import ImportError: No module named 'twitter' pi@raspberrypi:~/AboveTustin $ pip list DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. appdirs (1.4.3) packaging (16.8) pip (9.0.1) pyparsing (2.2.0) python-apt (0.9.3.12) RPi.GPIO (0.6.3) selenium (3.4.1) setuptools (35.0.2) six (1.10.0) twitter (1.17.1)** wheel (0.29.0) pi@raspberrypi:~/AboveTustin $

The command ./run_tracker.sh keep repeat my error line 9. I has to restart.

I run it all from the pi using ssh.

I tried to run python3 tracker.py with no sudo, got same error.

Jestre commented 7 years ago

So do you also have a virtualenv (python virtual environment) created, or did you comment out line 8 in run_tracker.sh?

If you do have a virtualenv, what does pip list show when it is activated?

regis57 commented 7 years ago

@Jestre I am unable to tell its virtual or not. How can I know? I did not comment line 8 on this file you mention.

Jestre commented 7 years ago

@regis57 Are you on IRC somewhere, e.g. Freenode? Might be easier than spamming everyone with messages here.

But basically, did you create a virtual python environment by using something along the lines of virtualenv py3 or mkvirtualenv py3?

regis57 commented 7 years ago

@Jestre unfortunately not. And I see no private message feature in here :(

regis57 commented 7 years ago

@Jestre no I did not create a virtual env for python with these commands. Shall I proceed? Then how can I move stuff inside? It is automatic?

Jestre commented 7 years ago

@regis57 I guess I am out of ideas as to why you are getting the python error. I was thinking perhaps you had a virtualenv, but did not have it activated when you installed the twitter library, but that now seems not to be the case.

From your command line, if you simply call python3 and import twitter, does it also fail?

$ python3
>>> import twitter (or)
>>> from twitter import *
^D to exit
regis57 commented 7 years ago

@Jestre pi@raspberrypi:~ $ python3 Python 3.4.2 (default, Oct 19 2014, 13:31:11) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information.

import twitter (or) File "", line 1 import twitter (or) ^ SyntaxError: invalid syntax from twitter import * Traceback (most recent call last): File "", line 1, in ImportError: No module named 'twitter' exit Use exit() or Ctrl-D (i.e. EOF) to exit

Jestre commented 7 years ago

@regis57 Okay, other than checking to see if pip3 list yields different results than pip list on that system, I have no idea what is going on.

In your paste above, the '(or)' was not meant to be typed, meaning try either that line minus the (or) or the the other. Either way, I see that it doesn't work. Let me know if pip and pip3 differ, otherwise I've no idea without some kind of access. Hopefully someone else will chime in :)

kevinabrandon commented 7 years ago

Sorry about the headache @regis57. It has been a while since I've done this, and it was only my second python project so I don't really understand python project configurations. I do know that I setup a virtual environment, activated the virtual environment and then did a pip install twitter. Once it's installed in your virtual environment you should be able to call import twitter in the python interpreter without an error.

Sorry again for the headache, I wish I knew more about twitter projects (part of why I started this one) :)

regis57 commented 7 years ago

thank you both @Jestre & @kevinabrandon for your help. So I went to install the virtual python, install in it the twitter and selenium. got same error. So I surrender. In a near future I dream about seeing this into an adsbreceiver.net like installer for noobs like me. In mean time, I have to forget about it, it's beyond my area of expertise for sure.

Jestre commented 7 years ago

@regis57 If you want to try a TeamViewer session at some point in the future, let me know. It shouldn't be this hard :)

regis57 commented 7 years ago

@Jestre with pleasure. But for now I have 'rage uninstall' the phantomJS with its 7hours of compilation. When I put it back let's do that. Does it needs to be install in virtual env as well?

Jestre commented 7 years ago

@regis57 If this is all that is running on this Pi, it doesn't matter too much whether you put it in a venv or not. Did you install that with pip as well? Some of these are better off installed via apt or with the pre-built packages.

ktul584 commented 7 years ago

I'm having this issue:

Traceback (most recent call last):
  File "/usr/lib/python3.4/configparser.py", line 1116, in _unify_values
    sectiondict = self._sections[section]
KeyError: 'dump1090'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tracker.py", line 10, in <module>
    import flightdata
  File "/home/pi/AboveTustin/flightdata.py", line 34, in <module>
    dump1090_data_url = parser.get('dump1090', 'data_url')
  File "/usr/lib/python3.4/configparser.py", line 754, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.4/configparser.py", line 1119, in _unify_values
    raise NoSectionError(section)
configparser.NoSectionError: No section: 'dump1090'
regis57 commented 7 years ago

@Jestre I have flightaware, planefinder, flightradar24, radarbox24 and duckdns running. Processor only top 45% (since recent addition of radarbox24) load on rpi3 and memory use is low.

regis57 commented 7 years ago

hi guys FYI, I have turn to romeo-golf 2.6.0 fork of ADSBRECEIVER.NET and the install was a piece of cake. I just need to tweak my translation to french, fix mph to kph, distance in KM, waiting to correct altitude.

ghost commented 7 years ago

Hello, and thanks for this nice software - but unfortunately, I have a problem - I've installed AboveTustin in my RPi3 with Jessie, and installed python-twitter and python-selenium. I've corrected the default python to use in my system, aliasing python to /usr/bin/python3.4 executable. Now, when I run 'python tracker.py', I've not anymore this error >>>

File "tracker.py", line 9, in from twitter import *

But this one:

Traceback (most recent call last): File "tracker.py", line 10, in import flightdata File "/home/pi/AboveTustin/flightdata.py", line 20, in from urllib.request import urlopen ImportError: No module named request

I've not used pip, I've installed the deps with common apt-get install. How can I import these modules to run right your code?

Thanks!