xxtbg / vboxweb

Automatically exported from code.google.com/p/vboxweb
MIT License
0 stars 0 forks source link

Linux 32bit unable to find VBoxPython Module #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
VirtualBox 3.0.8, Python 2.6.3, ArchLinux i686, Linux 2.6.30-ARCH #1 SMP
PREEMPT
VirtualBox installed with Python-support under /opt/VirtualBox.
All libs and binarys are 32bit.

When i run python VboxWebSrv.py i get:
Traceback (most recent call last):
  File "VBoxWebSrv.py", line 516, in <module>
    g_virtualBoxManager = vboxapi.VirtualBoxManager(None, None)
  File "/usr/lib/python2.6/site-packages/vboxapi/__init__.py", line 472, in
__init__
    exec "self.platform = Platform"+style+"(platparams)"
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/vboxapi/__init__.py", line 319, in
__init__
    import xpcom.vboxxpcom
  File "/opt/VirtualBox/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py", line
58, in <module>
    raise Exception, "Cannot find VBoxPython module (make sure you use
64-bit Python build with 64-bit VirtualBox, such as /usr/bin/amd64/python)"
Exception: Cannot find VBoxPython module (make sure you use 64-bit Python
build with 64-bit VirtualBox, such as /usr/bin/amd64/python)

Original issue reported on code.google.com by thereap...@googlemail.com on 9 Oct 2009 at 12:11

GoogleCodeExporter commented 9 years ago
Try adding /opt/VirtualBox to your python path (export 
PYTHON_PATH=/opt/VirtualBox)

Original comment by jshwright on 9 Oct 2009 at 1:41

GoogleCodeExporter commented 9 years ago
I had this problem. I resolved it by recompiling python with 
--enable-unicode=ucs4.

Original comment by pseli...@gmail.com on 14 Oct 2009 at 10:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have the same trouble.. I try this : export PYTHON_PATH=/opt/VirtualBox

and isntalling python with the --enable-unicode=ucs4

Didn't work.

Original comment by fnbis...@gmail.com on 7 Dec 2009 at 9:12

GoogleCodeExporter commented 9 years ago
I've resolved it by running this command:

PYTHONPATH=/opt/VirtualBox/sdk/bindings/xpcom/python python ./VBoxWebSrv.py

exactly PYTHONPATH and not PYTHON_PATH

Original comment by latyshev...@gmail.com on 9 Dec 2009 at 7:44

GoogleCodeExporter commented 9 years ago
doesn't work.

Original comment by xdaan....@gmail.com on 2 Jan 2010 at 7:44

GoogleCodeExporter commented 9 years ago
Same error, doesn't work for me also.

Original comment by fnbis...@gmail.com on 25 Jan 2010 at 9:24

GoogleCodeExporter commented 9 years ago
did not work for me oso

Original comment by fooderi...@gmail.com on 28 Jan 2010 at 12:39

GoogleCodeExporter commented 9 years ago
Linux mail.trezor.by 2.6.32-ARCH #1 SMP PREEMPT Fri Jan 29 08:50:05 UTC 2010 
i686 AMD 
Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux
virtualbox 3.1.2-2.

do not work for me also

Original comment by trez...@gmail.com on 4 Feb 2010 at 4:50

GoogleCodeExporter commented 9 years ago
Same problem

Original comment by nobodyd...@gmail.com on 19 Feb 2010 at 10:56

GoogleCodeExporter commented 9 years ago
Lets see if i can help...

My previous comment said that you have to have python with 
--enable-unicode-ucs4 in the 
build config. To verify if that is what you have you can run the following 
script that 
is attached. If the script outputs UCS2 then it will not work.

Original comment by pseli...@gmail.com on 20 Feb 2010 at 3:42

Attachments:

GoogleCodeExporter commented 9 years ago
I've run you script and effectively, the scripts outputs UCS2. I think that my 
issue is that I installed python with 
pacman. I'll try to install it manually with the enable unicode ucs4. 

I'll try this and I will post back. 

Thank you

Original comment by fnbis...@gmail.com on 22 Feb 2010 at 2:54

