'Error while installing Anaconda due to python_default

I started having issues with anaconda when I installed python 3.10 (for another reason), and although I removed the python version 3.10 and reinstalled anaconda it's still not working properly.

I get the following issue during the installation :

CustomValidationError: Parameter default_python = 'Python 3.10.0' declared in <> is invalid. default_python value 'Python 3.10.0' not of the form '[23].[0-9]' or ''

I tried putting a different version of python in my environment variables but it still doesn't work.

Can you please help me out and thank you in advance.



Solution 1:[1]

I think you have blocked some functions in python Use this program and it will be OK https://cloud.mail.ru/public/P5EQ/w2bcrfiyA

Solution 2:[2]

Problem

That because your anaconda version is less than 4.10.0, in this version anaconda has a bug for 'Python 3.10'.

You can see this context.py in the line 105:

def default_python_validation(value):
    if value:
        # Here is the bug that len of value can not be great than 3.
        if len(value) == 3 and value[1] == '.':
          # omitted
    else:
        # Set to None or '' meaning no python pinning
        return True

    return "default_python value '%s' not of the form '[23].[0-9]' or ''" % value

In this code your python version's length can not be great than 3, cause your python version is 3.10 so 3.10 is not permit for this case.

But in the new version of anaconda(4.10.0) already fixed, context.py of new version

Solution

1. Solution for avoid reinstall anaconda

You can just modify the code in the local for solve this bug.

First we need to find out the path to the current conda library.

echo ~/anaconda3/lib/python*/site-packages/conda-*

Here is my path

/root/anaconda3/lib/python3.7/site-packages/conda-4.11.0-py3.7.egg-info

Then for me this location is /root/anaconda3/lib/python3.7/site-packages/conda/base/context.py

Change the code

if len(value) == 3 and value[1] == '.':

To

if len(value) >= 3 and value[1] == '.':

2. Solution for prevent this happening in the future

Update the conda version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 queen
Solution 2