Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

No module named google.protobuf.descriptor #1573

Open
radek673 opened this issue Feb 1, 2017 · 19 comments
Open

No module named google.protobuf.descriptor #1573

radek673 opened this issue Feb 1, 2017 · 19 comments

Comments

@radek673
Copy link

radek673 commented Feb 1, 2017

  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
Copy link
Author

radek673 commented Feb 2, 2017

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

@simplicbe
Copy link
Contributor

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

@radek673
Copy link
Author

radek673 commented Feb 2, 2017

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
Copy link
Author

radek673 commented Feb 2, 2017

but it works with python.exe

@simplicbe
Copy link
Contributor

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

@radek673
Copy link
Author

radek673 commented Feb 2, 2017

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
Copy link
Author

radek673 commented Feb 2, 2017

untitled

here my directory structure...

@radek673
Copy link
Author

radek673 commented Feb 2, 2017

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

untitled

@slide
Copy link
Contributor

slide commented Feb 2, 2017

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

@radek673
Copy link
Author

radek673 commented Feb 2, 2017

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

@slozier
Copy link
Contributor

slozier commented Feb 2, 2017

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

@radek673
Copy link
Author

radek673 commented Feb 3, 2017

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

@slozier
Copy link
Contributor

slozier commented Feb 4, 2017

@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...

@radek673
Copy link
Author

radek673 commented Feb 4, 2017

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

@pekkaklarck
Copy link

@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.

@radek673
Copy link
Author

radek673 commented Feb 6, 2017

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... :(

@slozier
Copy link
Contributor

slozier commented Feb 6, 2017

@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).

@slide
Copy link
Contributor

slide commented Feb 6, 2017

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

@radek673
Copy link
Author

radek673 commented Feb 8, 2017

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...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants