Unresolved remote references

Many import references are not being resolved by PyCharm. This started when I marked a dictionary as sources root. But that shouldn't explain why some external dependencies are unresolved.

I have tried setting up the venv again, invalidated caches, re-installed PyCharm, but no luck. The code runs just fine. I would be very glad if someone could point me to a solution,

 

0
13 comments
Avatar
Permanently deleted user

I have a similar issue - sorry not the answer. Trying to import a module from another directory, says 'Unresolved reference pages' . Line 19.

From what I can see from the tree on the left there should be no issue. I have donw similar in other projects with Pycharm, and no problems.

 

This project is following a Django tutorial, so am now thinking, given the original post, is this a Django in Pycharm problem? Unless mine is a different issue, in which case, any pointers?

 

0

@Gauti

You mentioned that it started happening after you marked the directory as Sources Root. Does it help if you unmark it?

Is it reproducible in a brand new project?

0

@Ronmcmillan1971

You should mark the folder containing the needed module/package as Sources Root (right-click the folder and choose Mark Directory as | Sources Root). The reasoning behind is that PyCharm can't be 100% sure that the current directory will end up in sys.path and hence it doesn't resolve the import from the same directory. By marking it as Sources Root, you explicitly let PyCharm know that the directory will be in sys.path.

0
Avatar
Permanently deleted user

Hi. Have marked directory pages as Sources Root. No change.

0

You need to mark the folder containing pages I believe.

0
Avatar
Permanently deleted user

Oh. Will try that later.Thanks

0
Avatar
Permanently deleted user

Nope. Still not resolving. I will go back and see what I have missed/altered. Strange I don't have this on other projects.Hmmm.

0
Avatar
Permanently deleted user

@Sergey Karpov

Unmarking it does not help, and the same problem occurs in all my other projects. My other projects were started in PyCharm and originally did not have these errors. I have not needed to mark any directory as Sources Root in the other projects. The other projects also run fine and are not using the same virtual environment.

 

0

Ronmcmillan1971

Could you share another screenshot showing it?
I'd like to check that it's correct

0

Gauti

Any chance you could recreate the issue in a test project and share it with me?

You could upload it to our FTP server zipped https://uploads.services.jetbrains.com/, but please let me know its name so I can find it.

0
Avatar
Permanently deleted user

Hi Sergey, it has resolved. By doing what you said. However, it did not resolve immediately ( within a short amount of time), - is there a delay on updating itself within PyCharm? Thank you anyway, I learned something new.

0

Ronmcmillan1971

Yes, it may take some time to update it in the code, especially in big projects.

You can trigger it manually by typing some code, therefore, forcing PyCharm to run code analysis.

0
Avatar
Permanently deleted user

Ok, thanks. Good to know. Thanks for your help.

0

Please sign in to leave a comment.