Python.Included icon indicating copy to clipboard operation
Python.Included copied to clipboard

Module name is not always the moduledir.

Open ijsankar opened this issue 3 years ago • 7 comments

Eg "allennlp-models" directory name is allennlp_models

ijsankar avatar May 14 '21 12:05 ijsankar

Please describe the problem in detail. Also, are you proposing a solution?

henon avatar May 14 '21 12:05 henon

If I have a module named scikit-learn installed. when I call IsModuleInstalled() it should return true. The function assumes that the module is in a folder named scikit-learn in site-packages folder. But the actual folder name is scikit_learn. Thus the function always returns false.

ijsankar avatar May 14 '21 12:05 ijsankar

I see. But how do we solve that problem?

henon avatar May 14 '21 16:05 henon

@henon The only way to resolve this is by looking into the site-packages folder and do a lookup to determine if scikit-learn or scikit_learn is present. Same issue happens with py-linq (https://pypi.org/project/py-linq/).

Alternatively the scikit_learn module name could be used but from my testing, in both cases (scikit-learn and scikit_learn), the corresponding folder is not present in the site-packages folder.

JimiC avatar Jun 23 '22 09:06 JimiC

So all we gotta do is check for either snake_case or kebab-case?

henon avatar Jun 23 '22 09:06 henon

So all we gotta do is check for either snake_case or kebab-case?

That seems to be the case with python library naming.

Maybe using a Regex would be more useful.

JimiC avatar Jun 23 '22 09:06 JimiC

Looking at it again I think that's something that pythonnet should resolve, right?

JimiC avatar Jun 23 '22 10:06 JimiC