main icon indicating copy to clipboard operation
main copied to clipboard

No module named google.protobuf.descriptor

Open radek673 opened this issue 8 years ago • 19 comments

  1. python 2.7.13 installed and pip install gmusicapi (all dependencies installed)
  2. IronPython 2.7.7 via nuget in visual studio 2015

I can use gmusicapi classes without problems when running python.exe and all is working properly.

When trying with IronPython from c#:

       var pyEngine = Python.CreateEngine();

        var paths = pyEngine.GetSearchPaths();
        paths.Add(@"c:\python27\lib");
        paths.Add(@"c:\python27\lib\site-packages");
        pyEngine.SetSearchPaths(paths);

        ScriptScope pyScope = pyEngine.CreateScope();

    pyEngine.Execute("import sys", pyScope);
        pyEngine.Execute("sys.platform = \"win32\"", pyScope);

        **// ERROR: No module named google.protobuf.descriptor
        pyEngine.Execute("from gmusicapi import Mobileclient", pyScope);**

Any help would be greatly appreciated !

radek673 avatar Feb 01 '17 05:02 radek673

Noone ? I'm willing to pay for resolving this issue, please contact me ! :) I believe gmusicapi could work with IronPython...

radek673 avatar Feb 02 '17 07:02 radek673

Are you able to use google-protobuf in a kind of sample script? For example using the interpreter?

simplicbe avatar Feb 02 '17 07:02 simplicbe

just tried: pyEngine.Execute("from google.protobuf.message import DecodeError", pyScope); pyEngine.Execute("from google.protobuf.descriptor import FieldDescriptor", pyScope);

neither of these works, same exception...

radek673 avatar Feb 02 '17 08:02 radek673

but it works with python.exe

radek673 avatar Feb 02 '17 08:02 radek673

Ok, but the the package is in c:\python27\lib\site-packages?

simplicbe avatar Feb 02 '17 08:02 simplicbe

yes everything is properly installed. as i said, its working with python.exe and it is not with IronPython. so i guess the problem must be somewhere with IronPython...

radek673 avatar Feb 02 '17 08:02 radek673

untitled

here my directory structure...

radek673 avatar Feb 02 '17 08:02 radek673

my apologize, wrong image, here is correct one :)

untitled

radek673 avatar Feb 02 '17 08:02 radek673

Does that directory only contain .pyc files for the module? IronPython doesn't support .pyc files (precompiled python bytecode).

slide avatar Feb 02 '17 14:02 slide

it contains .py for every .pyc....

radek673 avatar Feb 02 '17 15:02 radek673

Doesn't look like it'll work without some work:

>>> from gmusicapi import Mobileclient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\gmusicapi\__init__.py", line 4, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\gmusicapi\clients\__init__.py", line 4, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\gmusicapi\clients\webclient.py", line 16, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\gmusicapi\clients\shared.py", line 7, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\gmusicapi\utils\utils.py", line 24, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\google\protobuf\__init__.py", line 37, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\pkg_resources\__init__.py", line 74, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 9, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\pkg_resources\extern\__init__.py", line 43, in load_module
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 4715, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1261, in setParseAction
  File "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1043, in _trim_arity
IndexError: index out of range: -1

This failure appears to have to do with the frame stack:

import sys

def test():
    i = 0
    try:
        raise Exception()
    except:
        f = sys.exc_info()[2].tb_frame
        while f is not None:
            i += 1
            f = f.f_back
    return i

assert test() == 2

slozier avatar Feb 02 '17 21:02 slozier

thanks slozier for the investigation... but what does it mean ? i'm quite new to IronPython, what can i do with it ?

radek673 avatar Feb 03 '17 08:02 radek673

@radek673 It involves parts of the system which I'm not too familiar (frames). Other than trying to fix the C# code for frames I'm not sure if there's a workaround...

slozier avatar Feb 04 '17 14:02 slozier

ok, are there any chances it will be fixed (soon) ? :)

radek673 avatar Feb 04 '17 15:02 radek673

@slozier I doubt that IndexError inside pyparsing is the real root cause for this issue. It seems to be a rather sever problem, though, because it prevents me from using pip as I reported in #1572.

pekkaklarck avatar Feb 06 '17 09:02 pekkaklarck

please fix it, this is basic functionality, blocker that makes IronPython USELESS.... you cannot even use simple 3rd party library with IronPython.... only statements "a := b" are compatible... pitty... :(

radek673 avatar Feb 06 '17 10:02 radek673

@pekkaklarck I am aware there are a number of issues with pip. However, I did not mean to imply that the pyparsing failure had anything to do with pip. I was just pointing out that even we got past the installation issue that would not be the end of it (getting gmusicapi to work).

slozier avatar Feb 06 '17 12:02 slozier

@radek673 you're welcome to debug and submit a fix yourself.

slide avatar Feb 06 '17 14:02 slide

creating an empty init.py in \Lib\site-packages\google solved the problem, sadly, there are more issues :/

I think the condition could be fooled in IronPython sources if the file is missing...

radek673 avatar Feb 08 '17 13:02 radek673