Unresolved reference with 2018.1 version

Answered

Hello, since I installed the 2018.1 version of pycharm, all my Django projects have problems of imports. The projects still work, but in the IDE I have the error "Unresolved reference xx". I tried a little everything I found on the internet but without success. Can you help me please ?

7 comments

Hm, that's interesting, thank you! Why do you mark the project root as a source root? PyCharm adds it to the PYTHONPATH by default so I believe there's no need for such customization.

Could you please Ctrl+click on creapole in from creapole import creapole_vars? What file get opened? Could you please also take a screenshot of Settings | Project ... | Project Structure?

I created a ticket for this problem: PY-29330. Please attach idea.log from Help | Show Log in ... there.

1

Ok, I put the root project in source root because I tried many solutions to solve my problem and I did not cancel my changes.

 

Could you please Ctrl+click on creapole in from creapole import creapole_vars? What file get opened?

When I do the ctrl + click it opens the file creapole / creapole / __ init__.py
 
The project structure (deleted the line for the root source):
 
 
1

I'm seeing a similar issue (though with non-Django projects).

Before the upgrade everything worked fine in 2017. Now, imports resolve, but references to items in imported modules do not.

I am using a Virtualenv, which is configured in the Project Structure settings. I have also marked my "Sources Root" correctly. 

Note that I have tried recreating the Virtualenv in IDEA as well as Invalidating Caches / removing .idea directory and reconfiguring project.

1

Hi Mmick! Could you please provide an example of such false positive error?

0
 
Hi, thank you for your answer. 
Some import works others not, here are some screenshots:
 


0

Same happens to me in Intellij IDEA 2018.1

Only full-path import works, __init__.py is not taken into account, similarly if module `a` imports something from module `b` as `C`, `from a import C` shows false-positive IDE error.

I also noticed it may work for some time after restart and some indexing but after a while it's broken again. I've multiple modules in my project that share same SDK. Also It's very strange that error shows cannot find <something> in <module> | <module> | <module> where module is always same.

0

For unresolved references in Python plugin please follow PY-29338. We are investigating the problem, I am sorry for the inconvenience!

0

Please sign in to leave a comment.