Installing PyDQ under Ubuntu 10.04 for Fun and Profit

18 views
Skip to first unread message

James

unread,
Feb 20, 2011, 2:53:19 AM2/20/11
to Guerrilla Capacity Planning
I am trying to get PyDQ up and running under Ubuntu 10.04.

Initially I was having issues with the PyDQ compilation but after some
research found that I needed python-dev to be installed to have all
the necessary headers for `python setup.py install` to execute.

I have been able to run `make all` and execute the "test.pl" under the
perl5 sub-dir without issue.

Under the python sub-dir I see that the build/lib.linux-i686-2.6 is
populated with pdq.py and _pdq.so:

8<-------------------
root@icrushservers-desktop:/home/icrushservers/Desktop/pdq/python/
build/lib.linux-i686-2.6# ls -al
total 292
drwxr-xr-x 2 root root 4096 2011-02-20 01:30 .
drwxr-xr-x 4 root root 4096 2011-02-20 01:30 ..
-rw-r--r-- 1 root root 16799 2009-07-12 08:47 pdq.py
-rwxr-xr-x 1 root root 262730 2011-02-20 01:30 _pdq.so
-------------------->8

If I run `make clean` I can see that the build sub-dir is blown away
and if I re-execute `build all` the build sub-dir will be populated
again as noted above.

When I try to execute test.py I get the following output:

8<----------------------
root@icrushservers-desktop:/home/icrushservers/Desktop/pdq/python# ./
test.py
Traceback (most recent call last):
File "./test.py", line 22, in <module>
import pdq
File "/home/icrushservers/Desktop/pdq/python/pdq.py", line 19, in
<module>
_pdq = swig_import_helper()
File "/home/icrushservers/Desktop/pdq/python/pdq.py", line 17, in
swig_import_helper
if fp is not None: fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
----------------------->8

I double checked the README.setup file I have copied the libpdq.a to /
usr/local/lib and have also verified that the libpdq.a exists in the
pdq/lib sub-dir.

8<-----------------
root@icrushservers-desktop:/home/icrushservers/Desktop/pdq# ls -al lib/
libpdq.a
-rw-r--r-- 1 root root 69140 2011-02-20 01:28 lib/libpdq.a

root@icrushservers-desktop:/home/icrushservers/Desktop/pdq# ls -al /
usr/local/lib/
total 92
drwxr-xr-x 5 root root 4096 2011-02-20 00:40 .
drwxr-xr-x 9 root root 4096 2010-02-12 00:22 ..
-rw-r--r-- 1 root root 69140 2011-02-20 00:20 libpdq.a
drwxrwxr-x 4 root root 4096 2011-02-19 23:48 perl
drwxrwsr-x 4 root staff 4096 2011-02-19 16:53 python2.6
drwxrwsr-x 3 root staff 4096 2009-06-11 16:18 R
------------------>8

I am executing at root so I don't think there will be an issue
accessing the _pdq.so shared object from under the build/lib.linux-
i686-2.6 sub-dir. But, just to cover all the bases I did go ahead (as
the README.setup recommended) and create a ~/lib/python sub-dir and
copied the _pdq.so into the sub-dir and modified my .profile to export
the environment variable for PYTHONPATH:

8<-----------------
root@icrushservers-desktop:/home/icrushservers/Desktop/pdq/python# ls -
al ~/lib/python/
total 272
drwxr-xr-x 2 root root 4096 2011-02-20 00:25 .
drwxr-xr-x 3 root root 4096 2011-02-20 00:24 ..
-rwxr-xr-x 1 root root 262730 2011-02-20 00:42 _pdq.so

root@icrushservers-desktop:/home/icrushservers/Desktop/pdq/python# set
| grep "PYTHONPATH"
PYTHONPATH=/home/icrushservers/lib/python
------------------>8

But alas, no joy.

I know two things about Python and swig: Diddly and Squat.

Is there anybody else out there that has setup PyDQ under Ubuntu that
could assist me? I've written my routine in python and made some nifty
use of some lambda routines that I don't want to re-write in perl or
R.

Thanks.


James

unread,
Feb 20, 2011, 3:04:43 PM2/20/11
to Guerrilla Capacity Planning
I fired up VirtualBox and installed a non-Debian based distro,
openSUSE, and got everything setup and tried again to install PyDQ and
I was still not successful. I got the same exact issues as detailed in
my original message.

The perl test code worked just fine (after removal of the DOS ^M left
overs) and gave the expected output.

So it doesn't look like this is something that is just limited to PyDQ
and Ubuntu.

James

Phil Feller

unread,
Feb 20, 2011, 3:38:12 PM2/20/11
to guerrilla-cap...@googlegroups.com
Hi James,

I'm running Ubuntu 10.04, and I can duplicate your problem. I'll look into it and see where the problem lies.

Phil



--
You received this message because you are subscribed to the Google Groups "Guerrilla Capacity Planning" group.
To post to this group, send email to guerrilla-cap...@googlegroups.com.
To unsubscribe from this group, send email to guerrilla-capacity-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guerrilla-capacity-planning?hl=en.


