Skip to content

Installation

Get Bytesize up and running in your Python environment quickly and easily.

📋 Requirements

Before installing Bytesize, ensure you have:

  • Python 3.9 or higher
  • pip (usually comes with Python)

You can check your Python version with:

python --version
# or
python3 --version

🚀 Installation Methods

Install from PyPI using pip:

pip install bytesize

For Python 3 specifically:

pip3 install bytesize

If you're using uv for faster Python package management:

uv add bytesize

For projects using Poetry:

poetry add bytesize

For projects using Pipenv:

pipenv install bytesize

If using Conda (when available):

conda install bytesize

🔧 Development Installation

If you want to contribute to Bytesize or use the latest development version:

From Source

# Clone the repository
git clone https://github.com/your-username/bytesize.git
cd bytesize

# Install in development mode
pip install -e .

With Development Dependencies

# Install with development dependencies
pip install -e ".[dev]"

# Or with uv
uv sync --dev

✅ Verify Installation

After installation, verify that Bytesize is working correctly:

# Test basic import
from bytesize import Storage, StorageUnit

# Create a simple storage object
storage = Storage(1, StorageUnit.GB)
print(f"✅ Bytesize installed successfully! Test storage: {storage}")

# Test conversion
mb_value = storage.convert_to_mb()
print(f"✅ Conversion working: {mb_value}")

Expected output:

✅ Bytesize installed successfully! Test storage: 1.0 GB
✅ Conversion working: 1000.0 MB

We recommend installing Bytesize in a virtual environment to avoid conflicts:

# Create virtual environment
python -m venv myproject

# Activate (Linux/macOS)
source myproject/bin/activate

# Activate (Windows)
myproject\Scripts\activate

# Install Bytesize
pip install bytesize
# Create conda environment
conda create -n myproject python=3.11

# Activate environment
conda activate myproject

# Install Bytesize
pip install bytesize

🚨 Troubleshooting

Common Issues

Permission Issues

If you get permission errors on Linux/macOS, try:

pip install --user bytesize

Python Version

If you get a "Python version not supported" error:

# Check your Python version
python --version

# Upgrade Python if needed (using pyenv example)
pyenv install 3.11.0
pyenv global 3.11.0

Package Not Found

If pip can't find the package:

# Update pip first
pip install --upgrade pip

# Try installing again
pip install bytesize

Environment Issues

If you're having environment-related issues:

  1. Check Python path:

    which python
    which pip
    

  2. Verify virtual environment:

    pip list | grep bytesize
    

  3. Clear pip cache:

    pip cache purge
    

🔄 Upgrading

To upgrade to the latest version:

# Upgrade with pip
pip install --upgrade bytesize

# Check version
python -c "import bytesize; print(bytesize.__version__)"

🗑️ Uninstallation

To remove Bytesize:

pip uninstall bytesize

📦 Dependencies

Bytesize has zero external dependencies - it only uses Python's standard library:

  • pathlib - For cross-platform path operations
  • platform - For platform detection
  • enum - For storage unit definitions
  • typing - For type annotations

This means: - ✅ Faster installation - ✅ Smaller footprint
- ✅ Fewer security concerns - ✅ Better compatibility

🎯 Next Steps

Now that you have Bytesize installed: