You are not logged in.

#1 2014-09-19 09:19:06

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

compile python

hi fellows,
I'm not new to Arch but I'm very new with python programming.
I would to compile a program that is written in python (2)
here the homepage link:   https://code.google.com/p/nemesys-qos/
for who is curious it's a program that produce a, legally effective, document certifying speed of my internet connection (ADSL, fibre, ...)
by performing a particular kind of speed test using a NAP server

anyway, how can I compile it?


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#2 2014-09-19 11:32:47

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: compile python

With Python there is normally no need to (byte-)compile anything yourself, you can probably just start the program with "python2 Nemesys.py". Make sure you have python2-m2crypto installed.

Offline

#3 2014-09-19 12:57:49

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: compile python

I have python2-m2crypto installed in my system.
I downloaded the source with

svn checkout http://nemesys-qos.googlecode.com/svn/trunk/ nemesys-qos-read-only

but when I try to run the program I get:

[mattia@arch-desktop nemesys]$ python2 Nemesys.py 
Traceback (most recent call last):
  File "Nemesys.py", line 20, in <module>
    import pythoncom
ImportError: No module named pythoncom

+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#4 2014-09-19 13:05:20

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: compile python

nTia89 wrote:

anyway, how can I compile it?

Doesn't look like you can -- the source code leads me to believe that its Windows only.

Offline

#5 2014-09-19 13:12:40

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: compile python

No, it's open source and cross-platform program. I'm sure about that because you can download a "precompiled" package for ubuntu (11.04 and above)
I can't provide you a link because it's only available for registered users.
anyway if I download it, I get a .deb package with inside three files:

control.tar.gz, data.tar.gz and debian-binary

+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#6 2014-09-19 13:51:47

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: compile python

You need to install it first.

python setup_lin.py install

Offline

#7 2014-09-19 13:55:14

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,402

Re: compile python

Extract control.tar.gz and post the resulting text file here.

Everything I'm seeing with google says that pythoncom is part of pywin32. Curious to see where debian gets that.

Offline

#8 2014-09-19 16:54:36

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: compile python

@Scimmia
I uploaded in my dropbox the control.tar.gz archive because it doesn't contain any confidential information. Take it from https://db.tt/wIOarsKO

@jakobcreutzfeldt
if I try to execute that command (I tried four combinations of python/python2 with or without sudo) I get:

[mattia@arch-desktop nemesys-qos-read-only]$ python setup_lin.py install      
Traceback (most recent call last):
  File "setup_lin.py", line 7, in <module>
    from nemesys.executer import __version__
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/executer.py", line 19, in <module>
    from ConfigParser import ConfigParser, NoOptionError
ImportError: No module named 'ConfigParser'



[mattia@arch-desktop nemesys-qos-read-only]$ python2 setup_lin.py install
Traceback (most recent call last):
  File "setup_lin.py", line 7, in <module>
    from nemesys.executer import __version__
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/executer.py", line 22, in <module>
    from deliverer import Deliverer
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/deliverer.py", line 23, in <module>
    from logger import logging
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/logger.py", line 68, in <module>
    logging.config.fileConfig(configfile)
  File "/usr/lib/python2.7/logging/config.py", line 85, in fileConfig
    handlers = _install_handlers(cp, formatters)
  File "/usr/lib/python2.7/logging/config.py", line 163, in _install_handlers
    h = klass(*args)
  File "/usr/lib/python2.7/logging/__init__.py", line 911, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 936, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/home/mattia/ddd/nemesys-qos-read-only/logs/nemesys.log'



[mattia@arch-desktop nemesys-qos-read-only]$ sudo python setup_lin.py install
Traceback (most recent call last):
  File "setup_lin.py", line 7, in <module>
    from nemesys.executer import __version__
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/executer.py", line 19, in <module>
    from ConfigParser import ConfigParser, NoOptionError
ImportError: No module named 'ConfigParser'



[mattia@arch-desktop nemesys-qos-read-only]$ sudo python2 setup_lin.py install
Traceback (most recent call last):
  File "setup_lin.py", line 7, in <module>
    from nemesys.executer import __version__
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/executer.py", line 34, in <module>
    from tester import Tester
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/tester.py", line 30, in <module>
    import netstat
  File "/home/mattia/ddd/nemesys-qos-read-only/nemesys/netstat.py", line 10, in <module>
    import psutil
ImportError: No module named psutil

EDIT: extracting executables  and running it I get:

[mattia@arch-desktop dist]$ ./NemesysGUI 
Gtk-Message: Failed to load module "canberra-gtk-module"

