Re: ModuleNotFoundError: No module named 'virtManager : TUTORIAL REDONE BETTER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is this good ? I'm running :

root@zi-desktop:/usr/bin# virsh version

Compiled against library: libvirt 7.4.0
Using library: libvirt 7.4.0
Using API: QEMU 7.4.0
Running hypervisor: QEMU 6.0.50

and virt-manager version : 1.5.1. It's old but it works.

Screenshot_2021-05-30_14-41-56.png

Il giorno dom 30 mag 2021 alle ore 14:23 Mario Marietto <marietto2008@xxxxxxxxx> ha scritto:
thanks. What's a virt-manager ? a folder or an executable file ? I found the executable file on /usr/bin and I did something like this :

root@zi-desktop:/# cp /home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin/virt-manager /usr/bin

but it didn't work :

root@zi-desktop:/# virt-manager
Traceback (most recent call last):
  File "/usr/bin/virt-manager", line 6, in <module>
    from virtManager import virtmanager
ImportError: cannot import name 'virtmanager'

Il giorno dom 30 mag 2021 alle ore 10:46 Radostin Stoyanov <rstoyanov1@xxxxxxxxx> ha scritto:

Hi Mario,

The problem with "ModuleNotFoundError: No module named 'ConfigParser'" is resolved in the following commit.

https://github.com/virt-manager/virt-manager/commit/810ee092924083a86d98a6e18ca826f5fa4dae72

It looks like you have an older version of virt-manager installed in "/usr/share/virt-manager/". Could you try please try to remove it or update to the latest version?

Best wishes,
Radostin


On 29/05/2021 15:39, Mario Marietto wrote:
I've tried some different folders :

root@zi-desktop:/# export PYTHONPATH=$PYTHONPATH:/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager

root@zi-desktop:/# virt-manager

Traceback (most recent call last):
  File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin/virt-manager", line 6, in <module>
    from virtManager import virtmanager
  File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager/virtManager/virtmanager.py", line 19, in <module>
    from virtinst import BuildConfig
  File "/usr/share/virt-manager/virtinst/__init__.py", line 18, in <module>
    from virtcli import CLIConfig as _CLIConfig
  File "/usr/share/virt-manager/virtcli/__init__.py", line 3, in <module>
    from .cliconfig import CLIConfig
  File "/usr/share/virt-manager/virtcli/cliconfig.py", line 24, in <module>
    import ConfigParser
ModuleNotFoundError: No module named 'ConfigParser'

root@zi-desktop:/# export PYTHONPATH=$PYTHONPATH:/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin

root@zi-desktop:/# virt-manager

Traceback (most recent call last):                                                                                                                            
  File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin/virt-manager", line 6, in <module>                                                            
    from virtManager import virtmanager                                                                                                                      
  File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager/virtManager/virtmanager.py", line 19, in <module>                              
    from virtinst import BuildConfig                                                                                                                          
  File "/usr/share/virt-manager/virtinst/__init__.py", line 18, in <module>                                                                                  
    from virtcli import CLIConfig as _CLIConfig                                                                                                              
  File "/usr/share/virt-manager/virtcli/__init__.py", line 3, in <module>                                                                                    
    from .cliconfig import CLIConfig                                                                                                                          
  File "/usr/share/virt-manager/virtcli/cliconfig.py", line 24, in <module>                                                                                  
    import ConfigParser                                                                                                                                      
ModuleNotFoundError: No module named 'ConfigParser'   

Something is broken / missing. Can u help me ? thanks.

Il giorno sab 29 mag 2021 alle ore 16:15 Mario Marietto <marietto2008@xxxxxxxxx> ha scritto:
Hello.

thanks. I tried,but it didn't work :

root@zi-desktop:~/Desktop/zi/Work/I9/libvirt/libvirt_build/usr/bin# export PYTHONPATH=$PYTHONPATH:/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager

