Nate Schultz
Nate Schultz

Reputation: 191

PyCharm PEP8 Code Style highlights not working

I've been having this PEP8 style highlighting issue. The issue is it's not highlighting obvious style issues, like no blank lines before class definitions, or no empty lines at the end of the file. It could have to do with my VM and vagrant, but the project code is hosted locally so I don't think that should be an issue.

If I do Code > Run Inspection By Name > PEP 8 coding style violation it says it finds no instances.

Under File > Settings > Editor > Code Style > Python > Blank Lines I have blank lines set around the class. An oddity is that if I change the number of lines "around method", it changes them in real time in the example text on the right, but it doesn't do the same for lines "around class".

Under File > Settings > Editor > Inspections > Python I have "PEP 8 coding style violation" selected. I've tried changing it from warning to error and I still can't see the highlights in my file.

I don't have power saver mode on, which I've learned is a way to deactivate the background style checking in the editor.

I searched in Help > Show Log in Files for PEP8 and found "Pep8ExternalAnnotator - Found no suitable interpreter", but I don't know what that means and I couldn't find any references to it online.

I'm running PyCharms professional 2016.3

PyCharm 2016.3.2
Build #PY-163.10154.50, built on December 28, 2016
Licensed to arbaerbearfaerfa
Subscription is active until October 17, 2017
For educational use only.
JRE: 1.8.0_112-release-408-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Upvotes: 14

Views: 8543

Answers (6)

Philipp
Philipp

Reputation: 1391

Creating a new virtual environment helped my case:

Settings > Project: XXX > Python Interpreter > Add Interpreter

Upvotes: 0

Genarito
Genarito

Reputation: 3453

I have to remove the venv folder and add the Python Interpreter again.

Also, I had a problem setting the venv folder inside a folder called src. When venv was on the project's root folder everything worked fine, if I put it in the src the PEP8 inspections didn't work. After moving it around and setting the Python Interpreter several times it fixed itself...

Upvotes: 0

Thomas Turner
Thomas Turner

Reputation: 3052

I had the same issus. In my case I was missing the system interpreter which made all the pep8 not work. Once added it fixed the issue.

enter image description here

Upvotes: 1

Fernando Aguilar
Fernando Aguilar

Reputation: 1

I had the same issue (on mac, python3.8, pycharm v2020.3). I was able to fix it by comparing the .idea/inspectionProfiles/Project_Default.xml from a new project with my project that wasnt showing pep8 inspection warnings. The new project had the following line

    <inspection_tool class="PyClassicStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true" />

I added this line to my project that wasnt working with pep8 and then it started working immediately. Note: the preferences for the project showed pep8 inspections were enabled, but it just wasnt working.

Upvotes: 0

Qaswed
Qaswed

Reputation: 3889

After I installed Anaconda on Windows 10 (https://docs.anaconda.com/anaconda/install/windows/), keeping the box "Register Anaconda as my default Python 3.7" checked, it finnaly worked. I now have two project interpreters and PEP 8 Code Style violations are highlighted.

Upvotes: 0

Steve Piercy
Steve Piercy

Reputation: 15065

Here are three more things to check:

  • Click the Inspector icon and make sure that you have the highlighting level set to Inspections.
  • There's a second PEP8 inspection, "PEP 8 naming convention violation".
  • Ensure that the scope of inspections is set for the entire project.

Upvotes: 4

Related Questions