GoogleCodeExporter commented 9 years ago
I make a ./configure --enable-unicode-ucs4 and when I run your script it told 
me again : UCS2

Original comment by fnbis...@gmail.com on 22 Feb 2010 at 3:10

GoogleCodeExporter commented 9 years ago
--enable-unicode-ucs4 must be --enable-unicode=ucs4

Original comment by fnbis...@gmail.com on 22 Feb 2010 at 3:20

GoogleCodeExporter commented 9 years ago
Now this is what I have : 

[root@myhost vboxweb-read-only]# python VBoxWebSrv.py 
Traceback (most recent call last):
  File "VBoxWebSrv.py", line 535, in <module>
    g_vboxManager = vboxapi.VirtualBoxManager(None, None)
  File "/usr/local/lib/python2.6/site-packages/vboxapi/__init__.py", line 470, in __init__
    exec "self.platform = Platform"+style+"(platparams)"
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.6/site-packages/vboxapi/__init__.py", line 318, in __init__
    import xpcom.vboxxpcom
  File "/opt/VirtualBox/sdk//bindings/xpcom/python/xpcom/vboxxpcom.py", line 51, in <module>
    raise Exception, "Cannot find VBoxPython module"
Exception: Cannot find VBoxPython module
[root@myhost vboxweb-read-only]# 

Original comment by fnbis...@gmail.com on 22 Feb 2010 at 3:28

GoogleCodeExporter commented 9 years ago
ok.
vboxapi tries to install itself in /usr/lib or /usr/local/lib (depending on 
pything
build etc)
tho. on x64 systems when you try to run VboxWebSrv.py
its actually trying to look for modules in /usr/lib64/... or 
/usr/local/lib64/...

all you need to do is
cp -R /usr/lib/python2.6/site-packages/vboxapi* 
/usr/lib64/python2.6/site-packages/

helped in my case.
tho still VBoxWeb not working as it should. cant see,create,control VMs.

PS. project is dead ?

Original comment by rolg...@gmail.com on 3 Apr 2010 at 2:05

GoogleCodeExporter commented 9 years ago
Also having the same issues.
Running Centos 5.3
And I am running the 64 bit version of centos.
Have installed Python 2.6 from the CHL repo. 
(as per this
http://www.question-defense.com/2009/12/25/how-to-install-python-2-6-on-centos-5
-without-breaking-yum)
Have downloaded and installed the "all unix" version of virtual box from the 
virtual
box website, the latest edition.
Have downloaded the latest version of the virtual box SDK.
Have run the python installer script after setting up the path to the virtual px
installation directory.
Any more info I can provide please let me know I would really like to get this
working. I can change distro's if need be
Got the latest version of vboxweb console from svn
when I go to run the VBoxwebSrv.py
I get 
[root@snap vboxweb-read-only]# python26 VBoxWebSrv.py
Traceback (most recent call last):
  File "VBoxWebSrv.py", line 535, in <module>
    g_vboxManager = vboxapi.VirtualBoxManager(None, None)
  File "/usr/lib/python2.6/site-packages/vboxapi/__init__.py", line
470, in __init__
    exec "self.platform = Platform"+style+"(platparams)"
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/vboxapi/__init__.py", line
318, in __init__
    import xpcom.vboxxpcom
ImportError: No module named xpcom.vboxxpcom 

Any ideas? 
I am not a python user so I have no idea if the paths are setup to point to the
correct module directories.

Original comment by ryan.lin...@gmail.com on 10 May 2010 at 4:44

GoogleCodeExporter commented 9 years ago
Try this:
before executing 'VBOX_INSTALL_PATH="/opt/VirtualBox" python vboxapisetup.py 
install' 
in /opt/VirtualBox/sdk/installer change in file 
/opt/VirtualBox/sdk/installer/vboxapi/__init__.py from:
VboxBinDir = "/opt/VirtualBox/ "
to:
VboxBinDir = "/opt/VirtualBox"

Original comment by Zer0C...@gmail.com on 13 May 2010 at 12:21

GoogleCodeExporter commented 9 years ago
Here is what I believe to be the "core" of the problem...

