93

I'm trying to install python 3.9 in a conda enviroment. I tried creating a new conda env using the following command,

conda create --name myenv python=3.9

But I got an error saying package not found because python 3.9 is not yet released

So, I manually created a folder in envs folder and tried to list all envs. But I couldn't get the manually created new environment.

So, how do I install python 3.9 in a conda env with all functionalities like pip working?

bigbounty
  • 16,526
  • 5
  • 37
  • 65

3 Answers3

108

To create python 3.11 conda environment use the following command

conda create -n py311 python=3.11
py311 - environment name

Update 3

To create python 3.10 conda environment use the following command

conda create -n py310 python=3.10
py310 - environment name

Update 2

You can now directly create python 3.9 environment using the following command

conda create -n py39 python=3.9
py39 - environment name

Update 1

Python 3.9 is now available in conda-forge.

To download the tar file - https://anaconda.org/conda-forge/python/3.9.0/download/linux-64/python-3.9.0-h852b56e_0_cpython.tar.bz2

Anaconda Page - https://anaconda.org/conda-forge/python


As pointed out in the comments, python 3.9 is not yet there on any channels. So, it cannot be install yet via conda.

Instead, you can download the python 3.9 executable and install it.

Once the installation is done, a new executable will be created for python 3.9 and pip 3.9 will be created.

Python:

python3.7          
python3.7-config   
python3.7m         
python3.7m-config  
python3.9          
python3.9-config

pip

pip      
pip3     
pip3.7   
pip3.8   
pip3.9   
pipreqs

In order to install ipython for python 3.9,

pip3.9 install ipython
bigbounty
  • 16,526
  • 5
  • 37
  • 65
  • 2
    Is the information on installing Python 3.9 directly, pip, etc. really necessary? – AMC Sep 05 '20 at 00:45
  • 3
    Why? As far as I can tell, it's more or less the same procedure for installing any version of Python 3, right? – AMC Sep 07 '20 at 22:19
  • 1
    Most folks use `python3.x -m pip` to run the PIP that belongs to a specific release of Python. This is particularly important when using virtual environments like those created by conda. – S.Lott Sep 24 '20 at 00:13
  • `python -m pip` is the recommended way to call pip. Not `pip`. – Nzbuu Oct 06 '20 at 22:40
  • I did this and still when I type `python --version` I get `Python 3.7.9`. Do I need to set my environment to the newly created environment? – Addem Jan 17 '21 at 18:39
  • @Addem you need to activate your newly created environment - `conda activate py39` – bigbounty Jan 18 '21 at 01:25
  • what's meaning of that "-n" – Ernie Sender Feb 24 '21 at 17:10
  • `-n` - environment name – bigbounty Feb 24 '21 at 17:30
  • Does not Work --->`$ conda create -n demo-py39 python=3.9 \ Fetching package metadata ........... \ PackageNotFoundError: Package missing in current win-64 channels: - python 3.9* ` BUT this DOES WORK `conda create -c conda-forge python=3.9 -n py39-demo` – Timothy L.J. Stewart Apr 24 '21 at 15:26
  • 1
    @TimothyL.J.Stewart The command is working fine in my Mac. Probably it's the case only with windows I guess – bigbounty Apr 24 '21 at 15:40
  • @bigbounty the culprit was 4.3 `conda --version` the fix was `conda update conda` then this works – Timothy L.J. Stewart Apr 25 '21 at 17:57
  • I tried `conda create -n py39 python=3.9`. It did installed python 3.9, but without numpy, pandas etc. It does not make sense to install a conda environment without those packages :( – mugi Sep 16 '21 at 09:26
  • @mugi I share your concern. I created a new Python 3.10 environment on my Windows machine by opening Anaconda Prompt and executing `conda create --name python_3.10 python=3.10` I noticed that it only downloaded 17 new packages. After I switched my PyCharm projects to use that new python_3.10 environment, my code now breaks (e.g. `ModuleNotFoundError: No module named 'matplotlib'`). – HaroldFinch Nov 17 '21 at 03:53
  • 1
    I guessed that maybe Python 3.10 is too new, so I tried downgrading to 3.9 via `conda create --name python_3.9 python=3.9` This was even worse, it only downloaded 12 new packages, and my code is still broken when I try to use that environment. I am puzzled because [this Anaconda link says that they have 611 packages compatible with Python 3.9](https://docs.anaconda.com/anaconda/packages/py3.9_win-64/). What are we doing wrong? – HaroldFinch Nov 17 '21 at 03:53
23

On 6-Oct-2020, Python 3.9 was made available on conda-forge: https://anaconda.org/conda-forge/python. However, most of the other packages (including some of the essentials to create a basic environment) didn't explicitly support Python 3.9 yet.

However (as of 15-Oct-2020), the basic dependencies appear to have been fixed and the following command now works:

conda create -c conda-forge python=3.9 -n py39-demo
Nzbuu
  • 5,241
  • 1
  • 29
  • 51
19

You can now simply just run

conda create --name myenv python=3.9

And it will create your python 3.9 virtual environment simply.

Mohamed Sayed
  • 491
  • 7
  • 10