sethmlarson/virtualbox-python

Exception: Cannot find VBoxPython module (tried: VBoxPython2_7, VBoxPython2, VBoxPython)

lzwgiter opened this issue · 1 comments

ENVIRONMENT

  • Operating System: Ubuntu 19.10
  • Python version: 2.7
  • VirtualBox version: 6.0.14
  • VirtualBox SDK version: 6.0.16
  • Location where VirtualBox SDK is installed: ~/Desktop
  • virtualbox-python / pyvbox version: 2.0.0
  • [√] Happens in latest master branch?
SUMMARY

I installed pyvbox and virtualbox using pip install, also I install the SDK 6.0.16 using command python vboxapisetup.py install .
when I am trying to use it with python2.7, I got these errors:

>>> import virtualbox
>>> vbox = virtualbox.VirtualBox()
m=VBoxPython2_7 x=No module named VBoxPython2_7
m=VBoxPython2 x=No module named VBoxPython2
m=VBoxPython x=/usr/lib/virtualbox/VBoxPython.so: undefined symbol: _Py_FalseStruct
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/float/.local/lib/python2.7/site-packages/virtualbox/library_ext/vbox.py", line 22, in __init__
    manager = virtualbox.Manager()
  File "/home/float/.local/lib/python2.7/site-packages/virtualbox/__init__.py", line 145, in __init__
    self.manager = vboxapi.VirtualBoxManager(mtype, mparams)
  File "vboxapi/__init__.py", line 989, in __init__
    self.platform = PlatformXPCOM(dPlatformParams)
  File "vboxapi/__init__.py", line 750, in __init__
    import xpcom.vboxxpcom
  File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py", line 78, in <module>
    raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),))
Exception: Cannot find VBoxPython module (tried: VBoxPython2_7, VBoxPython2, VBoxPython)

It seems some thing wrong with the file /usr/lib/virtualbox/VBoxPython.so, and I try to renamed it as VBoxPython2_7.so but it doesn't work.

plus, when I do the same thing above with python 3.8, it comes with no problem.

It sounds like your VBoxPython isn't built for Python 2.7, you probably installed it with Python 3.8?
You can only use the VBoxPython.so with the Python version which it was built for.