Phil Feller

unread,
Feb 20, 2011, 3:49:45 PM2/20/11
to guerrilla-cap...@googlegroups.com
Could you try copying test.py to another directory and executing it from there? The problem seems to be with trying to run it from the python directory under the source-code directory. If I copy it to my home directory I can execute it with no problem. Looking like the build script needs some updating.

On Sun, Feb 20, 2011 at 1:53 AM, James <icrush...@gmail.com> wrote:

James Newsom

unread,
Feb 20, 2011, 6:31:41 PM2/20/11
to guerrilla-cap...@googlegroups.com

Rock on! Thanks.

M. Edward (Ed) Borasky

unread,
Feb 20, 2011, 6:40:20 PM2/20/11
to guerrilla-cap...@googlegroups.com
On Sun, 20 Feb 2011 12:04:43 -0800 (PST), James
<icrush...@gmail.com> wrote:
> I fired up VirtualBox and installed a non-Debian based distro,
> openSUSE, and got everything setup and tried again to install PyDQ
> and
> I was still not successful. I got the same exact issues as detailed
> in
> my original message.
>
> The perl test code worked just fine (after removal of the DOS ^M left
> overs) and gave the expected output.
>
> So it doesn't look like this is something that is just limited to
> PyDQ
> and Ubuntu.
>
> James

I've got openSUSE too - let me see if I can make this work. I'm not a
Python geek, though, so be warned. ;-)

--
http://twitter.com/znmeb http://borasky-research.net

"A mathematician is a device for turning coffee into theorems." -- Paul
Erdős

James Newsom

unread,
Feb 20, 2011, 10:55:57 PM2/20/11
to guerrilla-cap...@googlegroups.com
Bingo! That worked!

I copied from ~/Desktop/pdq/python/test.py to ~ and viola! PDQ report goodness.

Looking on the bright side, I converted my python code to perl and learned how to implement anonymous functions referenced in a hash so it's all good.

Thanks!

James

M. Edward (Ed) Borasky

unread,
Feb 20, 2011, 11:22:47 PM2/20/11
to guerrilla-cap...@googlegroups.com
On Sun, 20 Feb 2011 14:49:45 -0600, Phil Feller <ph...@philfeller.com>
wrote:

> Could you try copying test.py to another directory and executing it
> from there? The problem seems to be with trying to run it from the
> python directory under the source-code directory. If I copy it to my
> home directory I can execute it with no problem. Looking like the
> build script needs some updating.

Copying it to "~" and executing it works just fine on openSUSE!
Meanwhile, if it matters, SWIG is now at version 2.0.2

http://sourceforge.net/news/?group_id=1645&id=297686


>
> On Sun, Feb 20, 2011 at 1:53 AM, James wrote:
> I am trying to get PyDQ up and running under Ubuntu 10.04.
>
> Initially I was having issues with the PyDQ compilation but after
> some
> research found that I needed python-dev to be installed to have all
> the necessary headers for `python setup.py install` to execute.
>

> I have been able to run `make all` and execute the "test.pl [2]"


> under the
> perl5 sub-dir without issue.
>
> Under the python sub-dir I see that the build/lib.linux-i686-2.6 is
> populated with pdq.py and _pdq.so:
>

> 88


>
> If I run `make clean` I can see that the build sub-dir is blown away
> and if I re-execute `build all` the build sub-dir will be populated
> again as noted above.
>
> When I try to execute test.py I get the following output:
>

> 88


>
> I double checked the README.setup file I have copied the libpdq.a to
> /
> usr/local/lib and have also verified that the libpdq.a exists in the
> pdq/lib sub-dir.
>

> 88


>
> I am executing at root so I don't think there will be an issue
> accessing the _pdq.so shared object from under the build/lib.linux-
> i686-2.6 sub-dir. But, just to cover all the bases I did go ahead
> (as
> the README.setup recommended) and create a ~/lib/python sub-dir and
> copied the _pdq.so into the sub-dir and modified my .profile to
> export
> the environment variable for PYTHONPATH:
>

> 88


>
> But alas, no joy.
>
> I know two things about Python and swig: Diddly and Squat.
>
> Is there anybody else out there that has setup PyDQ under Ubuntu
> that
> could assist me? I've written my routine in python and made some
> nifty
> use of some lambda routines that I don't want to re-write in perl or
> R.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Guerrilla Capacity Planning" group.
> To post to this group, send email to

> guerrilla-cap...@googlegroups.com [3].


> To unsubscribe from this group, send email to

> guerrilla-capacity-...@googlegroups.com [4].


> For more options, visit this group at

> http://groups.google.com/group/guerrilla-capacity-planning?hl=en [5].


>
> --
> You received this message because you are subscribed to the Google
> Groups "Guerrilla Capacity Planning" group.
> To post to this group, send email to
> guerrilla-cap...@googlegroups.com.
> To unsubscribe from this group, send email to
> guerrilla-capacity-...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/guerrilla-capacity-planning?hl=en.
>
>