(NemesysGUI:5144): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so: wrong ELF class: ELFCLASS64

(NemesysGUI:5144): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libadwaita.so: wrong ELF class: ELFCLASS64
...
...
...
(NemesysGUI:5144): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so: wrong ELF class: ELFCLASS64

(NemesysGUI:5144): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin'

(NemesysGUI:5144): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'

and a window appear but with broken font (see attached screenshot)
https://db.tt/7YnF9VVK

Last edited by nTia89 (2014-09-20 10:02:18)


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#9 2014-10-01 03:53:06

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: compile python

Sounds like you're missing some packages it depends on; I just set up a quick virtualenv, and I was able to install the module without issue. Do you have virtualenv installed? Try this:

$ pacman -S python2-virtualenv
$ virtualenv2 testpy
$ cd testpy
$ source bin/activate

This puts you into a virtual python environment, so you can install whatever safely. Nice sandbox feature. Note the shell prompt changes to remind you you're in the virtualenv.

(testpy)$ pip install netifaces
(testpy)$ pip install psutil
(testpy)$ pip install M2Crypto

Then, while you're still in the virtual env, try doing the

(testpy)$ python2 setup_lin.py install

. If that all works, then it suggests you just need to be certain you have all the dependencies in your base python environment (assuming you want to put this code in permanently).

* M2Crypto may require you to have swig installed, if you don't have it already. You can't just use pacman to install these packages to the virtualenv, since it all exists in its own directory, wherever you called the virtualenv2 command. Once you're done, you can just do:

(testpy)$ deactivate
$ cd ..
$ rm -rf testpy

and everything's back to normal.

Offline

#10 2014-10-01 19:39:18

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: compile python

first, thanks @DrMag that teach me a new stuff about python

now, I successfully setup the sandbox, then I downloaded source and finally execute the install without errors
but if I try to execute an installed file I get:

(testpy)[mattia@arch-desktop trunk]$ python2 /tmp/testpy/lib/python2.7/site-packages/nemesys/Nemesys.py
Traceback (most recent call last):
  File "/tmp/testpy/lib/python2.7/site-packages/nemesys/Nemesys.py", line 20, in <module>
    import pythoncom
ImportError: No module named pythoncom

+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#11 2014-10-01 20:22:21

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: compile python

A little google work tells me pythoncom comes in pywin32... I don't know if that works in linux or not, since pywin32 is bindings for windows extensions. Looking at the Nemsys.py file, it imports a handful of modules that are part of pywin32. So you have a reference somewhere that this code actually will work on a linux machine?

Offline

#12 2014-10-01 20:23:49

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: compile python

they provides packages (precompiled) for :
-Winz
-Mac
-Ubuntu


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#13 2014-10-01 20:45:31

DrMag
Member
Registered: 2013-03-27
Posts: 24

Re: compile python

Ok, after some digging around, I'm not sure Nemesys is the one you want to execute. Try executing gui.py instead; that brings up a gui window for me.

(I tried this without actually installing it, as it requires wxpython, which is a little tricky to install into a virtualenv without tracking down all the dependencies. Just downloaded the code, cd nemesys-qos-read-only/nemesys, and python2 gui.py)

Offline

#14 2014-10-02 03:44:41

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,532

Re: compile python

Why don't you try to find out whether you have pythoncom in the python searching path?
What will it say?

find /usr -iname pythoncom

(assuming that you have installed in the python library) or look at this.
Sorry I didn't read deeply the DrMag comments.
Anyways you should read the INSTALL, for directions and starting by calling gui.py. Make sure you have installed wxpython and M2Crypto.

Last edited by TheSaint (2014-10-02 04:08:14)


do it good first, it will be faster than do it twice the saint wink

Offline

#15 2014-10-02 08:07:27

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: compile python

@DrMag following your suggestion executing gui.py work, showing me the program window, but anyway I can't use it, or better the program can't start measures because it can't find a needed daemon running....

@TheSaint

find ...

returns no results and INSTALL file has no useful information: it says
a- you need python>=2.6
b- you need openssl
c- you need M2Crypto
but absolutely nothing about executing or installing it!


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#16 2014-10-03 03:06:20

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,532

Re: compile python

Well, pythoncom is only for win platform. You were starting from the wrong point.
For b) and c) points, you should care by your own, as that is not an AUR package nor a package which gives dependencies declarations.
If you want, you may write to the author for supporting him to give more attention on Linux development.


do it good first, it will be faster than do it twice the saint wink

Offline

Board footer

Powered by FluxBB