I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
Tested with PyCharm 4.0.6 (OSX 10.10.3) following this steps:
Problem solved!
There are many solutions to this, some more convenient than others, and they don't always work.
Here's all you can try, going from 'quick' to 'annoying':
File
->Invalidate Caches / Restart
and restart PyCharm.Run
->Edit Configurations
->Configuration
->Python Interpreter
.File
->Settings
Project: [name]
->Project Interpreter
-> 'Project Interpreter': Gear icon ->More...
File
->Settings
Project: [name]
->Project Interpreter
-> 'Project Interpreter': Gear icon ->More...
.idea
folder~/.PyCharm50
on Mac%homepath%/.PyCharm50
on WindowsI find myself removing and re-adding the remote interpreter to fix this problem when Invalidating Caches or Refreshing Paths does not work.
I use vagrant and every once and awhile if I add a new VM to my multi-vm setup, the forwarded port changes and this seems to confuse PyCharm when it tries to use the wrong port for SSH. Changing the port doesn't seem to help the broken references.
In my case the inspection error shows up due to a very specific case of python code. A min function that contains two numpy functions and two list accesses makes my code inspection give this kind of errors.
Removing the 'd=0' line in the following example gives an unresolved reference error as expected, but readding doesn't make the error go away for the code inspector. I can still execute the code without problems afterwards.
Clearing caches and reloading list of paths doesn't work. Only altering the code with one of the following example patches does work:
If you want to ignore only some "unresolved reference" errors, you can also tell it PyCharm explicitly by placing this in front of your class/method/function:
I closed all the other projects and run my required project in isolation in Pycharm. I created a separate virtualenv from pycharm and added all the required modules in it by using pip. I added this virtual environment in project's interpreter. This solved my problem.