Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-06 Thread Matthew Brett
Hi,

On Thu, Oct 4, 2012 at 10:29 AM, Matthew Brett matthew.br...@gmail.com wrote:
 Hi,

 On Thu, Oct 4, 2012 at 7:35 AM, Ralf Gommers ralf.gomm...@gmail.com wrote:


 On Thu, Oct 4, 2012 at 12:14 AM, Matthew Brett matthew.br...@gmail.com
 wrote:

 Hi,

 On Wed, Oct 3, 2012 at 10:51 PM, Ralf Gommers ralf.gomm...@gmail.com
 wrote:
 
 
  On Wed, Oct 3, 2012 at 11:29 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
 
  Hi,
 
  On Wed, Oct 3, 2012 at 10:17 PM, Ralf Gommers ralf.gomm...@gmail.com
  wrote:
  
  
   On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett
   matthew.br...@gmail.com
   wrote:
  
   Hi,
  
   On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett
   matthew.br...@gmail.com
   wrote:
Hi,
   
One of our kind users pointed out an error when using easy_install
to
install our package nipy.   I've reproduced it now on a bare
package
using numpy distutils and having a trivial extension:
   
https://github.com/matthew-brett/apkg
   
To reproduce:
   
git clone git://github.com/mathew-brett/apkg.git
   
easy_install apkg
   
You should get something like this:
   
Processing apkg
Running setup.py -q bdist_egg --dist-dir
/home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
Appending apkg configuration to
Ignoring attempt to set 'name' (from '' to 'apkg')
zip_safe flag not set; analyzing archive contents...
Adding apkg 0.1 to easy-install.pth file
   
Installed
   
   
/home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
Processing dependencies for apkg==0.1
Finished processing dependencies for apkg==0.1
   
   
   
/home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
RuntimeWarning: Parent module 'numpy.distutils' not found while
handling absolute import
  from numpy.distutils import log
   
Note the last error.
  
   Sorry, correcting myself - it's (obviously) a Warning rather than an
   error, but still distracting, and it would be good to avoid it if
   possible...
  
  
   The combination of two or all of atexit.register, easy_install and
   virtualenv seems to be causing this. Unless someone feels like
   digging
   into
   that (I certainly don't), there are two easy solutions:
   1. Silence the warning.
 
  Sorry - I am not sure what you mean.  The problem here is the user who
  assumes that something bad happened when running easy_install - which
  is what happened in the case of nipy.  Is there some way of silencing
  this (specific) warning from within setup.py?
 
   2. Remove the offending import and the logging. This will only remove
   the
   line removing: _configtest.c _configtest.o from the build log
   (x20).
 
  Which import did you mean?  I think I need all the imports I'm using
  in the example minimal package.  I'm not explicitly importing logging
  for example.
 
 
  The import that's indicated in the warning, on line 252 of
  numpy/distutils/misc_util.py. Relevant code:
 
  _temporary_directory = None
  def clean_up_temporary_directory():
  from numpy.distutils import log# CAUSES RUNTIME WARNING
  global _temporary_directory
  if not _temporary_directory:
  return
  log.debug('removing %s', _temporary_directory)
  try:
  shutil.rmtree(_temporary_directory)
  except OSError:
  pass
  _temporary_directory = None
 
  def make_temp_file(suffix='', prefix='', text=True):
  global _temporary_directory
  if not _temporary_directory:
  _temporary_directory = tempfile.mkdtemp()
  atexit.register(clean_up_temporary_directory)

 Sorry - I still don't understand.  You mean I should (in my package -
 say nipy or 'apkg') monkey-patch numpy distutils.misc_util ?


 No, I was proposing to fix this in numpy.distutils.misc_util directly. Sorry
 for not being clear.



 Another option would be to move the import outside the callback function
 thus:


 Should work too I guess, but since I don't understand why the import is
 where it is now I'm not 100% sure. Removing the import on line 252 and the
 log.debug call would be the safest fix.

 The import is in the function because the following outside the
 function (at the top of misc_util):

 from numpy.distutils import log

 leads to the following on `python setup.py install`:

 Running from numpy source directory.
 Traceback (most recent call last):
   File setup.py, line 214, in module
 setup_package()
   File setup.py, line 191, in setup_package
 from numpy.distutils.core import setup
   File /home/mb312/dev_trees/numpy/numpy/distutils/__init__.py, line
 7, in module
 import ccompiler
   File /home/mb312/dev_trees/numpy/numpy/distutils/ccompiler.py,
 line 14, in module
 from numpy.distutils import log
   File /home/mb312/dev_trees/numpy/numpy/distutils/log.py, line 9, in 
 module
 from misc_util import red_text, default_text, cyan_text,
 green_text, is_sequence, is_string
   File 

Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-04 Thread Ralf Gommers
On Thu, Oct 4, 2012 at 12:14 AM, Matthew Brett matthew.br...@gmail.comwrote:

 Hi,

 On Wed, Oct 3, 2012 at 10:51 PM, Ralf Gommers ralf.gomm...@gmail.com
 wrote:
 
 
  On Wed, Oct 3, 2012 at 11:29 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
 
  Hi,
 
  On Wed, Oct 3, 2012 at 10:17 PM, Ralf Gommers ralf.gomm...@gmail.com
  wrote:
  
  
   On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett 
 matthew.br...@gmail.com
   wrote:
  
   Hi,
  
   On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett 
 matthew.br...@gmail.com
   wrote:
