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

NumPy Trac numpy-tickets@scipy....
Mon Jul 25 10:56:06 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  |  

Comment(by embray):

 Well, I commented out the `print(o)` that was causing problems at line 61
 of numpy/distutils/ccompiler.py, and updated my patch to the setup.py to

 diff --git a/setup.py b/setup.py
 index 542ca7b..ef70d16 100755
 --- a/setup.py
 +++ b/setup.py
 @@ -166,6 +166,16 @@ def setup_package():
          site_cfg = os.path.join(local_path, 'site.cfg')
          if os.path.isfile(site_cfg):
              shutil.copy(site_cfg, src_path)
 +        if os.path.exists('pip-egg-info'):
 +            # This means we're being installed by pip, and have to do
 +            # hackery to get this to work in Python 3
 +            # This won't work if pip was run with the --editable option,
 +            # numpy won't work in that context anyways
 +            global __file__
 +            __file__ = os.path.join(os.curdir,
 +            if '--egg-base' in sys.argv:
 +                idx = sys.argv.index('--egg-base')
 +                sys.argv[idx + 1] = os.path.join(local_path, 'pip-egg-

 and with that the install succeeded.  So I would recommend adding this
 patch, or something like it to numpy.  In the meantime I'll get in touch
 with the pip developers about this encoding issue.

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

More information about the NumPy-Tickets mailing list