[NumPy-Tickets] [NumPy] #1857: Pip install into virtualenv doesn't work

NumPy Trac numpy-tickets@scipy....
Thu Jun 2 20:24:10 CDT 2011


#1857: Pip install into virtualenv doesn't work
-------------------------------+--------------------------------------------
 Reporter:  rgommers           |       Owner:  rgommers   
     Type:  defect             |      Status:  new        
 Priority:  normal             |   Milestone:  Unscheduled
Component:  numpy.distutils    |     Version:  1.6.0      
 Keywords:  pip, easy_install  |  
-------------------------------+--------------------------------------------
Changes (by rgommers):

 * cc: mbrett (added)


Comment:

 Normal install: on the first pass through {{{Configuration.__init__}}} the
 top_path is set to numpy/build/py3k. This happens to be the right path,
 but it is set by accident. What happens is that the path is determined by
 {{{
 caller_file = eval('__file__', frame.f_globals, frame.f_locals)
 d = os.path.dirname(os.path.abspath(caller_file))
 }}}
 Now, because setup.py is in the current dir, the f_globals has the
 following:
 {{{
 (Pdb) frame.f_globals['__file__']
 'setup.py'
 (Pdb) os.path.abspath(caller_file)
 '/Users/rgommers/Code/numpy/build/py3k/setup.py'
 (Pdb) os.path.dirname(os.path.abspath(caller_file))
 '/Users/rgommers/Code/numpy/build/py3k'
 }}}
 There is no such file, the actual file is at
 '/Users/rgommers/Code/numpy/setup.py'. The reason this works is that in
 the main setup.py we have
 {{{
 src_path = os.path.join(local_path, 'build', 'py3k')
 os.chdir(src_path)
 sys.path.insert(0, src_path)
 }}}

 The virtualenv install produces:
 {{{
 (Pdb) frame.f_globals['__file__']
 '......./venvs/py32/build/numpy/setup.py'
 }}}
 Since this is an absolute path we get:
 {{{
 (Pdb) os.path.dirname(os.path.abspath(caller_file))
 '/Users/rgommers/Code/venvs/py32/build/numpy'
 }}}
 This is the correct path looking at what the path determination is trying
 to do, but it doesn't work. We need "build/py3k/" appended.

 It looks like the bug is in {{{get_path_from_frame()}}}, in particular the
 abspath call doesn't make sense, it actually wants the current dir.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1857#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list