Skip to content
o355 edited this page Apr 12, 2017 · 23 revisions

Setting up PyWeather

You can set up PyWeather in one of two ways. Automatic (using the setup script), or Manually (using the instructions below).

Automatic setup

As of PyWeather 0.3 beta, PyWeather comes with a setup script (named setup.py), in which you can run. This setup script will basically run through...

  • Checking for Python 3
  • Checking for PIP (and installing it if it doesn't exist)
  • Installing necessary libraries
  • Guiding you to obtain an API key (with detailed instructions)
  • Checking your connection to make sure the geocoders/API isn't blocked
  • Going through configuration options that are available

All you have to do is execute the script, and it does everything for you. The setup script will ask some questions, but it's a much easier setup versus doing it manually.

On Linux, if you already have pip installed, I'd recommend installing necessary libraries before running the setup script. If you want the setup script to install libraries for you, you'll most likely need to run the setup script as root.

The commands to install the necessary libraries are: sudo pip3 install colorama sudo pip3 install geopy sudo pip3 install geocoder

Running the pip install commands as sudo ensures that the libraries are installed.

Manual setup

PyWeather requires a decent amount of stuff to work properly.

You'll first want Python 3. PyWeather DOES NOT run on Python 2, and I don't plan to port it to Python 2 any day now. You could try, there's programs out there.

First, download PyWeather. You can download it using the ZIP file on the releases screen, extract it, you get it. Or, if you're on Linux...

git clone https://github.com/o355/pyweather.git --depth=1

If you don't have git, you can install it with your preferred package manager.

Second, you'll need a Wunderground API key. Head over to https://www.wunderground.com/weather/api/, click Explore My Options, click on Anvil Plan, and then make sure the pricing is set to Developer. If you plan on using PyWeather frequently (aka more than 150 times a day/3 times a minute), you may want to consider getting a paid API key.

Alright, enough blabber. Sign up for account, do the email confirmation (fair warning, it takes a few minutes for the confirmation email to hit), and get your API key.

Next up, create a file called "apikey.txt" in the storage folder of PyWeather. Copy + paste your API key in there, and don't fire up PyWeather.

Next, you'll want to install PyPi (or as it's commonly known, PIP.)

Doing such is dependent on what OS you're running. DISCLAIMER: For Windows users, be sure Python is in your PATH, so to speak. If you don't want to go through all the trouble of adding Python to the PATH, if you download Python's setup file, click the toggle for "Add Python to the PATH" on the bottom of the first screen, and install Python. If you already have Python installed, doing this should do no harm.

For Windows users, PIP should of installed when you installed Python (from the setup file), so no worries there.

For Mac OS X users, same deal. Honestly, I use Macs not on OS X, so...moving on.

For Linux users, you'll need to install python3-pip using a package manager. Yum, Apt, Pacman, whatever, it should be available. Confirm that you have Python 3, in the mean time, by entering the command python3. If you don't have Python 3, install python3 in your preferred package manager.

You can (optionally) install PyWeather by using the pipinstall.py script off of my pipupdate repo. But, that's totally optional.

Next, open up some sort of command prompt, and type in these 3 commands:

pip install colorama
pip install geopy
pip install geocoder

For Linux users, you'll need to use pip3 install colorama, etc. If you run into errors during the installation, run pip3 as root using sudo.

Alright, now that you have all those libraries, finally, fire up PyWeather!

Double click PyWeather. In a Linux terminal? python3 pyweather.py

If you'd like to configure some options, go ahead and modify the config.ini file in the storage folder of PyWeather. In the storage folder of PyWeather, there's also a config readme, so you can get the rundown on what each option does. I'd highly suggest you read the config readme, as it contains very important information regarding default values, and the purpose of each variable.

Oh, and don't worry. The .ini file won't harm your computer! I chose to use an .ini file, as they're the easiest to implement into Python 3.

Input your location, and shabam! You did it! PyWeather is set up and ready to rumble. Make sure you check back on GitHub often as I do push updates to PyWeather that adds new features and may remove/add stability (at least for the time being). Using the PyWeather update is the native way, but you can also use git pull to update from Git. It should work without using git stash. I think I confused it with git fetch, in which, yes, you will have to do git stash.

Clone this wiki locally