Hi,
   
One of our kind users pointed out an error when using easy_install
 to
install our package nipy.   I've reproduced it now on a bare
 package
using numpy distutils and having a trivial extension:
   
https://github.com/matthew-brett/apkg
   
To reproduce:
   
git clone git://github.com/mathew-brett/apkg.git
   
easy_install apkg
   
You should get something like this:
   
Processing apkg
Running setup.py -q bdist_egg --dist-dir
/home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
Appending apkg configuration to
Ignoring attempt to set 'name' (from '' to 'apkg')
zip_safe flag not set; analyzing archive contents...
Adding apkg 0.1 to easy-install.pth file
   
Installed
   
   
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
Processing dependencies for apkg==0.1
Finished processing dependencies for apkg==0.1
   
   
   
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
RuntimeWarning: Parent module 'numpy.distutils' not found while
handling absolute import
  from numpy.distutils import log
   
Note the last error.
  
   Sorry, correcting myself - it's (obviously) a Warning rather than an
   error, but still distracting, and it would be good to avoid it if
   possible...
  
  
   The combination of two or all of atexit.register, easy_install and
   virtualenv seems to be causing this. Unless someone feels like digging
   into
   that (I certainly don't), there are two easy solutions:
   1. Silence the warning.
 
  Sorry - I am not sure what you mean.  The problem here is the user who
  assumes that something bad happened when running easy_install - which
  is what happened in the case of nipy.  Is there some way of silencing
  this (specific) warning from within setup.py?
 
   2. Remove the offending import and the logging. This will only remove
   the
   line removing: _configtest.c _configtest.o from the build log (x20).
 
  Which import did you mean?  I think I need all the imports I'm using
  in the example minimal package.  I'm not explicitly importing logging
  for example.
 
 
  The import that's indicated in the warning, on line 252 of
  numpy/distutils/misc_util.py. Relevant code:
 
  _temporary_directory = None
  def clean_up_temporary_directory():
  from numpy.distutils import log# CAUSES RUNTIME WARNING
  global _temporary_directory
  if not _temporary_directory:
  return
  log.debug('removing %s', _temporary_directory)
  try:
  shutil.rmtree(_temporary_directory)
  except OSError:
  pass
  _temporary_directory = None
 
  def make_temp_file(suffix='', prefix='', text=True):
  global _temporary_directory
  if not _temporary_directory:
  _temporary_directory = tempfile.mkdtemp()
  atexit.register(clean_up_temporary_directory)

 Sorry - I still don't understand.  You mean I should (in my package -
 say nipy or 'apkg') monkey-patch numpy distutils.misc_util ?


