sknetwork-team / scikit-network

Graph Algorithms
Other
601 stars 67 forks source link

Problem using scikit-network on windows in PyCharm #443

Closed moissinac closed 3 years ago

moissinac commented 3 years ago

Description

Do a simple test in debug mode under the PyCharm IDE

What I Did

Succesfully install scikit-network (checked in console) My test code in PyCharm:

import sknetwork as skn graph = skn.data.karate_club(metadata=True)

Error message C:\outils\Python\Python36\python.exe "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\pydevd.py" --cmd-line --multiproc --qt-support=auto --client 127.0.0.1 --port 55127 --file C:/wamp64/www/givingsense.eu/datamusee/python/datamusee/trials/trialScikitNetwork.py pydev debugger: process 1888 is connecting

Connected to pydev debugger (build 192.7142.79) Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\pydevd.py", line 2108, in main() File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\pydevd.py", line 2099, in main globals = debugger.run(setup['file'], None, None, is_module) File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\pydevd.py", line 1408, in run return self._exec(is_module, entry_point_fn, module_name, file, globals, locals) File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\pydevd.py", line 1415, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/wamp64/www/givingsense.eu/datamusee/python/datamusee/trials/trialScikitNetwork.py", line 1, in import sknetwork as skn File "C:\outils\Python\Python36\lib\site-packages\sknetwork__init.py", line 9, in import sknetwork.topology File "C:\outils\Python\Python36\lib\site-packages\sknetwork\topology\init.py", line 2, in from sknetwork.topology.kcliques import Cliques File "sknetwork\topology\kcliques.pyx", line 11, in init sknetwork.topology.kcliques File "sknetwork\topology\kcliques.pyx", line 11, in Pyx_PyMODINIT_FUNC PyInit_kcliques(void) TypeError: 'NoneType' object is not callable

Process finished with exit code 1

QLutz commented 3 years ago

Hello,

Thanks for your interest in our package.

Sadly, this issue does not stem from scikit-network but from Pycharm not having a debugger for Cython. It has been a long-time request from the users to have this particular feature and will likely not be implemented soon.

However, as long as you are not using Cython in your tests, you can still use the standard Python debugger. To do so, you can use configurations for testing pure-Python modules only for instance.

Also note that, when using scikit-network from sources, you should generate and compile the corresponding C++ code if you want to run the whole test suite.

moissinac commented 3 years ago

I can't easily know if a method of scikit-network uses Cython or not. So, you seem to say that I can't use scikit-network in Pycharm with a simple pip install. I've tried your link about 'configurations', but it seems to apply only for developers of scikit-network (and i get the same error with my source (2 lines, just loading a dataset) Is there a mean to view Cython modules as 'opaque' modules (like call to system functions are not accessible for debuging)

moissinac commented 3 years ago

An update to Pycharm solves the problem...