named-data-ndnSIM / ndnSIM

ndnSIM: NS-3 based NDN simulator
GNU General Public License v3.0
108 stars 165 forks source link

No visualization support (cannot import name core) #93

Open SifatTaj opened 5 years ago

SifatTaj commented 5 years ago

When I am trying to run an example with --vis I get the following error

No visualization support (cannot import name core).
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/home/taj/ndnSIM/ns-3/src/visualizer/visualizer/core.py", line 1875, in start
    import sys
RuntimeError: maximum recursion depth exceeded while calling a Python object

My build

'build' finished successfully (3m17.668s)

Modules built:
antenna                   aodv                      applications              
bridge                    buildings                 config-store              
core                      csma                      csma-layout               
dsdv                      dsr                       energy                    
fd-net-device             flow-monitor              internet                  
internet-apps             lr-wpan                   lte                       
mesh                      mobility                  mpi                       
ndnSIM                    netanim (no Python)       network                   
nix-vector-routing        olsr                      point-to-point            
point-to-point-layout     propagation               sixlowpan                 
spectrum                  stats                     tap-bridge                
test (no Python)          topology-read             traffic-control           
uan                       virtual-net-device        visualizer                
wave                      wifi                      wimax                     

Modules not built (see ns-3 tutorial for explanation):
brite                     click                     openflow    

My configuration

Setting top to                           : /home/taj/ndnSIM/ns-3 
Setting out to                           : /home/taj/ndnSIM/ns-3/build 
Checking for 'gcc' (C compiler)          : /usr/bin/gcc 
Checking for cc version                  : 7.4.0 
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
Checking supported compiler CXXFLAGS     : -std=c++14 
Checking supported optimizations CXXFLAGS : -O0 
Checking supported debug CXXFLAGS         : -ggdb -g3 
Checking supported warnings CXXFLAGS      : -Wall -Wno-error=deprecated-declarations -fstrict-aliasing -Wstrict-aliasing 
Checking for compilation flag -Wl,--soname=foo support : ok 
Checking for compilation flag -std=c++14 support       : ok 
Checking for program 'python'                          : /usr/bin/python 
Checking for python version >= 2.3                     : 2.7.15 
python-config                                          : /usr/bin/python-config 
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes 
Testing pyembed configuration                                      : yes 
Asking python-config for pyext '--cflags --libs --ldflags' flags   : yes 
Testing pyext configuration                                        : yes 
Checking for compilation flag -fvisibility=hidden support          : ok 
Checking for compilation flag -Wno-array-bounds support            : ok 
Checking for pybindgen location                                    : ../pybindgen (guessed) 
Checking for python module 'pybindgen'                             : 0.19.0.post4+g823d8b2 
Checking for pybindgen version                                     : 0.19.0.post4+g823d8b2 
Checking for code snippet                                          : yes 
Checking for types uint64_t and unsigned long equivalence          : no 
Checking for code snippet                                          : no 
Checking for types uint64_t and unsigned long long equivalence     : yes 
Checking for the apidefs that can be used for Python bindings      : gcc-LP64 
Checking for internal GCC cxxabi                                   : complete 
Checking for python module 'pygccxml'                              : 1.9.1 
Checking for pygccxml version                                      : 1.9.1 
Checking for program 'castxml'                                     : /usr/bin/castxml 
Checking for castxml version                                       : 0.1 
Checking boost includes                                            : 1_65_1 
Checking boost libs                                                : ok 
Checking for boost linkage                                         : ok 
Checking for click location                                        : not found 
Checking for program 'pkg-config'                                  : /usr/bin/pkg-config 
Checking for 'gtk+-3.0'                                            : not found 
Checking for 'libxml-2.0'                                          : not found 
checking for uint128_t                                             : not found 
checking for __uint128_t                                           : yes 
Checking high precision implementation                             : 128-bit integer (default) 
Checking for header stdint.h                                       : yes 
Checking for header inttypes.h                                     : yes 
Checking for header sys/inttypes.h                                 : not found 
Checking for header sys/types.h                                    : yes 
Checking for header sys/stat.h                                     : yes 
Checking for header dirent.h                                       : yes 
Checking for header stdlib.h                                       : yes 
Checking for header signal.h                                       : yes 
Checking for header pthread.h                                      : yes 
Checking for header stdint.h                                       : yes 
Checking for header inttypes.h                                     : yes 
Checking for header sys/inttypes.h                                 : not found 
Checking for library rt                                            : yes 
Checking for header sys/ioctl.h                                    : yes 
Checking for header net/if.h                                       : yes 
Checking for header net/ethernet.h                                 : yes 
Checking for header linux/if_tun.h                                 : yes 
Checking for header netpacket/packet.h                             : yes 
Checking for NSC location                                          : not found 
Checking for program 'doxygen'                                     : not found 
Checking for program 'tar'                                         : /bin/tar 
Checking for program 'sphinx-build'                                : not found 
Checking for std::to_string                                        : yes 
Checking for library pthread                                       : yes 
Checking for 'sqlite3'                                             : yes 
Checking for OpenSSL lib                                           : "OpenSSL 1.1.0g-fips  2 Nov 2017" 
Checking if OpenSSL library works                                  : yes 
Checking for OpenFlow location                                     : not found 
Checking for 'sqlite3'                                             : yes 
Checking for header linux/if_tun.h                                 : yes 
Checking for python module 'gi'                                    : 3.26.1 
Checking for python module 'gi.repository.GObject'                 : ok 
Checking for python module 'cairo'                                 : ok 
Checking for python module 'pygraphviz'                            : 1.4rc1 
Checking for python module 'gi.repository.Gtk'                     : ok 
Checking for python module 'gi.repository.Gdk'                     : ok 
Checking for python module 'gi.repository.Pango'                   : ok 
Checking for python module 'gi.repository.GooCanvas'               : ok 
Checking for program 'sudo'                                        : /usr/bin/sudo 
Checking for program 'valgrind'                                    : not found 
Checking for 'gsl'                                                 : not found 
python-config                                                      : not found 
Checking for program 'doxygen'                                     : not found 
---- Summary of optional NS-3 features:
Build profile                 : debug
Build directory               : 
BRITE Integration             : not enabled (BRITE not enabled (see option --with-brite))
DES Metrics event collection  : not enabled (defaults to disabled)
Emulation FdNetDevice         : enabled
Examples                      : enabled
File descriptor NetDevice     : enabled
GNU Scientific Library (GSL)  : not enabled (GSL not found)
Gcrypt library                : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
GtkConfigStore                : not enabled (library 'gtk+-3.0 >= 3.0' not found)
MPI Support                   : not enabled (option --enable-mpi not selected)
NS-3 Click Integration        : not enabled (nsclick not enabled (see option --with-nsclick))
NS-3 OpenFlow Integration     : not enabled (OpenFlow not enabled (see option --with-openflow))
Network Simulation Cradle     : not enabled (NSC not found (see option --with-nsc))
PlanetLab FdNetDevice         : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
PyViz visualizer              : enabled
Python API Scanning Support   : enabled
Python Bindings               : enabled
Real Time Simulator           : enabled
SQlite stats data output      : enabled
Tap Bridge                    : enabled
Tap FdNetDevice               : enabled
Tests                         : not enabled (defaults to disabled)
Threading Primitives          : enabled
Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
XmlIo                         : not enabled (library 'libxml-2.0 >= 2.7' not found)
ndnSIM                        : enabled
'configure' finished successfully (12.662s)
LAIMX commented 5 years ago

