zeroc-ice import problems

Please post any questions about developing your plugin here. Please use the search function before posting!
enthrow
Junior Member
Posts: 4
Joined: Sat Feb 15, 2020 7:00 am

zeroc-ice import problems

Postby enthrow » Tue Feb 18, 2020 3:54 am

For right now I'm just trying to use the zeroc-ice package to manage some things in a mumble server. Scripts work fine when everything is run outside the plugin however I can't Ice to import from the plugin. I installed the package to source-python/packages/site-packages/ with the --target option in pip.
Import Ice in my plugin returns:

Code: Select all

SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
    plugin = self.manager.load(plugin_name)
  File "../addons/source-python/packages/source-python/plugins/manager.py", line 194, in load
    plugin._load()
  File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
    self.module = import_module(self.import_name)
  File "../addons/source-python/plugins/murmurtest/murmurtest.py", line 3, in <module>
    import Ice
  File "../addons/source-python/packages/site-packages/Ice/__init__.py", line 42, in <module>
    import IcePy


Most other packages I've tried have imported properly. I don't see an IcePy py file, folder or any mention besides an import anywhere else in these files or anything anywhere in the package, however I do see 'IcePy.cpython-35m-x86_64-linux-gnu. so which seems like something I should look at. I don't know what I'm missing or where to look so even a point in the right direction would be really appreciated.
User avatar
L'In20Cible
Project Leader
Posts: 1249
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: zeroc-ice import problems

Postby L'In20Cible » Tue Feb 18, 2020 4:44 am

enthrow wrote:however I do see 'IcePy.cpython-35m-x86_64-linux-gnu.

That file is for Python 3.5, and Source.Python is running Python 3.6.1.
enthrow
Junior Member
Posts: 4
Joined: Sat Feb 15, 2020 7:00 am

Re: zeroc-ice import problems

Postby enthrow » Tue Feb 18, 2020 5:13 am

L'In20Cible wrote:
enthrow wrote:however I do see 'IcePy.cpython-35m-x86_64-linux-gnu.

That file is for Python 3.5, and Source.Python is running Python 3.6.1.


I can't believe I missed that. PyPi shows the version as compatible with 2.6 through 3.7. Is it possible that thats inaccurate or is this something that might be being installed improperly with pip? I think that may have put me on the right track though thank you very much.
User avatar
L'In20Cible
Project Leader
Posts: 1249
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: zeroc-ice import problems

Postby L'In20Cible » Wed Feb 19, 2020 5:33 am

enthrow wrote:I can't believe I missed that. PyPi shows the version as compatible with 2.6 through 3.7. Is it possible that thats inaccurate or is this something that might be being installed improperly with pip? I think that may have put me on the right track though thank you very much.

That file is a cache file for Python 3.5 (as per the 35m in its name) and won't be loaded because 36m will be looked for. Since there is no cache for that version, it attempts to load it from the source/binary and is unable to find it resulting into an import error. I've never worked with that specific library, but my guess is that you only copied the cache over from a 3.5 installation, and not the module itself.
enthrow
Junior Member
Posts: 4
Joined: Sat Feb 15, 2020 7:00 am

Re: zeroc-ice import problems

Postby enthrow » Wed Feb 19, 2020 6:37 pm

L'In20Cible wrote:
enthrow wrote:I can't believe I missed that. PyPi shows the version as compatible with 2.6 through 3.7. Is it possible that thats inaccurate or is this something that might be being installed improperly with pip? I think that may have put me on the right track though thank you very much.

That file is a cache file for Python 3.5 (as per the 35m in its name) and won't be loaded because 36m will be looked for. Since there is no cache for that version, it attempts to load it from the source/binary and is unable to find it resulting into an import error. I've never worked with that specific library, but my guess is that you only copied the cache over from a 3.5 installation, and not the module itself.


You were right however I'm still getting the same message. I reinstalled source.python, then installed the package from python 3.6.1 using

Code: Select all

python3 -m pip install --no-cache-dir --target tf/addons/source-python/packages/site-packages/ zeroc-ice


The .so file is now IcePy.cpython-36m-x86_64-linux-gnu.so but the error message is the same. Output of print(sys.version) is 3.6.1. All of this was done using a python 3.6.1 installation elsewhere on the machine if that matters. Is there a way to run pip through source.python? Would that even help? If this is package specific I will go ask on the zeroc forums. I only asked here since I can only replicate this problem in this environment. Thanks

EDIT: I'm thinking that this could be because I built the package with a 64 bit version of python. I will try with 32 and update.
enthrow
Junior Member
Posts: 4
Joined: Sat Feb 15, 2020 7:00 am

Re: zeroc-ice import problems

Postby enthrow » Fri Feb 21, 2020 10:31 pm

This is an architecture problem. Since I had trouble getting a 32 bit python 3.6.1 install working on my box I've gone ahead and built the plugin quickly in a 32 bit vm and transferred it over just to see if the error message would change. It imports sort of but obviously since I built it on a different machine i'm getting other dependency errors left and right. It seems like the solution is going to be buckle down and make 32 bit python work on this box. I'm confident this will fix the problem.

I know there was pip functionality planned at some point and I hope thats still in the works. Whether it comes or not I understand since I know the devs have done all of this work for free up til now and I do sincerely appreciate that. If I find an elegant way of building these 32-bit packages on 64-bit systems I will surely share. Thanks again for the help!

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 7 guests