root@zi-desktop:~/Desktop/zi/Work/I9/libvirt/libvirt_build/usr/bin# ls /home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager

icons  ui  virtinst  virtManager

root@zi-desktop:~/Desktop/zi/Work/I9/libvirt/libvirt_build/usr/bin# virt-manager

Traceback (most recent call last):
  File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin/virt-manager", line 6, in <module>
    from virtManager import virtmanager
  File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager/virtManager/virtmanager.py", line 19, in <module>
    from virtinst import BuildConfig
  File "/usr/share/virt-manager/virtinst/__init__.py", line 18, in <module>
    from virtcli import CLIConfig as _CLIConfig
  File "/usr/share/virt-manager/virtcli/__init__.py", line 3, in <module>
    from .cliconfig import CLIConfig
  File "/usr/share/virt-manager/virtcli/cliconfig.py", line 24, in <module>
    import ConfigParser
ModuleNotFoundError: No module named 'ConfigParser'

Il giorno sab 29 mag 2021 alle ore 16:07 Radostin Stoyanov <rstoyanov1@xxxxxxxxx> ha scritto:

Hi Mario,

The error message "ModuleNotFoundError: No module named 'virtManager'" indicates that Python can't find where the virtManager module was installed.

To resolve this problem you may need to add the appropriate path to your PYTHONPATH environment variable.

Example:

export PYTHONPATH=$PYTHONPATH:/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/share/virt-manager

Best wishes,
Radostin


On 29/05/2021 14:57, Mario Marietto wrote:

Hello.


I've tried to compile a custom libvirt-python+virt-manager stack following these tutorials :


https://developer.ibm.com/technologies/linux/tutorials/compiling-libvirt-and-qemu/

https://gist.github.com/ffledgling/9e06ee32431d9a8f6d9bec3a0db35634


on my jetson nano (arm64 + ubuntu 18.04). In details,these are the steps that I did :


  1. Install Git and clone both upstream libvirt and qemu repos.

git clone https://github.com/qemu/qemu.git

git clone https://github.com/libvirt/libvirt.git


  1. Configure and build the qemu code and then install the qemu code. The make install command creates the binary files in the /usr/local directory.

cd qemu

mkdir -p build

cd build

../configure --prefix=/usr/local --target-list=aarch64-softmmu,arm-softmmu --enable-guest-agent --enable-vnc --enable-vnc-jpeg --enable-vnc-png --enable-kvm --enable-spice --enable-sdl --enable-gtk --enable-virglrenderer --enable-opengl

make -j

sudo make install


2.1) qemu 6.0 has been detected correctly at this point :


#qemu-system-aarch64 --version

QEMU emulator version 6.0.50 (v6.0.0-1145-g7258034ab4) Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers


  1. Configure and build libvirt and then install the libvirt code. Libvirt_build contains the log and configuration files for the daemons and the qemu driver.


cd ~/Desktop/zi/Work/I9/libvirt

mkdir -p libvirt_build

cd ~/Desktop/zi/Work/I9/libvirt

$ meson libvirt_build

$ ninja -C libvirt_build

$ ninja -C libvirt_build install


  1. Run the following commands from /root/Desktop/zi/Work/I9/libvirt/libvirt_build directory to start the libvirt daemon (libvirtd).


~/Desktop/zi/Work/I9/libvirt/libvirt_build# sudo ./run src/virtlockd & sudo ./run src/virtlogd & sudo ./run src/libvirtd


  1. Here is the ouput of the virt process running in my system :


~/Desktop/zi/Work/I9/libvirt_build# ps axf | grep virt

