15

I have 3.8.2 installed via pyenv but I want to upgrade to 3.8.3 on my local machine, to match the version we're using in production.

$  pyenv install 3.8.3
python-build: definition not found: 3.8.3

The following versions contain `3.8.3' in the name:
  miniconda-3.8.3
  miniconda3-3.8.3

See all available versions with `pyenv install --list'.

If the version you need is missing, try upgrading pyenv:

  brew update && brew upgrade pyenv

ok let's try that...

$  brew update && brew upgrade pyenv
Updating Homebrew...
Warning: pyenv 1.2.18 already installed

I'm unclear where the Python versions that pyenv installs from are provided. I already have 3.8.3 installed:

$  brew info python@3.8
python@3.8: stable 3.8.3 (bottled) [keg-only]
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python@3.8/3.8.2 (4,137 files, 63.0MB)
  Poured from bottle on 2020-04-21 at 11:47:57
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python@3.8.rb
==> Dependencies
Build: pkg-config ✔
Required: gdbm ✔, openssl@1.1 ✔, readline ✔, sqlite ✘, xz ✔
==> Caveats
Python has been installed as
  /usr/local/opt/python@3.8/bin/python3

You can install Python packages with
  /usr/local/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
  /usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

==> Analytics
install: 398,535 (30 days), 966,259 (90 days), 1,270,935 (365 days)
install-on-request: 11,428 (30 days), 29,656 (90 days), 42,309 (365 days)
build-error: 0 (30 days)

So it's not that 3.8.3 is not available in Homebrew. And my Homebrew "linked" Python is 3.7.7, but that didn't stop me from installing 3.8.2.

Are we just stuck waiting for pyenv to push a new release to Homebrew? Is there some way I can point pyenv to my existing Homebrew-installed 3.8.3?

Anentropic
  • 32,188
  • 12
  • 99
  • 147

2 Answers2

18

You either have to wait for the new Homebrew pyenv release, make the release yourself and get it pulled it into Homebrew, or install the master branch of pyenv.

To install the master branch of pyenv and 3.8.3:

brew unlink pyenv
brew install pyenv --head
pyenv install 3.8.3

More info about the 3.8.3 release: https://github.com/pyenv/pyenv/pull/1612

Jungroth
  • 392
  • 2
  • 8
2

I was getting the similar issues with python version 3.11.2 with my Windows.

:: [Info] :: Mirror: https://www.python.org/ftp/python pyenv-install: definition not found: 3.11.2

The fix is to update your Pyenv by running the command pyenv update, more info on this here. Once that is done, run pyenv install --list to show the versions available. After verifying the same, just run pyenv install 3.11.2. That should give you a message as preceding.

:: [Info] ::  Mirror: https://www.python.org/ftp/python
:: [Downloading] ::  3.11.2 ...
:: [Downloading] ::  From https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe
:: [Downloading] ::  To   C:\Users\username\.pyenv\pyenv-win\install_cache\python-3.11.2-amd64.exe
:: [Installing] ::  3.11.2 ...
:: [Info] :: completed! 3.11.2
Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140