Registry / http-networking / pyowm
library3.5.0pypypi✓ verified 87d ago

PyOWM is a Python wrapper library for the OpenWeatherMap web APIs, providing easy access to current weather conditions, forecasts, and historical weather data for various locations worldwide. It is currently at version 3.5.0 and actively maintained, with updates typically released to support new OpenWeatherMap API versions, features, and Python compatibility requirements.

pip install pyowm
INSTALL
IMPORT
SIG · PYOWM
P
pyowm
http-networkingpythonv3.5.0
Install
2.4s avg
Import
696ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.734s · 26.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.4s · import 0.659s · 27MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OWM
from pyowm import OWM
weather_manager
from pyowm.utils import config, timestamps owm = OWM(API_KEY) mgr = owm.weather_manager()
owm = OWM25(API_KEY) mgr = owm.get_weather_manager()
OWM25 and old manager access methods are deprecated in v3.x; use OWM and .weather_manager().

Initialize PyOWM with your OpenWeatherMap API key (preferably from an environment variable). Then, use the `weather_manager` to fetch current weather conditions for a city or get a daily forecast using the One Call API 3.0. A free API key supports basic calls and the first 1000 calls/day for One Call by Call API.

import os from pyowm import OWM API_KEY = os.environ.get('OWM_API_KEY', 'your-api-key-here') if not API_KEY or API_KEY == 'your-api-key-here': print("WARNING: OWM_API_KEY environment variable not set or is placeholder.") print("Please get a key from openweathermap.org and set it.") exit() owm = OWM(API_KEY) mgr = owm.weather_manager() try: # Search for current weather in a specific city observation = mgr.weather_at_place('London,GB') weather = observation.weather print(f"Current weather in London: {weather.status}, Temperature: {weather.temperature('celsius')['temp']}°C") # Get a One Call API daily forecast (requires One Call API 3.0 compatible key) # For free keys, use 'One Call by Call' subscription, first 1000 calls/day are free. one_call_forecaster = mgr.one_call(lat=51.5074, lon=-0.1278) daily_forecast = one_call_forecaster.forecast_daily if daily_forecast: today = daily_forecast[0] print(f"Today's forecast: {today.status}, Max Temp: {today.temperature('celsius')['max_temp']}°C") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingPyOWM v3.5.0 dropped support for Python 3.8. Python 3.8 reached end-of-life status. Attempting to use PyOWM 3.5.0+ with Python 3.8 will result in incompatibility.
fix
Upgrade your Python environment to 3.9 or newer. The library currently supports Python 3.9+.
affects: >=3.5.0
breakingPyOWM v3.4.0 transitioned to OpenWeatherMap's One Call API 3.0, deprecating One Call API 2.5. OpenWeatherMap officially closed access to API 2.5 in June 2024. Older API keys or code relying on API 2.5 endpoints might fail.
fix
Ensure your OpenWeatherMap API key is compatible with One Call API 3.0. Update your code to use `one_call()` methods, especially for forecasts and historical data, as legacy `forecast_at_place()` may no longer work with newer free API keys.
affects: >=3.4.0
breakingPyOWM 3.0.0 was a major release that introduced significant backwards-incompatible changes from PyOWM 2.x, including a complete refactor of the high-level API functions and object model. This version also explicitly dropped Python 2.x support.
fix
Refer to the PyOWM v3 migration guide in the official documentation. You will likely need to rewrite parts of your code, especially related to OWM object instantiation and manager calls (e.g., `OWM25` -> `OWM`, `get_weather_manager()` -> `weather_manager()`).
affects: >=3.0.0
gotchaNewer free OpenWeatherMap API keys might return 'UnauthorizedError' or fail when attempting to access legacy API endpoints (e.g., `weather_at_coords` or `forecast_at_place` directly) that are not part of the One Call API 3.0, even if the key is valid.
fix
Always use the `one_call()` method for comprehensive weather data (current, forecast, history) as it is the officially supported and future-proof approach for most use cases with current API keys. Check the OpenWeatherMap API documentation for endpoint compatibility with your subscription type.
affects: All versions with new OWM API keys
Errors
Common errors & fixes
AttributeError: 'OWM25' object has no attribute 'xxx'
You are attempting to use code written for PyOWM v2 with a PyOWM v3 library installation. The `OWM25` class and its methods (`get_weather_manager`, etc.) were removed in PyOWM v3.
fix
Update your code to use the PyOWM v3 API. Replace `from pyowm.owm25 import OWM25` with `from pyowm import OWM` and adapt object instantiation and method calls (e.g., `owm = OWM(API_KEY)` and `mgr = owm.weather_manager()`).
UnauthorizedError: Invalid API Key provided.
The OpenWeatherMap API key provided is either incorrect, expired, or you are attempting to access an API endpoint not permitted by your subscription level or that is deprecated for your key type (e.g., using a new free key with legacy API 2.5 endpoints).
fix
Double-check your API key for typos. If using a new free key, ensure you are calling the `one_call()` methods. Verify your OpenWeatherMap account for API key status and subscription details. Allow some time (up to a few hours) for new API keys to become active.
ModuleNotFoundError: No module named 'geojson'
The `geojson` dependency, required by PyOWM 3.4.0 and later, is missing from your environment. This can happen if pip's dependency resolution fails or if installing from source without dependencies.
fix
Install the `geojson` package: `pip install geojson`. If you previously installed PyOWM, run `pip install --upgrade pyowm` to ensure all dependencies are correctly pulled in.
KeyError: 'temp' (or similar on weather.temperature('celsius')['temp'])
This usually indicates that the weather data returned from the OpenWeatherMap API did not contain the expected 'temp' key within the temperature data. This can happen for certain locations or when the API response structure changes slightly.
fix
Add error handling to check for the existence of keys before accessing them. For temperature, sometimes min/max/day/night temps might be available instead of a generic 'temp' depending on the API call (e.g., forecast vs current weather). Check the `weather.temperature()` output structure. For example, `print(weather.temperature('celsius'))` to see available keys.
Upgrade
Version history
3.5.0latest on PyPI · released Aug 26, 2025
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the OpenWeatherMap API. Implicit in API wrappers.
geojsonrequiredDependency for handling GeoJSON geometry objects. Specific version constraint (>=3,<4) since PyOWM 3.4.0.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
pyowm — pip install pyowm · libregistry