> Links:
> ------
> [1] mailto:icrush...@gmail.com
> [2] http://test.pl
> [3] mailto:guerrilla-cap...@googlegroups.com
> [4] mailto:guerrilla-capacity-planning%2Bunsu...@googlegroups.com
> [5] http://groups.google.com/group/guerrilla-capacity-planning?hl=en

James Newsom

unread,
Feb 20, 2011, 11:30:27 PM2/20/11
to guerrilla-cap...@googlegroups.com
I can now confirm that this works both with Ubuntu 10.04 and openSUSE 11.3 (Oh how I love VirtualBox!)

Would be nice to have the README.setup amended to include that python-dev headers need to be installed for proper compilation.

Thanks again.

James

On Sun, Feb 20, 2011 at 2:49 PM, Phil Feller <ph...@philfeller.com> wrote:

M. Edward (Ed) Borasky

unread,
Feb 21, 2011, 1:48:33 AM2/21/11
to guerrilla-cap...@googlegroups.com
On Sun, 20 Feb 2011 22:30:27 -0600, James Newsom
<icrush...@gmail.com> wrote:
> I can now confirm that this works both with Ubuntu 10.04 and openSUSE
> 11.3 (Oh how I love VirtualBox!)
>
> Would be nice to have the README.setup amended to include that
> python-dev headers need to be installed for proper compilation.

python-devel on openSUSE (and I think Fedora as well) ;-)


>
> Thanks again.
>
> James


>
> On Sun, Feb 20, 2011 at 2:49 PM, Phil Feller wrote:
> Could you try copying test.py to another directory and executing it
> from there? The problem seems to be with trying to run it from the
> python directory under the source-code directory. If I copy it to my
> home directory I can execute it with no problem. Looking like the
> build script needs some updating.
>

> On Sun, Feb 20, 2011 at 1:53 AM, James wrote:
>
> I am trying to get PyDQ up and running under Ubuntu 10.04.
>
> Initially I was having issues with the PyDQ compilation but after
> some
> research found that I needed python-dev to be installed to have all
> the necessary headers for `python setup.py install` to execute.
>

> I have been able to run `make all` and execute the "test.pl [3]"


> under the
> perl5 sub-dir without issue.
>
> Under the python sub-dir I see that the build/lib.linux-i686-2.6 is
> populated with pdq.py and _pdq.so:
>

> 88


>
> If I run `make clean` I can see that the build sub-dir is blown away
> and if I re-execute `build all` the build sub-dir will be populated
> again as noted above.
>
> When I try to execute test.py I get the following output:
>

> 88


>
> I double checked the README.setup file I have copied the libpdq.a to
> /
> usr/local/lib and have also verified that the libpdq.a exists in the
> pdq/lib sub-dir.
>

> 88


>
> I am executing at root so I don't think there will be an issue
> accessing the _pdq.so shared object from under the build/lib.linux-
> i686-2.6 sub-dir. But, just to cover all the bases I did go ahead
> (as
> the README.setup recommended) and create a ~/lib/python sub-dir and
> copied the _pdq.so into the sub-dir and modified my .profile to
> export
> the environment variable for PYTHONPATH:
>

> 88


>
> But alas, no joy.
>
> I know two things about Python and swig: Diddly and Squat.
>
> Is there anybody else out there that has setup PyDQ under Ubuntu
> that
> could assist me? I've written my routine in python and made some
> nifty
> use of some lambda routines that I don't want to re-write in perl or
> R.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Guerrilla Capacity Planning" group.
> To post to this group, send email to

> guerrilla-cap...@googlegroups.com [4].


> To unsubscribe from this group, send email to

> guerrilla-capacity-...@googlegroups.com [5].


> For more options, visit this group at

> http://groups.google.com/group/guerrilla-capacity-planning?hl=en [6].


>
> --
> You received this message because you are subscribed to the Google
> Groups "Guerrilla Capacity Planning" group.
> To post to this group, send email to

> guerrilla-cap...@googlegroups.com [7].


> To unsubscribe from this group, send email to

> guerrilla-capacity-...@googlegroups.com [8].


> For more options, visit this group at

> http://groups.google.com/group/guerrilla-capacity-planning?hl=en [9].


>
> --
> You received this message because you are subscribed to the Google
> Groups "Guerrilla Capacity Planning" group.
> To post to this group, send email to
> guerrilla-cap...@googlegroups.com.
> To unsubscribe from this group, send email to
> guerrilla-capacity-...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/guerrilla-capacity-planning?hl=en.
>
>

> Links:
> ------
> [1] mailto:ph...@philfeller.com
> [2] mailto:icrush...@gmail.com
> [3] http://test.pl
> [4] mailto:guerrilla-cap...@googlegroups.com
> [5] mailto:guerrilla-capacity-planning%2Bunsu...@googlegroups.com
> [6] http://groups.google.com/group/guerrilla-capacity-planning?hl=en
> [7] mailto:guerrilla-cap...@googlegroups.com
> [8] mailto:guerrilla-capacity-planning%2Bunsu...@googlegroups.com
> [9] http://groups.google.com/group/guerrilla-capacity-planning?hl=en

Reply all
Reply to author
Forward
0 new messages