I have the same question too! Hope someone can give a help!

jo4965 commented 5 years ago

It seems that there are problems in current version of ns-3-dev.

in line 51 of ns-3-dev/src/visualizer/visualizer/core.py from . import hud

in line 2 of ns-3-dev/src/visualizer/visualizer/hud.py from . import core

They import each other, which causes infinite loops.

You need to build the former version which does not apply the latest commit. The commands are below.

git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
cd ns-3
git log -n2
git reset --hard <the second commit hash>
cd ..
git clone --recursive https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM

Then probably no errors will be reported.

LAIMX commented 5 years ago

@jo4965 Thanks for your reply! I had solved this problem! I replaced the whole "visualizer" folder with another "visualizer' folder which are from the "ns-3 allinone" library!

However, I found other problem as well. It was about the visualization label position. I copied some codes from

visualizer/core.py 1365-1368 if angle < -PI_OVER_2: angle += math.pi else: angle -= math.pi

I totally solved this problem! Thanks a lot!

Derek

jo4965 commented 5 years ago

@LAIMX I'm glad you already solved it. The problematic current version was committed 2 months ago. The "ns-3 allinone" library may have older version of ns-3-dev than the current one, so it works well.

lrtcoolman commented 5 years ago

I am running Linux ubuntu 4.15.0-52-generic #56~16.04.1-Ubuntu SMP Thu Jun 6 12:03:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

CONFIGURATION >> https://pastebin.com/jd2PwQMp BUILT >> https://pastebin.com/WdYYXfVH

Previously, my visualiser cannot works and cannot be installed but I managed to setup and built successfully based on

git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3 cd ns-3 git log -n2 git reset --hard cd .. git clone --recursive https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM

Then, I had enabled the examples in configuration and can compile successfully. But i got this error when I run the simple ndn simulation with visualiser (./waf --run=ndn-simple --vis) Waf: Entering directory /home/lrtndn/Desktop/ndnSIM_working/ns-3/build' Waf: Leaving directory/home/lrtndn/Desktop/ndnSIM_working/ns-3/build' Build commands will be stored in build/compile_commands.json 'build' finished successfully (14.574s) Could not load plugin 'show_last_packets.py': could not import gobject (could not find _PyGObject_API object) Could not load icon applets-screenshooter due to missing gnomedesktop Python module Traceback (most recent call last): File "", line 2, in File "/home/lrtndn/Desktop/ndnSIM_working/ns-3/src/visualizer/visualizer/core.py", line 1877, in start viz = Visualizer() File "/home/lrtndn/Desktop/ndnSIM_working/ns-3/src/visualizer/visualizer/core.py", line 760, in init self.create_gui() File "/home/lrtndn/Desktop/ndnSIM_working/ns-3/src/visualizer/visualizer/core.py", line 1096, in create_gui monitor = display.get_primary_monitor() AttributeError: 'X11Display' object has no attribute 'get_primary_monitor'