简体   繁体   中英

Why conda cannot create environment with python=3.4 installed in it

I have miniconda 3 installation and want to create conda environment with Python 3.4. I used the command: conda create -n myenv python=3.4 and get the error:

PackagesNotFoundError: The following packages are not available from current channels:
  - python=3.4

I tried to change the version to 3.7, typing conda create -n myenv python=3.7 There was no error with version 3.7. So the problem seems to be related with the older versions of python.

This is the full output with the error message:

Collecting package metadata (current_repodata.json): done
Solving environment: failed
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - python=3.4

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

The reason you are not able to install python 3.4 package is that it is not available in the default channel of anaconda from where you are trying to install.

However, I just checked that it is available in the conda-forge channel. So, it can be installed as below:

conda create -n myenv python=3.4 -c conda-forge

It seems to me that Python 3.4 is not available in any of your listed repositories. I've tried to create an environment with it in Anaconda and it worked. Try to update Miniconda first:

conda update -n base -c defaults conda

If it does not work, look for a repository containing Python 3.4 and add it to your list of repositories.

what you can try is update and search python interpreter versions:

Step1:

conda update conda

Step2:

conda search "^python$"

It will list all the available versions:

python                     3.4.0                         0  defaults
python                     3.4.1                         0  defaults
python                     3.4.1                         1  defaults
python                     3.4.1                         2  defaults
python                     3.4.1                         3  defaults
python                     3.4.1                         4  defaults
python                     3.4.2                         0  defaults
python                     3.4.3                         0  defaults
python                     3.4.3                         2  defaults
python                     3.4.4                         0  defaults
python                     3.4.4                         5  defaults
python                     3.4.5                         0  defaults

Then install based on the existing versions.

However, I just check that it is available in the conda-forge channel. So, it can be installed as below:

conda create -n myenv python=3.4 -c conda-forge

You can try this if its helpful..

  1. open Anaconda Navigator
  2. Go to Environment tab
  3. Click on "+Create"
  4. Choose your preference python package, give it name and save it.
  5. Open Anaconda prompt and type (base) C:\\User\\XXXX > conda info --envs
  6. You will your environment name therein
  7. To activate that environment type (base) C:\\User\\XXXX > conda activate "your env. name"
  8. You will find your environment been activated. And now line will show like ("your env. name")C:\\User\\XXXX >
  9. Enjoy !

Wanted to add that if you've already created your conda virtual environment, you can always install Python after the fact using a simple conda install python command. So no need to delete the conda env and re-create it with the python explicitly specified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM