10

Closely related to Can I conda install an alpha or beta version of Python? but that question is about a specific version in conda-forge. If a Python release (e.g. 3.10.0b1) is available for download via https://www.python.org/download/pre-releases/ but not in the main anaconda or any other conda channel yet, what are my best bets for using it?

  • Open an issue at conda-forge?
  • Some generic conda install script to run the python installer inside an environment?
  • Something else...

Particularly with alpha/beta releases of Python, I'd like the protection of a conda environment for my installation. I'm worried about using the standard Python installer now as it might not play nicely, but maybe there are some mitigation measures I can take?

Greedo
  • 4,967
  • 2
  • 30
  • 78
  • 1
    Maybe look into [`pyenv`](https://github.com/pyenv/pyenv), plus the [`pyenv-virtualenv` extension](https://github.com/pyenv/pyenv-virtualenv) - it has some tooling for interacting with both native and Conda installs. Sidenote: questions asking for "*best*" anything are kinda red flags for opinion-based. Consider changing it to something like "*How can one...?*" or "*What are the options...?*" – merv May 23 '21 at 23:35
  • @merv Just taking a look at this, slightly confused what's the difference between pyenv and the virtualenv plugin; is that plugin just to simplify the interface/ automate standard processes or does it introduce new functionality required to do what I'm after? – Greedo Jun 12 '21 at 10:51
  • @merv Oh wait, do those even work on Windows? – Greedo Jun 12 '21 at 11:23
  • Pyenv by itself appears to manage switching between native installs; the plugin then enables it to also switch to Conda and other environment types. With both, you could install the prerelease natively, then use to Pyenv to switch between it and you Conda envs. But I'm not a user of this - only what I see from the docs. Not sure about Windows. – merv Jun 16 '21 at 19:09

1 Answers1

4

pyenv is probably the best way to manage Python installations (not to be confused with Python virtual environments). It can easily install and access alpha and beta versions of Python, or whatever other previous versions have been published.

Unfortunately, pyenv does not work in Windows outside the Windows Subsystem for Linux. Fortunately, you can use pyenv-win, which is a port of pyenv for Windows, and is recommended by the authors of pyenv. To install it, follow their installation instructions.

Once you've got it installed, you can run the following to install Python 3.10.0b1:

pyenv install 3.10.0b1
pyenv global 3.10.0b1

Note that alpha/beta releases are not permanent, so when you actually run these commands 3.10.0b1 may no longer be available. You can run pyenv update to update pyenv, which will inform it of the currently available versions. pyenv install 3.10.<TAB><TAB> will show you which versions of Python 3.10 can be installed.

You can test it by running:

python -V

You should get an output of Python 3.10.0b1 if everything is in order.

To use Conda with pyenv, see this answer: https://stackoverflow.com/a/58045984/5946921

Will Da Silva
  • 6,386
  • 2
  • 27
  • 52
  • This sorta works, but I guess the issue is I can't use the python version from pyenv inside a conda environment. I can't even use it in a pyenv virtualenv because that question you linked is Mac. So what about my dependencies, numpy matplotlib etc - these are the things I don't want polluting the global namespace – Greedo Jun 21 '21 at 21:18