No, I was proposing to fix this in numpy.distutils.misc_util directly.
Sorry for not being clear.



 Another option would be to move the import outside the callback function
 thus:


Should work too I guess, but since I don't understand why the import is
where it is now I'm not 100% sure. Removing the import on line 252 and the
log.debug call would be the safest fix.

Ralf


 diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
 index 2e4ed27..e00d924 100644
 --- a/numpy/distutils/misc_util.py
 +++ b/numpy/distutils/misc_util.py
 @@ -18,6 +18,7 @@ except NameError:
  from sets import Set as set

  from numpy.distutils.compat import get_exception
 +from numpy.distutils.log import debug as log_debug

  __all__ = ['Configuration', 'get_numpy_include_dirs',
 'default_config_dict',
 'dict_append', 'appendpath', 'generate_config_py',
 @@ -249,11 +250,10 @@ def gpaths(paths, local_path='',
 include_non_existing=True):

  _temporary_directory = None
  def clean_up_temporary_directory():
 -from numpy.distutils import log
  global _temporary_directory
  if not _temporary_directory:
  return
 -log.debug('removing %s', _temporary_directory)
 +log_debug('removing %s', _temporary_directory)
  try:
  shutil.rmtree(_temporary_directory)
  except OSError:


 Do you happen to know if that will break anything?  

Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-04 Thread Matthew Brett
Hi,

On Thu, Oct 4, 2012 at 7:35 AM, Ralf Gommers ralf.gomm...@gmail.com wrote:


 On Thu, Oct 4, 2012 at 12:14 AM, Matthew Brett matthew.br...@gmail.com
 wrote:

 Hi,

 On Wed, Oct 3, 2012 at 10:51 PM, Ralf Gommers ralf.gomm...@gmail.com
 wrote:
 
 
  On Wed, Oct 3, 2012 at 11:29 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
 
  Hi,
 
  On Wed, Oct 3, 2012 at 10:17 PM, Ralf Gommers ralf.gomm...@gmail.com
  wrote:
  
  
   On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett
   matthew.br...@gmail.com
   wrote:
  
   Hi,
  
   On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett
   matthew.br...@gmail.com
   wrote:
Hi,
   
One of our kind users pointed out an error when using easy_install
to
install our package nipy.   I've reproduced it now on a bare
package
using numpy distutils and having a trivial extension:
   
https://github.com/matthew-brett/apkg
   
To reproduce:
   
git clone git://github.com/mathew-brett/apkg.git
   
easy_install apkg
   
You should get something like this:
   
Processing apkg
Running setup.py -q bdist_egg --dist-dir
/home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
Appending apkg configuration to
Ignoring attempt to set 'name' (from '' to 'apkg')
zip_safe flag not set; analyzing archive contents...
Adding apkg 0.1 to easy-install.pth file
   
Installed
   
   
/home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
Processing dependencies for apkg==0.1
Finished processing dependencies for apkg==0.1
   
   
   
/home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
RuntimeWarning: Parent module 'numpy.distutils' not found while
handling absolute import
  from numpy.distutils import log
   
Note the last error.
  
   Sorry, correcting myself - it's (obviously) a Warning rather than an
   error, but still distracting, and it would be good to avoid it if
   possible...
  
  
   The combination of two or all of atexit.register, easy_install and
   virtualenv seems to be causing this. Unless someone feels like
   digging
   into
   that (I certainly don't), there are two easy solutions:
   1. Silence the warning.
 
  Sorry - I am not sure what you mean.  The problem here is the user who
  assumes that something bad happened when running easy_install - which
  is what happened in the case of nipy.  Is there some way of silencing
  this (specific) warning from within setup.py?
 
   2. Remove the offending import and the logging. This will only remove
   the
   line removing: _configtest.c _configtest.o from the build log
   (x20).
 
  Which import did you mean?  I think I need all the imports I'm using
  in the example minimal package.  I'm not explicitly importing logging
  for example.
 
 
  The import that's indicated in the warning, on line 252 of
  numpy/distutils/misc_util.py. Relevant code:
 
  _temporary_directory = None
  def clean_up_temporary_directory():
  from numpy.distutils import log# CAUSES RUNTIME WARNING
  global _temporary_directory
  if not _temporary_directory:
  return
  log.debug('removing %s', _temporary_directory)
  try:
  shutil.rmtree(_temporary_directory)
  except OSError:
  pass
  _temporary_directory = None
 
  def make_temp_file(suffix='', prefix='', text=True):
  global _temporary_directory
  if not _temporary_directory:
  _temporary_directory = tempfile.mkdtemp()
  atexit.register(clean_up_temporary_directory)

 Sorry - I still don't understand.  You mean I should (in my package -
 say nipy or 'apkg') monkey-patch numpy distutils.misc_util ?


 No, I was proposing to fix this in numpy.distutils.misc_util directly. Sorry
 for not being clear.



 Another option would be to move the import outside the callback function
 thus:


 Should work too I guess, but since I don't understand why the import is
 where it is now I'm not 100% sure. Removing the import on line 252 and the
 log.debug call would be the safest fix.

The import is in the function because the following outside the
function (at the top of misc_util):

from numpy.distutils import log

leads to the following on `python setup.py install`:

Running from numpy source directory.
Traceback (most recent call last):
  File setup.py, line 214, in module
setup_package()
  File setup.py, line 191, in setup_package
from numpy.distutils.core import setup
  File /home/mb312/dev_trees/numpy/numpy/distutils/__init__.py, line
7, in module
import ccompiler
  File /home/mb312/dev_trees/numpy/numpy/distutils/ccompiler.py,
line 14, in module
from numpy.distutils import log
  File /home/mb312/dev_trees/numpy/numpy/distutils/log.py, line 9, in module
from misc_util import red_text, default_text, cyan_text,
green_text, is_sequence, is_string
  File /home/mb312/dev_trees/numpy/numpy/distutils/misc_util.py,
line 21, in module
from numpy.distutils 

Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-03 Thread Ralf Gommers
On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett matthew.br...@gmail.comwrote:

 Hi,

 On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett matthew.br...@gmail.com
 wrote:
  Hi,
 
  One of our kind users pointed out an error when using easy_install to
  install our package nipy.   I've reproduced it now on a bare package
  using numpy distutils and having a trivial extension:
 
  https://github.com/matthew-brett/apkg
 
  To reproduce:
 
  git clone git://github.com/mathew-brett/apkg.git
 
  easy_install apkg
 
  You should get something like this:
 
  Processing apkg
  Running setup.py -q bdist_egg --dist-dir
  /home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
  Appending apkg configuration to
  Ignoring attempt to set 'name' (from '' to 'apkg')
  zip_safe flag not set; analyzing archive contents...
  Adding apkg 0.1 to easy-install.pth file
 
  Installed
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
  Processing dependencies for apkg==0.1
  Finished processing dependencies for apkg==0.1
 
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
  RuntimeWarning: Parent module 'numpy.distutils' not found while
  handling absolute import
from numpy.distutils import log
 
  Note the last error.

 Sorry, correcting myself - it's (obviously) a Warning rather than an
 error, but still distracting, and it would be good to avoid it if
 possible...


The combination of two or all of atexit.register, easy_install and
virtualenv seems to be causing this. Unless someone feels like digging into
that (I certainly don't), there are two easy solutions:
1. Silence the warning.
2. Remove the offending import and the logging. This will only remove the
line removing: _configtest.c _configtest.o from the build log (x20).

Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-03 Thread Matthew Brett
Hi,

On Wed, Oct 3, 2012 at 10:17 PM, Ralf Gommers ralf.gomm...@gmail.com wrote:


 On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett matthew.br...@gmail.com
 wrote:

 Hi,

 On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett matthew.br...@gmail.com
 wrote:
  Hi,
 
  One of our kind users pointed out an error when using easy_install to
  install our package nipy.   I've reproduced it now on a bare package
  using numpy distutils and having a trivial extension:
 
  https://github.com/matthew-brett/apkg
 
  To reproduce:
 
  git clone git://github.com/mathew-brett/apkg.git
 
  easy_install apkg
 
  You should get something like this:
 
  Processing apkg
  Running setup.py -q bdist_egg --dist-dir
  /home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
  Appending apkg configuration to
  Ignoring attempt to set 'name' (from '' to 'apkg')
  zip_safe flag not set; analyzing archive contents...
  Adding apkg 0.1 to easy-install.pth file
 
  Installed
  /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
  Processing dependencies for apkg==0.1
  Finished processing dependencies for apkg==0.1
 
  /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
  RuntimeWarning: Parent module 'numpy.distutils' not found while
  handling absolute import
from numpy.distutils import log
 
  Note the last error.

 Sorry, correcting myself - it's (obviously) a Warning rather than an
 error, but still distracting, and it would be good to avoid it if
 possible...


 The combination of two or all of atexit.register, easy_install and
 virtualenv seems to be causing this. Unless someone feels like digging into
 that (I certainly don't), there are two easy solutions:
 1. Silence the warning.

Sorry - I am not sure what you mean.  The problem here is the user who
assumes that something bad happened when running easy_install - which
is what happened in the case of nipy.  Is there some way of silencing
this (specific) warning from within setup.py?

 2. Remove the offending import and the logging. This will only remove the
 line removing: _configtest.c _configtest.o from the build log (x20).

Which import did you mean?  I think I need all the imports I'm using
in the example minimal package.  I'm not explicitly importing logging
for example.

Thanks for looking into it...

Cheers,

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-03 Thread Ralf Gommers
On Wed, Oct 3, 2012 at 11:29 PM, Matthew Brett matthew.br...@gmail.comwrote:

 Hi,

 On Wed, Oct 3, 2012 at 10:17 PM, Ralf Gommers ralf.gomm...@gmail.com
 wrote:
 
 
  On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
 
  Hi,
 
  On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
   Hi,
  
   One of our kind users pointed out an error when using easy_install to
   install our package nipy.   I've reproduced it now on a bare package
   using numpy distutils and having a trivial extension:
  
   https://github.com/matthew-brett/apkg
  
   To reproduce:
  
   git clone git://github.com/mathew-brett/apkg.git
  
   easy_install apkg
  
   You should get something like this:
  
   Processing apkg
   Running setup.py -q bdist_egg --dist-dir
   /home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
   Appending apkg configuration to
   Ignoring attempt to set 'name' (from '' to 'apkg')
   zip_safe flag not set; analyzing archive contents...
   Adding apkg 0.1 to easy-install.pth file
  
   Installed
  
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
   Processing dependencies for apkg==0.1
   Finished processing dependencies for apkg==0.1
  
  
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
   RuntimeWarning: Parent module 'numpy.distutils' not found while
   handling absolute import
 from numpy.distutils import log
  
   Note the last error.
 
  Sorry, correcting myself - it's (obviously) a Warning rather than an
  error, but still distracting, and it would be good to avoid it if
  possible...
 
 
  The combination of two or all of atexit.register, easy_install and
  virtualenv seems to be causing this. Unless someone feels like digging
 into
  that (I certainly don't), there are two easy solutions:
  1. Silence the warning.

 Sorry - I am not sure what you mean.  The problem here is the user who
 assumes that something bad happened when running easy_install - which
 is what happened in the case of nipy.  Is there some way of silencing
 this (specific) warning from within setup.py?

  2. Remove the offending import and the logging. This will only remove the
  line removing: _configtest.c _configtest.o from the build log (x20).

 Which import did you mean?  I think I need all the imports I'm using
 in the example minimal package.  I'm not explicitly importing logging
 for example.


The import that's indicated in the warning, on line 252 of
numpy/distutils/misc_util.py. Relevant code:

_temporary_directory = None
def clean_up_temporary_directory():
from numpy.distutils import log# CAUSES RUNTIME WARNING
global _temporary_directory
if not _temporary_directory:
return
log.debug('removing %s', _temporary_directory)
try:
shutil.rmtree(_temporary_directory)
except OSError:
pass
_temporary_directory = None

def make_temp_file(suffix='', prefix='', text=True):
global _temporary_directory
if not _temporary_directory:
_temporary_directory = tempfile.mkdtemp()
atexit.register(clean_up_temporary_directory)

Ralf



 Thanks for looking into it...

 Cheers,

 Matthew
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-03 Thread Matthew Brett
Hi,

On Wed, Oct 3, 2012 at 10:51 PM, Ralf Gommers ralf.gomm...@gmail.com wrote:


 On Wed, Oct 3, 2012 at 11:29 PM, Matthew Brett matthew.br...@gmail.com
 wrote:

 Hi,

 On Wed, Oct 3, 2012 at 10:17 PM, Ralf Gommers ralf.gomm...@gmail.com
 wrote:
 
 
  On Mon, Oct 1, 2012 at 10:47 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
 
  Hi,
 
  On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett matthew.br...@gmail.com
  wrote:
   Hi,
  
   One of our kind users pointed out an error when using easy_install to
   install our package nipy.   I've reproduced it now on a bare package
   using numpy distutils and having a trivial extension:
  
   https://github.com/matthew-brett/apkg
  
   To reproduce:
  
   git clone git://github.com/mathew-brett/apkg.git
  
   easy_install apkg
  
   You should get something like this:
  
   Processing apkg
   Running setup.py -q bdist_egg --dist-dir
   /home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
   Appending apkg configuration to
   Ignoring attempt to set 'name' (from '' to 'apkg')
   zip_safe flag not set; analyzing archive contents...
   Adding apkg 0.1 to easy-install.pth file
  
   Installed
  
   /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
   Processing dependencies for apkg==0.1
   Finished processing dependencies for apkg==0.1
  
  
   /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
   RuntimeWarning: Parent module 'numpy.distutils' not found while
   handling absolute import
 from numpy.distutils import log
  
   Note the last error.
 
  Sorry, correcting myself - it's (obviously) a Warning rather than an
  error, but still distracting, and it would be good to avoid it if
  possible...
 
 
  The combination of two or all of atexit.register, easy_install and
  virtualenv seems to be causing this. Unless someone feels like digging
  into
  that (I certainly don't), there are two easy solutions:
  1. Silence the warning.

 Sorry - I am not sure what you mean.  The problem here is the user who
 assumes that something bad happened when running easy_install - which
 is what happened in the case of nipy.  Is there some way of silencing
 this (specific) warning from within setup.py?

  2. Remove the offending import and the logging. This will only remove
  the
  line removing: _configtest.c _configtest.o from the build log (x20).

 Which import did you mean?  I think I need all the imports I'm using
 in the example minimal package.  I'm not explicitly importing logging
 for example.


 The import that's indicated in the warning, on line 252 of
 numpy/distutils/misc_util.py. Relevant code:

 _temporary_directory = None
 def clean_up_temporary_directory():
 from numpy.distutils import log# CAUSES RUNTIME WARNING
 global _temporary_directory
 if not _temporary_directory:
 return
 log.debug('removing %s', _temporary_directory)
 try:
 shutil.rmtree(_temporary_directory)
 except OSError:
 pass
 _temporary_directory = None

 def make_temp_file(suffix='', prefix='', text=True):
 global _temporary_directory
 if not _temporary_directory:
 _temporary_directory = tempfile.mkdtemp()
 atexit.register(clean_up_temporary_directory)

Sorry - I still don't understand.  You mean I should (in my package -
say nipy or 'apkg') monkey-patch numpy distutils.misc_util ?

Another option would be to move the import outside the callback function thus:

diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 2e4ed27..e00d924 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -18,6 +18,7 @@ except NameError:
 from sets import Set as set

 from numpy.distutils.compat import get_exception
+from numpy.distutils.log import debug as log_debug

 __all__ = ['Configuration', 'get_numpy_include_dirs', 'default_config_dict',
'dict_append', 'appendpath', 'generate_config_py',
@@ -249,11 +250,10 @@ def gpaths(paths, local_path='',
include_non_existing=True):

 _temporary_directory = None
 def clean_up_temporary_directory():
-from numpy.distutils import log
 global _temporary_directory
 if not _temporary_directory:
 return
-log.debug('removing %s', _temporary_directory)
+log_debug('removing %s', _temporary_directory)
 try:
 shutil.rmtree(_temporary_directory)
 except OSError:


Do you happen to know if that will break anything?  Setup install runs for me...

Cheers,

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy distutils log error with easy_install

2012-10-01 Thread Matthew Brett
Hi,

One of our kind users pointed out an error when using easy_install to
install our package nipy.   I've reproduced it now on a bare package
using numpy distutils and having a trivial extension:

https://github.com/matthew-brett/apkg

To reproduce:

git clone git://github.com/mathew-brett/apkg.git

easy_install apkg

You should get something like this:

Processing apkg
Running setup.py -q bdist_egg --dist-dir
/home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
Appending apkg configuration to
Ignoring attempt to set 'name' (from '' to 'apkg')
zip_safe flag not set; analyzing archive contents...
Adding apkg 0.1 to easy-install.pth file

Installed 
/home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
Processing dependencies for apkg==0.1
Finished processing dependencies for apkg==0.1
/home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
RuntimeWarning: Parent module 'numpy.distutils' not found while
handling absolute import
  from numpy.distutils import log

Note the last error.  All of nipy, scikits-learn and
scikits-timeseries (that use numpy distutils) give this same error on
easy_install.  The error requires the use of an extension in the
package, as in:

https://github.com/matthew-brett/apkg/blob/master/apkg/setup.py#L4

It appears to be benign but it certainly confuses people doing
easy_install.  This is running current numpy master, but the same
occurs with numpy 1.5.1 that I have to hand.

Any ideas what could be causing this?

Cheers,

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy distutils log error with easy_install

2012-10-01 Thread Matthew Brett
Hi,

On Mon, Oct 1, 2012 at 9:42 PM, Matthew Brett matthew.br...@gmail.com wrote:
 Hi,

 One of our kind users pointed out an error when using easy_install to
 install our package nipy.   I've reproduced it now on a bare package
 using numpy distutils and having a trivial extension:

 https://github.com/matthew-brett/apkg

 To reproduce:

 git clone git://github.com/mathew-brett/apkg.git

 easy_install apkg

 You should get something like this:

 Processing apkg
 Running setup.py -q bdist_egg --dist-dir
 /home/mb312/tmp/apkg/egg-dist-tmp-T5yjuB
 Appending apkg configuration to
 Ignoring attempt to set 'name' (from '' to 'apkg')
 zip_safe flag not set; analyzing archive contents...
 Adding apkg 0.1 to easy-install.pth file

 Installed 
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/apkg-0.1-py2.6-linux-i686.egg
 Processing dependencies for apkg==0.1
 Finished processing dependencies for apkg==0.1
 /home/mb312/.virtualenvs/np-1.6.2/lib/python2.6/site-packages/numpy/distutils/misc_util.py:252:
 RuntimeWarning: Parent module 'numpy.distutils' not found while
 handling absolute import
   from numpy.distutils import log

 Note the last error.

Sorry, correcting myself - it's (obviously) a Warning rather than an
error, but still distracting, and it would be good to avoid it if
possible...

Best,

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion