PyCharm is failing to resolve imports from numpy. If I write:
import numpy as np
import numpy.core.umath as np2
PyCharm resolves np2.exp() correctly but fails to find np.exp() with a "Cannot find reference 'exp' in __init__.py".
After working out that the __init__.py in question is the numpy one (it makes sense but there are a lot of __init__.py s floating around) I think I have narrowed the problem down to how the numpy skeleton is created. The original numpy __init__.py is quite elaborate and imports several submodules into the main namespace. In particular there is the line:
which is I think responsible for np.exp() running. However despite the numpy __init__.py being 216 lines long, the stub in the skeleton is empty. Is there a way around this? I use numpy in practically all my code and it is for sprawling libraries like this that code completion and resolving on the fly are most useful so I would really like to know how to fix this.
I'm using PyCharm 4.0.4 Professional with numpy 1.9.1 in an Anaconda virtual environment. The interpreter seems to work correctly, PyCharm finds the correct packages in the correct locations and the normal np.exp works from the console.
EDIT: So I've looked a bit further into skeletons and am more confused but possibly closer to knowing how to fix the problem. The GitHub repository for python skeletons has a non-empty skeleton for numpy's __init__.py which dates to July last year but references version 1.8. It seems that I should clone the github repository and edit the skeleton and can probably manage to do that if there is only one numpy __init__.py but if that were the case, how have I got an empty one? Is something picking out versions? I have now checked that the github skeletons-helpers version of the numpy __init__.py is in my folder but am not sure how to make it, and therefore any update I might make, available to my project which is referring to an empty file numpy/__init__.py stub.
EDIT EDIT: This appears to be the same issue as bugs PY 13124 and PY 14971. The former of which has been open since May last year.
EDIT EDIT EDIT: And also PY 11316 from November 2013