Registry / aws / python-neutronclient

python-neutronclient

JSON →
library12.0.0pypypi✓ verified 87d ago

python-neutronclient is a client library for the OpenStack Networking (Neutron) API. It provides Python API bindings and previously included a command-line interface. As of version 11.8.0, the project is deprecated; its CLI code has been removed, and no new features will be added. All new development and migrations under OpenStack governance are directed towards using OpenStackSDK and OpenStack Client.

pip install python-neutronclient
INSTALL
IMPORT
SIG · PYTHON-NEUTRONCLIE
P
python-neutronclient
awspythonv12.0.0
Install
10.1s avg
Import
916ms
Disk
122MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v12.0.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.954s · 113.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 10.1s · import 0.878s · 115MB
122MB installed
● package 122MB
Code
Verified usage

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

Client
from neutronclient.v2_0 import client

This quickstart demonstrates how to authenticate with OpenStack Keystone using environment variables and then initialize the Neutron client to list networks. It uses `keystoneauth1` for robust session management.

import os from keystoneauth1 import identity from keystoneauth1 import session from neutronclient.v2_0 import client # Set these environment variables or replace with actual values OS_AUTH_URL = os.environ.get('OS_AUTH_URL', 'http://auth.example.com:5000/v3') OS_USERNAME = os.environ.get('OS_USERNAME', 'your_username') OS_PASSWORD = os.environ.get('OS_PASSWORD', 'your_password') OS_PROJECT_NAME = os.environ.get('OS_PROJECT_NAME', 'your_project_name') OS_USER_DOMAIN_NAME = os.environ.get('OS_USER_DOMAIN_NAME', 'Default') OS_PROJECT_DOMAIN_NAME = os.environ.get('OS_PROJECT_DOMAIN_NAME', 'Default') # Authenticate using Keystone v3 password flow auth = identity.Password( auth_url=OS_AUTH_URL, username=OS_USERNAME, password=OS_PASSWORD, project_name=OS_PROJECT_NAME, user_domain_name=OS_USER_DOMAIN_NAME, project_domain_name=OS_PROJECT_DOMAIN_NAME ) sess = session.Session(auth=auth) # Create a Neutron client instance neutron_client = client.Client(session=sess) # Example: List networks try: networks = neutron_client.list_networks() print("Networks:") for net in networks['networks']: print(f" - {net['name']} ({net['id']})") except Exception as e: print(f"Error listing networks: {e}")
Debug
Known issues
breakingThe `python-neutronclient` project is officially deprecated. Its command-line interface (CLI) code has been deleted, and no new features will be added to the Python API bindings. Users are strongly encouraged to migrate to `openstacksdk` for Python API interactions and `openstackclient` for CLI operations.
fix
Migrate your codebase to use `openstacksdk` (for library usage) or `openstackclient` (for CLI). For example, `openstacksdk.connect()` provides a unified client.
affects: All versions, explicitly stated as deprecated from 11.x.x onwards.
deprecatedThe `neutron` CLI (provided by older versions of `python-neutronclient`) was deprecated from the OpenStack Ocata release. While `python-neutronclient` provided extensions for the unified `openstackclient`, the primary CLI for networking functionality is now `openstackclient`.
fix
Use the unified `openstack` CLI, which integrates network commands. Example: `openstack network list` instead of `neutron net-list`.
affects: All versions since OpenStack Ocata (approx. 2017), explicitly from `python-neutronclient` versions where CLI was removed (e.g., 11.x.x).
gotchaAuthenticating with OpenStack Identity (Keystone) v2.0 is deprecated. Using v2.0 may lead to authentication issues or limited functionality as OpenStack services increasingly require v3.0.
fix
Ensure your authentication uses Keystone v3.0. This involves providing domain-specific parameters (e.g., `user_domain_name`, `project_domain_name`) when configuring the `keystoneauth1.identity.Password` plugin.
affects: All versions, especially when interacting with modern OpenStack clouds.
gotchaCommon authentication failures, such as `Unauthorized` or `EndpointNotFound`, often result from incorrect or missing OpenStack environment variables (e.g., `OS_AUTH_URL`, `OS_USERNAME`, `OS_PASSWORD`, `OS_PROJECT_NAME`, `OS_USER_DOMAIN_NAME`, `OS_PROJECT_DOMAIN_NAME`) or an expired authentication token.
fix
Double-check that all required environment variables are correctly set and accessible to your application. If tokens are managed manually, ensure they are fresh. Using `keystoneauth1.session.Session` is the recommended way to handle token refresh automatically.
affects: All versions.
Errors
Common errors & fixes
neutron: command not found
The `neutron` command-line interface executable was removed from the `python-neutronclient` package starting with version 11.8.0 due to its deprecation.
fix
Use the `openstack` command-line client from `python-openstackclient` for OpenStack Networking operations. Example: `openstack network list`.
ModuleNotFoundError: No module named 'neutronclient.shell'
The `neutronclient.shell` module, which provided internal command-line interface functionality, was removed from the `python-neutronclient` library in version 11.8.0 as part of its deprecation.
fix
Refactor your Python code to use the `openstacksdk` library for programmatic OpenStack API interactions. Example: `from openstack import connection`.
neutronclient.common.exceptions.Unauthorized: The request you have made requires authentication.
This error indicates that the provided credentials (e.g., username, password, project ID, auth URL) are incorrect or missing, preventing authentication with the OpenStack Identity service (Keystone).
fix
Ensure your environment variables (like OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, OS_PROJECT_NAME) are correctly set, or pass the correct credentials directly to the `neutronclient.v2_0.client.Client` constructor. For new development, consider using `openstacksdk` which offers robust authentication mechanisms.
Upgrade
Version history
12.0.0latest on PyPI · released May 13, 2026
Audit
Dependencies
pythonrequiredRequired Python version
keystoneauth1requiredRequired for authentication with OpenStack Identity (Keystone)
openstacksdkrequiredIncreasingly used as a dependency, also the recommended migration path
requestsrequiredUnderlying HTTP client library
Agent activity
20 hits · last 30 days
node
18
Resources
python-neutronclient — pip install python-neutronclient · libregistry