The go-to resource for upgrading Python, Django, Flask, and your dependencies.

Migrate from pyenv to mise: Complete Guide for Python 3.12 to 3.13 Upgrades


1. Migrate from pyenv to mise: Complete Guide for Python 3.12 to 3.13 Upgrades

Migrating from pyenv to mise streamlines Python version management. Mise, a Rust-based tool, replaces pyenv with faster shims, multi-language support, tasks, and direnv-like environments. This guide covers uninstalling pyenv, installing mise, migrating configs, and upgrading to Python 3.13.

Why Migrate from pyenv to mise?

Pyenv is Python-specific and uses slow shell shims. Mise offers:

  • Speed: Rust implementation, blazing-fast.
  • Versatility: Manages Node, Go, Rust, etc.
  • Environments: Automatic env vars per project.
  • Tasks: Built-in task runner like Make.
  • Python 3.13 Support: Latest versions readily available.

Perfect for Python 3.12 to 3.13 upgrades amid new features like improved error messages.

Prerequisites

  • macOS/Linux (Windows via WSL).
  • Homebrew (optional).
  • Backup .python-version files.

Step 1: Uninstall pyenv

Remove pyenv completely:

# If installed via Homebrew
brew uninstall pyenv pyenv-virtualenv

# Remove pyenv directory
rm -rf ~/.pyenv

# Edit shell config (~/.zshrc, ~/.bashrc)
# Remove lines like:
# export PYENV_ROOT="$HOME/.pyenv"
# export PATH="$PYENV_ROOT/bin:$PATH"
# eval "$(pyenv init -)"

Restart shell: exec $SHELL

Step 2: Install mise

curl https://mise.run | sh

Add to shell (e.g., ~/.zshrc):

echo 'eval "$(mise activate zsh)"' >> ~/.zshrc
exec $SHELL

Verify: mise --version

Step 3: Migrate Python Versions from pyenv

List pyenv versions (if remnants):

# From backup or memory, e.g., 3.12.5

Install with mise:

mise use --global python@3.12
mise use python@3.13.0  # Latest 3.13

Step 4: Update Config Files

Rename .python-version to .tool-versions:

mv .python-version .tool-versions

Mise reads .tool-versions for python=node etc.

Step 5: Verify Migration

python --version  # Should show 3.13.0
pip --version
which python      # ~/.local/share/mise/installs/python/3.13.0/bin/python

Test project: mise run test (if tasks defined).

Upgrading Projects to Python 3.13

  1. cd project
  2. Edit .tool-versions: python 3.13.0
  3. mise install
  4. Update deps: pip install --upgrade pip
  5. Test: Run your tests.

Handle breaking changes: Check Python 3.13 What’s New.

Troubleshooting

  • Shims not working: mise doctor
  • Install fails: Set MISE_GITHUB_TOKEN for rate limits.
  • Shell not activated: Restart or source ~/.zshrc.

Conclusion

You’ve migrated from pyenv to mise and upgraded to Python 3.13. Enjoy faster workflows! Share experiences in comments. Explore mise docs for more.

Sponsored by Durable Programming

Need help maintaining or upgrading your Python application? Durable Programming specializes in keeping Python apps secure, performant, and up-to-date.

Hire Durable Programming