emane-tutorial icon indicating copy to clipboard operation
emane-tutorial copied to clipboard

OLSR topology viewer errors from imports

Open kjacks21 opened this issue 9 years ago • 7 comments

Where is it advised to place the directory for pynodestatviz? I'm running into import errors when I call ../scripts/olsrlinkview.py & and am having to fix the import paths (e.g. from folder.nodestatviz import function as opposed to from nodestatviz import function). I am running Ubuntu 16.04.

kjacks21 avatar Dec 06 '16 00:12 kjacks21

Have you tried building a deb and installing? Instructions should largely be the same: https://github.com/adjacentlink/emane-tutorial/wiki/Install#Ubuntu%2014.04%20LTS.

sgalgano avatar Dec 06 '16 00:12 sgalgano

(As context I'm relatively new to Linux) Yes, I followed the directions from the link provided in addition to following the directions from Tutorial 0. The only thing I did different was sudo make deb since make deb wouldn't work for me, though I'm not sure if that caused an issue. Just in case, this is what was returned when I used make deb:

if test -f setup.py; then chmod u+w setup.py; fi sed -e 's|@VERSION[@]|0.2.1|g' -e 's|@DEBIAN_VERSION[@]|stretch|g' setup.py.in > setup.py chmod g-w,u-w setup.py if test -f stdeb.cfg; then chmod u+w stdeb.cfg; fi sed -e 's|@VERSION[@]|0.2.1|g' -e 's|@DEBIAN_VERSION[@]|stretch|g' stdeb.cfg.in > stdeb.cfg chmod g-w,u-w stdeb.cfg python setup.py --command-packages=stdeb.command bdist_deb usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: invalid command 'bdist_deb' Makefile:60: recipe for target 'deb' failed make: *** [deb] Error 1

kjacks21 avatar Dec 06 '16 02:12 kjacks21

It looks like you are missing at least one of the required dependencies: python-stdeb.

sgalgano avatar Dec 06 '16 02:12 sgalgano

I'm doing the installation again. Looks like I already have python-stdeb (Debian and Ubuntu come with stdeb). I looked at the docs at https://github.com/astraw/stdeb#bdist-deb-distutils-command and bdist_deb looks fine. Could it be Python 2 vs 3 causing the issue?

kyle@kyle-ThinkPad-T450s:~/Documents/tutorial/pynodestatviz$ make deb if test -f setup.py; then chmod u+w setup.py; fi sed -e 's|@VERSION[@]|0.2.1|g' -e 's|@DEBIAN_VERSION[@]|stretch|g' setup.py.in > setup.py chmod g-w,u-w setup.py if test -f stdeb.cfg; then chmod u+w stdeb.cfg; fi sed -e 's|@VERSION[@]|0.2.1|g' -e 's|@DEBIAN_VERSION[@]|stretch|g' stdeb.cfg.in > stdeb.cfg chmod g-w,u-w stdeb.cfg python setup.py --command-packages=stdeb.command bdist_deb usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: invalid command 'bdist_deb' Makefile:60: recipe for target 'deb' failed make: *** [deb] Error 1 kyle@kyle-ThinkPad-T450s: ~/Documents/tutorial/pynodestatviz$ sudo apt-get install python-stdeb [sudo] password for kyle: Reading package lists... Done Building dependency tree
Reading state information... Done python-stdeb is already the newest version (0.8.5-1). 0 upgraded, 0 newly installed, 0 to remove and 186 not upgraded. kyle@kyle-ThinkPad-T450s: ~/Documents/tutorial/pynodestatviz$ make deb python setup.py --command-packages=stdeb.command bdist_deb usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: invalid command 'bdist_deb' Makefile:60: recipe for target 'deb' failed make: *** [deb] Error 1

kjacks21 avatar Dec 06 '16 15:12 kjacks21

I have only built and used this module with python 2. I just tested it and was successful in building a deb on an Ubuntu 16.04 VM.

sgalgano avatar Dec 06 '16 16:12 sgalgano

You can also set PYTHONPATH to the location of the built module. This will allow you to run from your local repo without modification.

export PYTHONPATH=/path/to/your/built/src/pynodestatviz/build/lib.linux-x86_64-2.7

Adjust accordingly for your location and architecture.

sgalgano avatar Dec 06 '16 17:12 sgalgano

Thank you! My question is now resolved and I appreciate your quick responses. This is what I had to do to get things working on Ubuntu 16.04 running the Anaconda distro of python 3:

  1. Use python 2. (I was using anaconda python 3. I simply created a python 2 environment with $ conda create -n python2 python=2.7 anaconda. Anaconda will download python 2 and create a python2 environment while leaving python 3 as the default.)

  2. $ export PYTHONPATH=/home/user/path/to/your/built/src/pynodestatviz (don't go down to the second pynodestatviz)

  3. $ conda install -c fable pmw=2.0.0 (I was missing Pmw)

Also, for whatever reason, I still had to use $ sudo make deb during the installation steps from https://github.com/adjacentlink/emane-tutorial/wiki/Install#Ubuntu%2014.04%20LTS

kjacks21 avatar Dec 06 '16 23:12 kjacks21