Locating python

D

David Sevilla

Hi,

Apologies if this was answered somewhere else, I have not found
anything similar anywhere.

I have SUSE 11.0 and I am trying to install a program called
mnemosyne. I need easy_install for this, for which I installed
setuptools through yast2. But when I run easy_install for the final
installation, I get an error like this:

[...]
[Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-
packages/test-easy-install-3728.pth'

The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:

/usr/local/lib/python2.5/site-packages/

This directory does not currently exist. [...]

From what I have gathered by reading here and there, it seems that the
actual path for site-packages is not the place where it is being
looked for. Sure enough, I have /usr/local/lib/python2.5/site-
packages/ . What worries me is that there is no file called test*
there, and I am not even able to find the site.py file mentioned in
site-packages/README. I suspect that I have two concurrent
installations or something like that (I do have python and python2.5
inside /usr/lib). How do I untangle this? Or at least how do I get
easy_install to find the right place?

Thanks a lot,

David
 
M

Mike Driscoll

Hi,

Apologies if this was answered somewhere else, I have not found
anything similar anywhere.

I have SUSE 11.0 and I am trying to install a program called
mnemosyne. I need easy_install for this, for which I installed
setuptools through yast2. But when I run easy_install for the final
installation, I get an error like this:

[...]
[Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-
packages/test-easy-install-3728.pth'

The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:

    /usr/local/lib/python2.5/site-packages/

This directory does not currently exist. [...]

From what I have gathered by reading here and there, it seems that the
actual path for site-packages is not the place where it is being
looked for. Sure enough, I have /usr/local/lib/python2.5/site-
packages/ . What worries me is that there is no file called test*
there, and I am not even able to find the site.py file mentioned in
site-packages/README. I suspect that I have two concurrent
installations or something like that (I do have python and python2.5
inside /usr/lib). How do I untangle this? Or at least how do I get
easy_install to find the right place?

Thanks a lot,

David

I would get setuptools from the official source:

http://peak.telecommunity.com/DevCenter/setuptools
http://pypi.python.org/pypi/setuptools

Install it using the python of your choice. You may have to pass a
full path to the python "binary" to make sure you're using the right
one. So, after downloading and decompressing the setuptools package,
change directory into it. Then run something like this:

/path/to/python setup.py install

I think that will work...of course, your mileage may vary. I haven't
used SUSE. Doesn't SUSE have a package manager like Ubuntu's apt-get?
You might be able to just use that too..

Mike
 
A

andrew cooke

the exact details of what you are reporting seem a bit odd, but i have
seen a similar error because i have tried to use my own account to
install the package, instead of using root.

what i believe happens is that easy_install first tries to create the
"test" file, and then checks it is there. if it is not there, you get
an error. normally the error explains that you need to run as root,
but i assume in your case it doesn't - that seems odd, but it seemed
worth mentioning anyway.

so if you have not done so, instead of

python setup.py install

do

sudo python setup.py install

more generally, i have used opensuse 11.0 and 11.1, and generally
things work just fine, so i would check you are following all the
instructions correctly.

good luck,
andrew
 
D

David Sevilla

Apologies if this was answered somewhere else, I have not found
anything similar anywhere.
I have SUSE 11.0 and I am trying to install a program called
mnemosyne. I need easy_install for this, for which I installed
setuptools through yast2. But when I run easy_install for the final
installation, I get an error like this:
[...]
[Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-
packages/test-easy-install-3728.pth'
The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:
    /usr/local/lib/python2.5/site-packages/
This directory does not currently exist. [...]
From what I have gathered by reading here and there, it seems that the
actual path for site-packages is not the place where it is being
looked for. Sure enough, I have /usr/local/lib/python2.5/site-
packages/ . What worries me is that there is no file called test*
there, and I am not even able to find the site.py file mentioned in
site-packages/README. I suspect that I have two concurrent
installations or something like that (I do have python and python2.5
inside /usr/lib). How do I untangle this? Or at least how do I get
easy_install to find the right place?
Thanks a lot,

I would get setuptools from the official source:

http://peak.telecommunity.com/DevCenter/setuptoolshttp://pypi.python.org/pypi/setuptools

Install it using the python of your choice. You may have to pass a
full path to the python "binary" to make sure you're using the right
one. So, after downloading and decompressing the setuptools package,
change directory into it. Then run something like this:

/path/to/python setup.py install

I think that will work...of course, your mileage may vary. I haven't
used SUSE. Doesn't SUSE have a package manager like Ubuntu's apt-get?
You might be able to just use that too..

Mike

Actually, a manual installation is probably the best thing to do,
since I did use the SUSE package manager (yast2) to install setuptools
and never had a chance to choose installation paths.

Thanks,

David
 
D

David Sevilla

the exact details of what you are reporting seem a bit odd, but i have
seen a similar error because i have tried to use my own account to
install the package, instead of using root.

what i believe happens is that easy_install first tries to create the
"test" file, and then checks it is there.  if it is not there, you get
an error.  normally the error explains that you need to run as root,
but i assume in your case it doesn't - that seems odd, but it seemed
worth mentioning anyway.

so if you have not done so, instead of

  python setup.py install

do

  sudo python setup.py install

more generally, i have used opensuse 11.0 and 11.1, and generally
things work just fine, so i would check you are following all the
instructions correctly.

good luck,
andrew

[...]
[Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-
packages/test-easy-install-3728.pth'
The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:
    /usr/local/lib/python2.5/site-packages/
This directory does not currently exist. [...]
From what I have gathered by reading here and there, it seems that the
actual path for site-packages is not the place where it is being
looked for. Sure enough, I have /usr/local/lib/python2.5/site-
packages/ . What worries me is that there is no file called test*

I am quite new to Linux, and thought that by using yast2 there would
be no user problems (I am asked for the root password). I will sudo it
to see if it solves the problem.

Thanks,

David
 
A

andrew cooke

sorry, you are using easy_install, so

sudo easy_install ....

instead of what i said a moment ago. the important thing is to use
"sudo".

andrew

the exact details of what you are reporting seem a bit odd, but i have
seen a similar error because i have tried to use my own account to
install the package, instead of using root.

what i believe happens is that easy_install first tries to create the
"test" file, and then checks it is there.  if it is not there, you get
an error.  normally the error explains that you need to run as root,
but i assume in your case it doesn't - that seems odd, but it seemed
worth mentioning anyway.

so if you have not done so, instead of

  python setup.py install

do

  sudo python setup.py install

more generally, i have used opensuse 11.0 and 11.1, and generally
things work just fine, so i would check you are following all the
instructions correctly.

good luck,
andrew

[...]
[Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-
packages/test-easy-install-3728.pth'
The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:
    /usr/local/lib/python2.5/site-packages/
This directory does not currently exist. [...]
From what I have gathered by reading here and there, it seems that the
actual path for site-packages is not the place where it is being
looked for. Sure enough, I have /usr/local/lib/python2.5/site-
packages/ . What worries me is that there is no file called test*
 
S

Steve Holden

Mike said:
Hi,

Apologies if this was answered somewhere else, I have not found
anything similar anywhere.

I have SUSE 11.0 and I am trying to install a program called
mnemosyne. I need easy_install for this, for which I installed
setuptools through yast2. But when I run easy_install for the final
installation, I get an error like this:

[...]
[Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-
packages/test-easy-install-3728.pth'

The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:

/usr/local/lib/python2.5/site-packages/

This directory does not currently exist. [...]

From what I have gathered by reading here and there, it seems that the
actual path for site-packages is not the place where it is being
looked for. Sure enough, I have /usr/local/lib/python2.5/site-
packages/ . What worries me is that there is no file called test*
there, and I am not even able to find the site.py file mentioned in
site-packages/README. I suspect that I have two concurrent
installations or something like that (I do have python and python2.5
inside /usr/lib). How do I untangle this? Or at least how do I get
easy_install to find the right place?

Thanks a lot,

David

I would get setuptools from the official source:

http://peak.telecommunity.com/DevCenter/setuptools
http://pypi.python.org/pypi/setuptools

Install it using the python of your choice. You may have to pass a
full path to the python "binary" to make sure you're using the right
one. So, after downloading and decompressing the setuptools package,
change directory into it. Then run something like this:

/path/to/python setup.py install

I think that will work...of course, your mileage may vary. I haven't
used SUSE. Doesn't SUSE have a package manager like Ubuntu's apt-get?
You might be able to just use that too..

Easier still:

wget http://peak.telecommunity.com/dist/ez_setup.py
/path/to/python ez_setup.py
rm ez_setup.py

regards
Steve
 
A

andrew cooke

I am quite new to Linux, and thought that by using yast2 there would
be no user problems (I am asked for the root password). I will sudo it
to see if it solves the problem.

yast asked you for the password so that easy_install could be
installed correctly.

you are now using "sudo easy_install" to install mnemosyne and sudo is
asking for the root password.

each time you install something you need to change public files on the
system, and so each time you need to use root in some way. yast does
this by logging in as root for you, but needs the password to do it.
sudo does the same thing, but again needs the password to do it.

hope that makes senses (and that this worked).

andrew
 
N

Noam Aigerman

Hi All,
I have a script in which I receive a list of functions. I iterate over
the list and run each function. This functions are created by some other
user who is using the lib I wrote. Now, there are some cases in which
the function I receive will never finish (stuck in infinite loop).
Suppose I use a thread which times the amount of time passed since the
function has started, Is there some way I can kill the function after a
certain amount of time has passed (without asking the user who's giving
me the list of functions to make them all have some way of notifying
them to finish)?
Thanks, Noam
 
A

andrew cooke

argh, sorry for the confusion.

actually, no. sudo requires the root password. at least on opensuse
11.1 default config. i just tried it:
Python-2.5.4: sudo make install
root's password:

this is explained in the sudoers file:

# In the default (unconfigured) configuration, sudo asks for the root
password.
# This allows use of an ordinary user account for administration of a
freshly
# installed system. When configuring sudo, delete the two
# following lines:
Defaults targetpw # ask for the password of the target user i.e.
root
ALL ALL=(ALL) ALL # WARNING! Only use this together with
'Defaults targetpw'!

andrew
 
A

Albert Hopkins

Hi All,
I have a script in which I receive a list of functions. I iterate over
the list and run each function. This functions are created by some other
user who is using the lib I wrote. Now, there are some cases in which
the function I receive will never finish (stuck in infinite loop).
Suppose I use a thread which times the amount of time passed since the
function has started, Is there some way I can kill the function after a
certain amount of time has passed (without asking the user who's giving
me the list of functions to make them all have some way of notifying
them to finish)?
Thanks, Noam

Noam, did you hijack a thread?

You could decorate the functions with a timeout function. Here's one
that I either wrote or copied from a recipe (can't recall):

class FunctionTimeOut(Exception):
pass

def function_timeout(seconds):
"""Function decorator to raise a timeout on a function call"""
import signal

def decorate(f):
def timeout(signum, frame):
raise FunctionTimeOut()

def funct(*args, **kwargs):
old = signal.signal(signal.SIGALRM, timeout)
signal.alarm(seconds)

try:
result = f(*args, **kwargs)
finally:
signal.signal(signal.SIGALRM, old)
signal.alarm(0)
return result

return funct

return decorate


Then

func_dec = function_timeout(TIMEOUT_SECS)
for func in function_list:
timeout_function = func_dec(func)
try:
timeout_function(...)
except FunctionTimeout:
...


-a
 
N

Noam Aigerman

About the hijacking - I *might* have done it without understanding what
I did (replied to a previous message and then changed the subject), if
that's what you mean...
Sorry

-----Original Message-----
From: [email protected]
[mailto:p[email protected]] On Behalf Of
Albert Hopkins
Sent: Wednesday, February 04, 2009 5:26 PM
To: (e-mail address removed)
Subject: Re: Kill a function while it's being executed

Hi All,
I have a script in which I receive a list of functions. I iterate over
the list and run each function. This functions are created by some other
user who is using the lib I wrote. Now, there are some cases in which
the function I receive will never finish (stuck in infinite loop).
Suppose I use a thread which times the amount of time passed since the
function has started, Is there some way I can kill the function after a
certain amount of time has passed (without asking the user who's giving
me the list of functions to make them all have some way of notifying
them to finish)?
Thanks, Noam

Noam, did you hijack a thread?

You could decorate the functions with a timeout function. Here's one
that I either wrote or copied from a recipe (can't recall):

class FunctionTimeOut(Exception):
pass

def function_timeout(seconds):
"""Function decorator to raise a timeout on a function call"""
import signal

def decorate(f):
def timeout(signum, frame):
raise FunctionTimeOut()

def funct(*args, **kwargs):
old = signal.signal(signal.SIGALRM, timeout)
signal.alarm(seconds)

try:
result = f(*args, **kwargs)
finally:
signal.signal(signal.SIGALRM, old)
signal.alarm(0)
return result

return funct

return decorate


Then

func_dec = function_timeout(TIMEOUT_SECS)
for func in function_list:
timeout_function = func_dec(func)
try:
timeout_function(...)
except FunctionTimeout:
...


-a
 
S

Steve Holden

Noam said:
About the hijacking - I *might* have done it without understanding what
I did (replied to a previous message and then changed the subject), if
that's what you mean...
Sorry

That's what he meant. A lot of news reading and email software uses
In-Reply-To and various other message headers to determine how messages
are threaded, so (for example) in my Thunderbird Window this appears to
be a part of the thread that started out as "Locating Python".

regards
Steve
 
D

David Sevilla

Well, finally it worked. I even uninstalled python and all related
stuff with yast2, installed it all again, then

wget http://peak.telecommunity.com/dist/ez_setup.py
su
/path/to/python ez_setup.py

and I got the same error: a certain file could not be created, and

/usr/local/lib/python2.5/site-packages/

does not exist. Well, I just created them manually (/usr/local/lib was
empty) and it worked.

When I tried to use easy_install for mnemosyne, I got the same error
_but_ this time I was told about running as root (I did it from
another terminal). Now I got it installed (still not working,
something called qt) but the python installation problem is solved.
Thank you very much to all those who contributed.

Regards,

David
 
N

Noam Aigerman

Hi,
Sorry for resurrecting an old thread, but it just bothers me that this
is the best way that python has to deal with killing running
functions... it's quite an ugly hack, no?

Is it a feature that's needed bit missing from python, or is it left out
on purpose (same way like java has deprecated thread.stop and
thread.suspend because they were not safe)?

Thanks, Noam



-----Original Message-----
From: [email protected]
[mailto:p[email protected]] On Behalf Of
Albert Hopkins
Sent: Wednesday, February 04, 2009 5:26 PM
To: (e-mail address removed)
Subject: Re: Kill a function while it's being executed

Hi All,
I have a script in which I receive a list of functions. I iterate over
the list and run each function. This functions are created by some other
user who is using the lib I wrote. Now, there are some cases in which
the function I receive will never finish (stuck in infinite loop).
Suppose I use a thread which times the amount of time passed since the
function has started, Is there some way I can kill the function after a
certain amount of time has passed (without asking the user who's giving
me the list of functions to make them all have some way of notifying
them to finish)?
Thanks, Noam

Noam, did you hijack a thread?

You could decorate the functions with a timeout function. Here's one
that I either wrote or copied from a recipe (can't recall):

class FunctionTimeOut(Exception):
pass

def function_timeout(seconds):
"""Function decorator to raise a timeout on a function call"""
import signal

def decorate(f):
def timeout(signum, frame):
raise FunctionTimeOut()

def funct(*args, **kwargs):
old = signal.signal(signal.SIGALRM, timeout)
signal.alarm(seconds)

try:
result = f(*args, **kwargs)
finally:
signal.signal(signal.SIGALRM, old)
signal.alarm(0)
return result

return funct

return decorate


Then

func_dec = function_timeout(TIMEOUT_SECS)
for func in function_list:
timeout_function = func_dec(func)
try:
timeout_function(...)
except FunctionTimeout:
...


-a
 
R

Robert Kern

Hi,
Sorry for resurrecting an old thread, but it just bothers me that this
is the best way that python has to deal with killing running
functions... it's quite an ugly hack, no?

Is it a feature that's needed bit missing from python, or is it left out
on purpose (same way like java has deprecated thread.stop and
thread.suspend because they were not safe)?

Left out on purpose because it is not safe.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,298
Messages
2,571,539
Members
48,273
Latest member
latemarriage

Latest Threads

Top