How do you set Python version in Sonarcloud UI?

With all of my analyses, I now get the warning message:
"Your code is analyzed as compatible with python 2 and 3 by default. This will prevent the detection of issues specific to python 2 or python 3. You can get a more precise analysis by setting a python version in your configuration via the parameter “sonar.python.version”

I reviewed this ticket but it isn’t clear to me how to set the Python version for the property sonar.python.version in the Sonarcloud UI.

Hi Vince,

Not all parameters are settable in the UI. In this case you will have to set the property sonar.python.version manually.

Since you are analyzing a Python project, I assume that you are using automatic analysis, in which case you need to add a file called to the root of your repo and set sonar.python.version in there. See

If you are using a CI-based analysis then you would do the same except in a file called or on the command line of the scanner.

Sorry for reviving the topic, but we’ve got a similar issue, and I’ve been struggling to find anything in the documentation on this subject.

@Peeter_Piegaze What kind of format should this setting be?

We’ve tried the following:

# in

# in

# in

None of these seems to work – we’re still getting the warning in SonarCloud console.

Hi Magda,

The format for the Python version should be a comma-delimited list of versions having the format “X.Y”


  • sonar.python.version=2.7
  • sonar.python.version=3.8
  • sonar.python.version=2.7, 3.7, 3.8, 3.9

As described here:

Which file you put this in depends on whether you are running automatic analysis or a CI-based analysis.

In the former case, you would put this property declaration in the file In the latter case, you would put it in

I hope this helps.