Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm - Cannot find declaration to go to

Tags:

I changed my project code from python 2.7 to 3.x.

After these changes i get a message "cannot find declaration to go to" when hover over any method and press ctrl

I'm tryinig update pycharm from 2017.3 to 18.1, remove directory .idea but my issue still exist.

Do you have any idea how can i fix it?

like image 652
qchar90 Avatar asked Apr 10 '18 09:04

qchar90


People also ask

How do you fix Cannot find Declaration to go to in PyCharm?

The solution for me: remember to add an interpreter to the project, it usually says in the bottom right corner if one is set up or not. Just an alternate solution than the others. This happened after reinstalling PyCharm and not fully setting up the ide.

How can I fix Cannot find Declaration to go to in WebStorm?

go to WebStorm Default IDE directories (C:\Users\JohnS\AppData\Roaming\JetBrains) delete all files in this folder. reopen WebStorm.

How to mark a directory as a source in PyCharm?

For what its worth, in Pycharm it is: Right click on the root folder->Mark Directory as-> Sources Root Show activity on this post. Same Problem for Python Project!!! I tried to make a clean new intellij project and updated everything.

How to fix cannot find declaration to go to (solved)?

Cannot find declaration to go to (solved) Answered. Fatalfeel. Created September 09, 2019 12:56. File -> settings -> Project Interpreter -> show all > + system interpreter. File -> settings -> Project structure -> cancel all checked and set only root as a source. File -> invalidate caches. must ok.

How does PyCharm navigate to a specific class or method?

If a certain class is subclassed, or a method is overridden in more than one class, PyCharm will suggest to select the desired target from the list: After that, PyCharm jumps to the selected target, and places the caret at the class (method) declaration. If there is only one superclass/subclass, or method, then such a navigation is done silently.

What are the most common PyCharm errors?

PyCharm error: 'No Module' when trying to import own module (python script) 44 Run OpenERP 7 unittests in PyCharm 28 Import NumPy on PyCharm 18 Pycharm - Cannot find declaration to go to


2 Answers

Right click on the folders where you believe relevant code is located ->Mark Directory as-> Sources Root

Note that the menu's wording "Sources Root" is misleading: the indexing process is not recursive. You need to mark all the relevant folders.

like image 50
mithunpaul Avatar answered Sep 19 '22 17:09

mithunpaul


What worked for me was right-click on the folder that has the manage.py > Mark Directory as > Source Root.

like image 33
herickmota Avatar answered Sep 19 '22 17:09

herickmota