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

NumPy Trac numpy-tickets@scipy....
Thu Jul 21 18:15:54 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):

 I played with this a bit today and made some progress with the following
 small diff to the main setup.py:

 {{{
 #!diff
 diff --git a/setup.py b/setup.py
 index 542ca7b..531364a 100755
 --- a/setup.py
 +++ b/setup.py
 @@ -166,6 +166,12 @@ 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
 some
 +            # hackery to get this to work in Python 3
 +            global __file__
 +            __file__ = os.path.join(os.curdir,
 os.path.basename(__file__))
 +            os.mkdir(os.path.join(src_path, 'pip-egg-info'))
 }}}

 This gets me a good way into the build, before it finally fails here:

 {{{
 Traceback (most recent call last):

   File "<string>", line 14, in <module>

   File "/tmp/pip-4mgbhb-build/setup.py", line 207, in <module>

     setup_package()

   File "/tmp/pip-4mgbhb-build/setup.py", line 200, in setup_package

     configuration=configuration )

   File "/tmp/pip-4mgbhb-build/build/py3k/numpy/distutils/core.py", line
 186, in setup

     return old_setup(**new_attr)

   File "/home/embray/lib/python3.2/distutils/core.py", line 149, in setup

     dist.run_commands()

   File "/home/embray/lib/python3.2/distutils/dist.py", line 919, in
 run_commands

     self.run_command(cmd)

   File "/home/embray/lib/python3.2/distutils/dist.py", line 938, in
 run_command

     cmd_obj.run()

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/egg_info.py", line 8, in run

     self.run_command("build_src")

   File "/home/embray/lib/python3.2/distutils/cmd.py", line 315, in
 run_command

     self.distribution.run_command(command)

   File "/home/embray/lib/python3.2/distutils/dist.py", line 938, in
 run_command

     cmd_obj.run()

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/build_src.py", line 152, in run

     self.build_sources()

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/build_src.py", line 169, in
 build_sources

     self.build_extension_sources(ext)

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/build_src.py", line 328, in
 build_extension_sources

     sources = self.generate_sources(sources, ext)

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/build_src.py", line 385, in
 generate_sources

     source = func(extension, build_dir)

   File "numpy/core/setup.py", line 410, in generate_config_h

     moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)

   File "numpy/core/setup.py", line 41, in check_types

     out = check_types(*a, **kw)

   File "numpy/core/setup.py", line 305, in check_types

     res = config_cmd.check_type_size(complex_def,
 expected=2*expected[type])

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/config.py", line 252, in
 check_type_size

     headers, include_dirs, 'c')

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/config.py", line 99, in _compile

     (body, headers, include_dirs, lang))

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/command/config.py", line 89, in
 _wrap_method

     ret = mth(*((self,)+args))

   File "/home/embray/lib/python3.2/distutils/command/config.py", line 135,
 in _compile

     self.compiler.compile([src], include_dirs=include_dirs)

   File "/tmp/pip-4mgbhb-build/build/py3k/numpy/distutils/ccompiler.py",
 line 26, in <lambda>

     m = lambda self, *args, **kw: func(self, *args, **kw)

   File "/tmp/pip-4mgbhb-build/build/py3k/numpy/distutils/ccompiler.py",
 line 199, in CCompiler_compile

     self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)

   File "/tmp/pip-4mgbhb-build/build/py3k/numpy/distutils/ccompiler.py",
 line 26, in <lambda>

     m = lambda self, *args, **kw: func(self, *args, **kw)

   File "/tmp/pip-4mgbhb-
 build/build/py3k/numpy/distutils/unixccompiler.py", line 35, in
 UnixCCompiler__compile

     extra_postargs, display = display)

   File "/tmp/pip-4mgbhb-build/build/py3k/numpy/distutils/ccompiler.py",
 line 26, in <lambda>

     m = lambda self, *args, **kw: func(self, *args, **kw)

   File "/tmp/pip-4mgbhb-build/build/py3k/numpy/distutils/ccompiler.py",
 line 61, in CCompiler_spawn

     print(o)

 UnicodeEncodeError: 'ascii' codec can't encode characters in position
 50-52: ordinal not in range(128)
 }}}

 Not sure why that would happen.  When I do a normal `./setup.py build` it
 looks like gcc is outputting some warnings that contain non-ascii
 characters.  But why that's a problem when installing with pip but not
 otherwise isn't clear.

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


More information about the NumPy-Tickets mailing list