1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
# Installation
## Requirements
- **Python**: 3.10 or higher
- **NetBox**: 3.3 or higher (for pyNetBox 6.7+)
- **Dependencies**:
- `requests>=2.20.0,<3.0`
- `packaging`
## Installation Methods
### Install from PyPI (Recommended)
The easiest way to install pyNetBox is using pip:
```bash
pip install pynetbox
```
### Install from Source
If you need the latest development version or want to contribute:
```bash
# Clone the repository
git clone https://github.com/netbox-community/pynetbox.git
cd pynetbox
# Install in development mode
pip install -e .
# Or install directly
python setup.py install
```
### Using a Virtual Environment (Recommended)
It's recommended to use a virtual environment to isolate pyNetBox dependencies:
```bash
# Create a virtual environment
python3 -m venv venv
# Activate it (Linux/macOS)
source venv/bin/activate
# Activate it (Windows)
venv\Scripts\activate
# Install pynetbox
pip install pynetbox
```
## Verifying Installation
After installation, verify pyNetBox is installed correctly:
```python
import pynetbox
print(pynetbox.version)
```
You can also test connectivity to your NetBox instance:
```python
import pynetbox
nb = pynetbox.api(
'http://localhost:8000',
token='your-api-token-here'
)
# Check NetBox version
print(nb.version)
# Check API status
print(nb.status())
```
## Upgrading
To upgrade to the latest version:
```bash
pip install --upgrade pynetbox
```
To upgrade to a specific version:
```bash
pip install pynetbox==7.6.0
```
## Development Installation
If you're planning to develop or contribute to pyNetBox:
```bash
# Clone the repository
git clone https://github.com/netbox-community/pynetbox.git
cd pynetbox
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate
# Install development dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
# Install in editable mode
pip install -e .
```
## Docker Setup for Testing
The test suite requires Docker for integration tests:
```bash
# Ensure Docker is installed and running
docker --version
# Run the test suite
pytest
```
For more information on running tests, see the [Development Guide](development/index.md).
## Next Steps
- Read the [Getting Started Guide](getting-started.md) for basic usage
- Explore the [API Reference](endpoint.md) for detailed documentation
- Check the [Advanced Topics](advanced.md) for custom configurations
|