Pycharm does not recognize Cython modules located in path

cython, pycharm, python

Solution

The problem was solved by adding `/usr/local/lib/python2.7/dist-packages/` to PYTHONPATH by:

File --> Settings --> Project --> Project Structure --> Add Content Root .

Problem

I have these two lines of code: ``` from libc.stdlib cimport malloc, calloc, realloc, free from optv.tracking_framebuf cimport TargetArray ``` The first one is not highlighted by PyCharm (2016.2.3 professional on Ubuntu 14.04) as unresolved refference but the second line is highlighted in red underline as unresolved refference. My `TargetArray` class is located in `tracking_framebuf.pxd` file which is located in `/usr/local/lib/python2.7/dist-packages/optv/` along with .c, .pyx, .so files with the same name. I inserted `/usr/local/lib/python2.7/dist-packages/optv/` and `/usr/local/lib/python2.7/dist-packages/` paths to be associated with python interpreter, but the error messages are still apearing in the editor. Despite the error messages the file (along with others) is cythonized successfully using this setup.py script: ``` # -*- coding: utf-8 -*- from distutils.core import setup from Cython.Distutils import build_ext from Cython.Distutils.extension import Extension import numpy as np import os inc_dirs = [np.get_include(), '.'] def mk_ext(name, files): return Extension(name, files, libraries=['optv'], include_dirs=inc_dirs, pyrex_include_dirs=['.']) ext_mods = [ mk_ext("optv.tracking_framebuf", ["optv/tracking_framebuf.pyx"]), mk_ext("optv.parameters", ["optv/parameters.pyx"]), mk_ext("optv.calibration", ["optv/calibration.pyx"]), mk_ext("optv.transforms", ["optv/transforms.pyx"]), mk_ext("optv.imgcoord", ["optv/imgcoord.pyx"]), mk_ext("optv.image_processing", ["optv/image_processing.pyx"]), mk_ext("optv.segmentation", ["optv/segmentation.pyx"]), mk_ext("optv.orientation", ["optv/orientation.pyx"]) ] setup( name="optv", cmdclass = {'build_ext': build_ext}, packages=['optv'], ext_modules = ext_mods, package_data = {'optv': ['*.pxd']} ) ``` Am I missing something on my way to get rid of these error messages and being able to view the contents of the .pxd files i place in the path?

Original source