Pycharm: "unresolved reference" error on the IDE when opening a working project

Viewed 73312

Intro

I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux)

The problem

On one of the computers we are getting "Unresolved reference" all over the code on almost every import with the exception of Python's built in libraries (i.e. import datetime is working). This computer is running the Mac version of Pycharm.

The question

Anyone knows how to solve this?, since most of the imports are not recognized code completion and navigation trough goto->declaration and so on is not working. Is there any known issue with the Mac version?

Thanks in advance!

8 Answers

My ten-penneth - If you're working with virtual environments (have a venv directory) make sure it is marked as excluded.

Plagiarised from above:

  • In the Project view, right-click on the venv directory
  • In the dialog menu select Mark Directory As > Excluded

The directory should turn orange...

This sometimes happens if you've done a git clean or for whatever reason had to rebuild your environment and PyCharm hasn't noticed

PyCharm > select "File" menu > select "Invalidate Caches / Restart" menu option

Related