Python 2.6.5 (r265:79063, Apr  9 2010, 11:16:46) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import vboxxpcom

### THIS IS SIMPLY A PRINT MESSAGE I ADDED TO PRINT THE CANDIDATES LIST
['VBoxPython2_6', 'VBoxPython2', 'VBoxPython']

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py", line 51, in <module>
    raise Exception, "Cannot find VBoxPython module"
Exception: Cannot find VBoxPython module

>>> import VBoxPython
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/lib/virtualbox/VBoxPython.so: undefined symbol: Py_InitModule4

In essence the shared library VBoxPython.so can't find a prototype or some 
other function.  This happened in 
debian a while back... http://timhatch.com/ark/2008/08/07/py_initmodule4_64 ... 
Since I'm trying to do this 
on RHEL 5.5 using the EPEL repository for Python 2.6 I imagine it has to do 
something with the Python 2.6 
from EPEL, but I'm not totally sure. 

Original comment by dutko.a...@gmail.com on 3 Jun 2010 at 7:32

GoogleCodeExporter commented 9 years ago
WahhoO!  I think I fixed this issue for my RHEL 5.5 x86_64 machine.

Point #1: The RHEL5 RPM distributed on this site doesn't have a 
VirtualBox2_6.so library packaged.  In order to 
get that you need to use the "All Distributions" download and install it on 
your system.  It will be installed 
under /opt/virtualbox.

Point #2: If you're using RHEL5 you need to enable the EPEL repository and 
install python26-devel (yum install 
python26-devel), which should also pull in python26-libs and python26 for i386 
and x86_64. 

Point #3: You need to install the sdk by doing (as root or the user with 
permission to the relocated install dir) 
....   VBOX_INSTALL_PATH=/opt/virtualbox python2.6 vboxapisetup.py install

Point #4: You need to setup the environment by doing the following under your 
BASH instance ...
export PYTHONPATH=/opt/VirtualBox/:/opt/VirtualBox/sdk/bindings/xpcom/python/

Point #5: You can then invoke VBoxWebSrv.py from the vboxweb-read-only 
directory like so ... python2.6 
VBoxWebSrv.py

It works for me so I hope it helps you all.

By the way I found this issue by walking through the VBoxWebSrv.py script and 
localizing the error to 
/opt/VirtualBox/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py then attempting 
the imports by hand, 
then do a dependency check with ldd on the VBoxPython2_6.so library.

I found the following with ldd:

# ldd /opt/VirtualBox/VBoxPython2_6.so 
        libpython2.6.so.1.0 => not found
        VBoxXPCOM.so => /opt/VirtualBox/VBoxXPCOM.so (0x00002ba52d7ae000)
        VBoxRT.so => /opt/VirtualBox/VBoxRT.so (0x00002ba52da10000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002ba52de57000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002ba52e157000)
        libc.so.6 => /lib64/libc.so.6 (0x00002ba52e365000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002ba52e6bd000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002ba52e8d8000)
        libm.so.6 => /lib64/libm.so.6 (0x00002ba52eadc000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002ba52ed60000)
        libz.so.1 => /usr/lib64/libz.so.1 (0x00002ba52ef98000)
        librt.so.1 => /lib64/librt.so.1 (0x00002ba52f1ac000)
        /lib64/ld-linux-x86-64.so.2 (0x000000316a800000)

which prompted the install of python26-libs.

Original comment by dutko.a...@gmail.com on 3 Jun 2010 at 9:03

GoogleCodeExporter commented 9 years ago
Another note... if you get an error message from Cherry saying import zlib 
failed it's probably because you 
need to download the latest zlib source and do:

./configure -s
make
make install

Just to be safe I then rebuilt Python 2.6 and then as is always the case when 
you reinstall Python I reinstalled 
the VBox API.  You should be fine with just building and installing zlib 
though...

Original comment by dutko.a...@gmail.com on 3 Jun 2010 at 9:57

GoogleCodeExporter commented 9 years ago

Original comment by achim.ha...@gmail.com on 26 Aug 2010 at 2:18