30925 pts/0 S 0:00 | _ sudo ./run src/virtlockd 30929 pts/0 S 0:00 | |
_ src/virtlockd 30926 pts/0 S 0:00 |
_ sudo ./run src/virtlogd 30930 pts/0 S 0:00 |
| _ src/virtlogd 31201 pts/0 S 0:00 |
_ sudo ./run src/virtlockd 31205 pts/0 S 0:00 |
| _ src/virtlockd 31202 pts/0 S 0:00 |
_ sudo ./run src/virtlogd 31207 pts/0 S 0:00 |
| _ src/virtlogd 31204 pts/0 S+ 0:00 |
_ sudo ./run src/libvirtd 31206 pts/0 Sl+ 0:01 |
_ src/libvirtd 4732 pts/1 S+ 0:00 _ grep --color=auto virt

31413 ? S 0:00 /usr/sbin/dnsmasq --conf-file=/root/Desktop/zi/Work/I9/libvirt/libvirt_build/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/home/zi/Desktop/Work/I9/libvirt/build/src/libvirt_leaseshelper

31426 ? S 0:00 _ /usr/sbin/dnsmasq --conf-file=/root/Desktop/zi/Work/I9/libvirt/libvirt_build/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/home/zi/Desktop/Work/I9/libvirt/build/src/libvirt_leaseshelper


6. Install libvirt-python next because I need to use virt-manager and that requires libvirt python bindings


~/Desktop/zi/Work/I9/libvirt/libvirt_build# sudo ./run tools/virsh list --all

Id Name State



  1. Install libvirt-python next because I need to use virt-manager and that requires libvirt python bindings

CUSTOM_ROOT=/home/zi/Desktop/Work/I9/libvirt/libvirt_build

mkdir - p $CUSTOM_ROOT/src

#cp -r /root/Scrivania/Scrivania/Dati/Data/Nano/I9/Tools/virt-manager-3.2.0 /home/zi/Desktop/Work/I9/libvirt/libvirt_build/src

~/Desktop/zi/Work/I9/libvirt/libvirt_build/src/libvirt-python-7.3.0# export LD_LIBRARY_PATH=$CUSTOM_ROOT/lib

~/Desktop/zi/Work/I9/libvirt/libvirt_build/src/libvirt-python-7.3.0# export PKG_CONFIG_PATH=$CUSTOM_ROOT/lib/aarch64-linux-gnu/pkgconfig

~/Desktop/zi/Work/I9/libvirt/libvirt_build/src/libvirt-python-7.3.0# python setup.py build

~/Desktop/zi/Work/I9/libvirt/libvirt_build/src/libvirt-python-7.3.0# python setup.py install --root $CUSTOM_ROOT

LOG : https://pastebin.ubuntu.com/p/SVHkDhXs2s/


  1. Then I've installed a custom virt-manager into the same location and it should pick up the newer python bindings :

#cp -r /root/Scrivania/Scrivania/Dati/Data/Nano/I9/Tools/virt-manager-3.2.0 /home/zi/Desktop/Work/I9/libvirt/libvirt_build/src

#cd virt-manager-3.2.0

#python setup.py install --root $CUSTOM_ROOT

LOG : https://pastebin.ubuntu.com/p/bCn5Q3yHVX/


  1. Finally I put all in my $PATH :

export PATH=$CUSTOM_ROOT/bin:$PATH

export PATH=$CUSTOM_ROOT/usr/bin:$PATH

#echo $PATH

/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin:/home/zi/Desktop/Work/I9/libvirt/libvirt_build/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zi/Desktop/Work:/root/Desktop/turbovnc/jtx1_remote_access >/tmp/turbovnc-build/bin/:/root/Desktop/turbovnc/jtx1_remote_access/tmp/virtualgl-build/bin/


  1. Unfortunately,when I try to run virt-manager with this command,it does not work :

/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin# python virt-manager


Traceback (most recent call last): File "/home/zi/Desktop/Work/I9/libvirt/libvirt_build/usr/bin/virt-manager", line 6, in from virtManager import virt manager ModuleNotFoundError: No module named 'virtManager'


Where is the mistake ? Thanks very much.

--
Mario.


--
Mario.


--
Mario.


--
Mario.


--
Mario.

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux