How do I stop pycharm from complaining about F string in python 2.7, Im using python 3


How do I stop pycharm from complaining about F string in python 2.7, Im using python 3


What exact message do you see in the editor? The most likely cause is accidentally enabled "Code compatibility" inspection. If it's not true, another possibility is that version of the project interpreter hasn't been detected properly for some reason. In this case re-configuring it usually mends the problem.


The message is "Python version 2.7 does not support a 'F' prefix"

But with we should be able to use fstrings in 2.7.

Disabling code compatibility inspection doesn't help. I can't find the right inspection to disable. Any other tips?

PyCharm version 2018.2.


future-fstrings is a third-party preprocessor that is yet to be supported. There is a feature request about it in our tracker --


@mikhail Golubev My project interpreter is Python 3.6, and I have code compatibility settings set to 3.6, 3.7, 3.8:

But I can't seem to stop getting: 

How can I stop this madness?


Please try re-creating the project interpreter from scratch (removing it from the settings and setting up anew). Does it help?


I'm having this same problem. It's the MOST annoying thing and makes the inspector basically worthless as I'm no longer sure what's a real error and what's just a string since I cannot turn this inspection off (why not make this an editable inspection?). 

As suggested, I recreated the interpreter, and it seemed to be ok for a couple of days then it starts doing it again. So that's not a fix, it's a limited time work around that is saying there is definitely something broken here.

I'm not using a separate package, such as "future-fstring", just using python 3.6.8 interpreter in a docker instance.

Again, sometimes it works, then sometimes it doesn't. I can't tell you why it suddenly decides to think that I'm using py2.7. I don't have any py2.7 projects. They all got updated last year since it's EOL in less than a month. 

So how do I stop this from reoccurring?


same thing here; red underline on my code, red error on the f string - no external f-string checkers. makes code inspector useless (100s of errors due to that "feature bug")



I get the same thing, as do a number of my team mates.  I've recreated the python interpreter a number of times and sometimes it fixes it for a bit, but right now it's broken again having just re-set-up the python interpreter.

I've checked and the code compatibility stuff is turned off.  I'm using python 3.6 and PyCharm 2019.3 on Ubuntu 18.04 (and have seen this in older versions of PyCharm).


I logged about my particular issue.  I think I've now solved it after reading - see the 3rd post on my issue for details.


Please sign in to leave a comment.