pip install numpy fail in virtualenv

Bug #780220 reported by Łukasz Fidosz
58
This bug affects 12 people
Affects Status Importance Assigned to Milestone
python-virtualenv (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: python-virtualenv

pip install numpy fails when i trying to run it in virtualenv

-system info:
virhilo@ThinkPad-SL:/tmp$ lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

virhilo@ThinkPad-SL:/tmp$ LC_ALL=C apt-cache policy python
python:
  Installed: 2.7.1-0ubuntu5
  Candidate: 2.7.1-0ubuntu5
  Version table:
 *** 2.7.1-0ubuntu5 0
        500 http://nl3.archive.ubuntu.com/ubuntu/ natty/main amd64 Packages
        100 /var/lib/dpkg/status
virhilo@ThinkPad-SL:/tmp$ LC_ALL=C apt-cache policy python-virtualenv
python-virtualenv:
  Installed: 1.4.9-3ubuntu1
  Candidate: 1.4.9-3ubuntu1
  Version table:
 *** 1.4.9-3ubuntu1 0
        500 http://nl3.archive.ubuntu.com/ubuntu/ natty/universe amd64 Packages
        100 /var/lib/dpkg/status

-steps to reproduce:

virhilo@ThinkPad-SL:/tmp$ virtualenv my_env --no-site-packages
New python executable in my_env/bin/python
Installing distribute.................................................................................................................................................................................done.
virhilo@ThinkPad-SL:/tmp$ cd my_env/
virhilo@ThinkPad-SL:/tmp/my_env$ . bin/activate
(my_env)virhilo@ThinkPad-SL:/tmp/my_env$ pip install numpy
Downloading/unpacking numpy
  Downloading numpy-1.5.1.tar.gz (2.3Mb): 2.3Mb downloaded
  Running setup.py egg_info for package numpy
    Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg'
    F2PY Version 1
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in /tmp/my_env/lib
      libraries mkl,vml,guide not found in /usr/local/lib
      libraries mkl,vml,guide not found in /usr/lib64
      libraries mkl,vml,guide not found in /usr/lib
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in /tmp/my_env/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
    Setting PTATLAS=ATLAS
    Setting PTATLAS=ATLAS
      FOUND:
        libraries = ['ptf77blas', 'ptcblas', 'atlas']
        library_dirs = ['/usr/lib64/atlas-base']
        language = c
        include_dirs = ['/usr/include/atlas']

      FOUND:
        libraries = ['ptf77blas', 'ptcblas', 'atlas']
        library_dirs = ['/usr/lib64/atlas-base']
        language = c
        define_macros = [('ATLAS_INFO', '"\\"?.?.?\\""')]
        include_dirs = ['/usr/include/atlas']

    lapack_opt_info:
    lapack_mkl_info:
    mkl_info:
      libraries mkl,vml,guide not found in /tmp/my_env/lib
      libraries mkl,vml,guide not found in /usr/local/lib
      libraries mkl,vml,guide not found in /usr/lib64
      libraries mkl,vml,guide not found in /usr/lib
      NOT AVAILABLE

      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in /tmp/my_env/lib
      libraries lapack_atlas not found in /tmp/my_env/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries lapack not found in /usr/lib64/atlas-base
    numpy.distutils.system_info.atlas_threads_info
    Setting PTATLAS=ATLAS
    Setting PTATLAS=ATLAS
      FOUND:
        libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
        library_dirs = ['/usr/lib64/atlas-base/atlas', '/usr/lib64/atlas-base']
        language = f77
        include_dirs = ['/usr/include/atlas']

      FOUND:
        libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
        library_dirs = ['/usr/lib64/atlas-base/atlas', '/usr/lib64/atlas-base']
        language = f77
        define_macros = [('ATLAS_INFO', '"\\"?.?.?\\""')]
        include_dirs = ['/usr/include/atlas']

    build_src
    building py_modules sources
    building library "npymath" sources
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/tmp/my_env/build/numpy/setup.py", line 211, in <module>
        setup_package()
      File "/tmp/my_env/build/numpy/setup.py", line 204, in setup_package
        configuration=configuration )
      File "/tmp/my_env/build/numpy/numpy/distutils/core.py", line 186, in setup
        return old_setup(**new_attr)
      File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/my_env/build/numpy/numpy/distutils/command/egg_info.py", line 8, in run
        self.run_command("build_src")
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 152, in run
        self.build_sources()
      File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 163, in build_sources
        self.build_library_sources(*libname_info)
      File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 298, in build_library_sources
        sources = self.generate_sources(sources, (lib_name, build_info))
      File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 385, in generate_sources
        source = func(extension, build_dir)
      File "numpy/core/setup.py", line 681, in get_mathlib_info
        st = config_cmd.try_link('int main(void) { return 0;}')
      File "/usr/lib/python2.7/distutils/command/config.py", line 248, in try_link
        self._check_compiler()
      File "/tmp/my_env/build/numpy/numpy/distutils/command/config.py", line 45, in _check_compiler
        old_config._check_compiler(self)
      File "/usr/lib/python2.7/distutils/command/config.py", line 103, in _check_compiler
        customize_compiler(self.compiler)
      File "/usr/lib/python2.7/distutils/ccompiler.py", line 44, in customize_compiler
        cpp = cc + " -E" # not always
    TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
    Complete output from command python setup.py egg_info:
    Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg'

F2PY Version 1

blas_opt_info:

blas_mkl_info:

  libraries mkl,vml,guide not found in /tmp/my_env/lib

  libraries mkl,vml,guide not found in /usr/local/lib

  libraries mkl,vml,guide not found in /usr/lib64

  libraries mkl,vml,guide not found in /usr/lib

  NOT AVAILABLE

atlas_blas_threads_info:

Setting PTATLAS=ATLAS

  libraries ptf77blas,ptcblas,atlas not found in /tmp/my_env/lib

  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib

Setting PTATLAS=ATLAS

Setting PTATLAS=ATLAS

  FOUND:

    libraries = ['ptf77blas', 'ptcblas', 'atlas']

    library_dirs = ['/usr/lib64/atlas-base']

    language = c

    include_dirs = ['/usr/include/atlas']

  FOUND:

    libraries = ['ptf77blas', 'ptcblas', 'atlas']

    library_dirs = ['/usr/lib64/atlas-base']

    language = c

    define_macros = [('ATLAS_INFO', '"\\"?.?.?\\""')]

    include_dirs = ['/usr/include/atlas']

lapack_opt_info:

lapack_mkl_info:

mkl_info:

  libraries mkl,vml,guide not found in /tmp/my_env/lib

  libraries mkl,vml,guide not found in /usr/local/lib

  libraries mkl,vml,guide not found in /usr/lib64

  libraries mkl,vml,guide not found in /usr/lib

  NOT AVAILABLE

  NOT AVAILABLE

atlas_threads_info:

Setting PTATLAS=ATLAS

  libraries ptf77blas,ptcblas,atlas not found in /tmp/my_env/lib

  libraries lapack_atlas not found in /tmp/my_env/lib

  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib

  libraries lapack_atlas not found in /usr/local/lib

  libraries lapack not found in /usr/lib64/atlas-base

numpy.distutils.system_info.atlas_threads_info

Setting PTATLAS=ATLAS

Setting PTATLAS=ATLAS

  FOUND:

    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']

    library_dirs = ['/usr/lib64/atlas-base/atlas', '/usr/lib64/atlas-base']

    language = f77

    include_dirs = ['/usr/include/atlas']

  FOUND:

    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']

    library_dirs = ['/usr/lib64/atlas-base/atlas', '/usr/lib64/atlas-base']

    language = f77

    define_macros = [('ATLAS_INFO', '"\\"?.?.?\\""')]

    include_dirs = ['/usr/include/atlas']

running egg_info

running build_src

build_src

building py_modules sources

creating build

creating build/src.linux-x86_64-2.7

creating build/src.linux-x86_64-2.7/numpy

creating build/src.linux-x86_64-2.7/numpy/distutils

building library "npymath" sources

Traceback (most recent call last):

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

  File "/tmp/my_env/build/numpy/setup.py", line 211, in <module>

    setup_package()

  File "/tmp/my_env/build/numpy/setup.py", line 204, in setup_package

    configuration=configuration )

  File "/tmp/my_env/build/numpy/numpy/distutils/core.py", line 186, in setup

    return old_setup(**new_attr)

  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/tmp/my_env/build/numpy/numpy/distutils/command/egg_info.py", line 8, in run

    self.run_command("build_src")

  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command

    self.distribution.run_command(command)

  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 152, in run

    self.build_sources()

  File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 163, in build_sources

    self.build_library_sources(*libname_info)

  File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 298, in build_library_sources

    sources = self.generate_sources(sources, (lib_name, build_info))

  File "/tmp/my_env/build/numpy/numpy/distutils/command/build_src.py", line 385, in generate_sources

    source = func(extension, build_dir)

  File "numpy/core/setup.py", line 681, in get_mathlib_info

    st = config_cmd.try_link('int main(void) { return 0;}')

  File "/usr/lib/python2.7/distutils/command/config.py", line 248, in try_link

    self._check_compiler()

  File "/tmp/my_env/build/numpy/numpy/distutils/command/config.py", line 45, in _check_compiler

    old_config._check_compiler(self)

  File "/usr/lib/python2.7/distutils/command/config.py", line 103, in _check_compiler

    customize_compiler(self.compiler)

  File "/usr/lib/python2.7/distutils/ccompiler.py", line 44, in customize_compiler

    cpp = cc + " -E" # not always

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/virhilo/.pip/pip.log
(my_env)virhilo@ThinkPad-SL:/tmp/my_env$

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: python-virtualenv 1.4.9-3ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic x86_64
Architecture: amd64
Date: Tue May 10 01:52:34 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=pl:en
 LANG=pl_PL.UTF-8
 SHELL=/bin/bash
SourcePackage: python-virtualenv
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Łukasz Fidosz (virhilo) wrote :
Revision history for this message
Łukasz Fidosz (virhilo) wrote :

simmilar problem can be found here: http://<email address hidden>/msg30960.html

Revision history for this message
Olivier Hervieu (ohe) wrote :

This bug is due to the shipped version of virtualenv (1.4.9 in ubuntu 11.04).
This version does not copy the directory config/ of the python installation in the virtualenv, so sysconfig, introduced in python2.7 is broken.

Here is a workaround:

mkdir -p <VIRTUALENV_PATH>/local/lib/python2.7/config/
cp /usr/lib/python2.7/config/Makefile <VIRTUALENV_PATH>/local/lib/python2.7/config/Makefile

Revision history for this message
Michael Ramm (micramm) wrote :

The bug is also present on 11.04 if using pip to install the latest version of virtualenv (1.6.1)

Revision history for this message
Michael Ramm (micramm) wrote :

That is, still fails to pip install numpy within virtualenv 1.6.1

Revision history for this message
Scott Sinclair (scott-sinclair-za) wrote :

The title of this bug report is misleading, the problem has nothing to do with pip. It's a problem with virtualenv for Debian based systems with Python 2.7 (see https://github.com/pypa/virtualenv/issues/118).

A workaround

Activate the virtualenv
mkdir $VIRTUAL_ENV/local
ln -s $VIRTUAL_ENV/lib $VIRTUAL_ENV/local/lib
Install Numpy

Revision history for this message
Michael Ramm (micramm) wrote :

I believe this issue is now resolved with the latest version of virtualenv. To give it a shot, use pip to install the latest version instead of using the packaged version. I used

apt-get remove python-virtualenv
apt-get install pip
pip install --upgrade pip
pip install virtalenv

Was then able to install numpy.

Revision history for this message
Barry Warsaw (barry) wrote :

I get a different error when installing numpy on a virtualenv on Oneiric (which has virtualenv 1.6 via Debian). However, it probably makes sense to get Debian to upgrade to virtualenv 1.6.4 and then sync that to Ubuntu.

Revision history for this message
Barry Warsaw (barry) wrote :

FWIW, I suspect that the problems with numpy in Oneiric in a virtualenv are due to upstream numpy not being multiarch aware, and thus it cannot find its dependent libraries or headers. Oneric's version of numpy should fix this, though that doesn't help you in a virtualenv. The multiarch problem will have to be fixed upstream in numpy, and it will soon affect Debian as well as Ubuntu.

Changed in python-virtualenv (Ubuntu):
status: New → Won't Fix
Revision history for this message
Robert Muil (robertmuil) wrote :

Hi, I'm trying this on a 64bit oneiric install (actually tried on two separate ones) and I'm getting this error. The link workaround suggested in #6 was not necessary - the link existed - and the workaround in #3 is also irrelevant because my virtualenv python2.7/config is a already simply a link to /usr/lib/python2.7/config.

I would very much appreciate some feedback on this - I cannot get numpy/scipy installed on my linux machine, and with 'Wont Fix' pasted on this bug I'm a bit worried I won't be able to.

Thanks muchly,
Rob.

Revision history for this message
Robert Muil (robertmuil) wrote :

Ok, regarding my previous comment: this seems to have been caused by a particular of my setup. My python virtualenv was in ~/usr/local... and this was being 'corrected' by the setup script to ~/local...

So, moving my virtualenv seems to avoid this problem: worth knowing for anyone who likes to install things under ~/usr.

The installation is now failing with a permissions error - it is obviously attempting to install into /usr/local/lib - even though I'm within a virtualenv. I don't understand this, but it's not part of this bug so I'll leave it.

Summary: this bug is considered fixed but I think the fix breaks for users who have use ~/usr... in their virtualenv.

Revision history for this message
bwanamarko (bwanamarko) wrote :

I cannot install Numpy using pip even in my base install. I get the exact same set of errors. Of course I can't install it with withing a virtualenv either.

Revision history for this message
bwanamarko (bwanamarko) wrote :

oops, here are my system details:
oneiric ocelot 11.10
pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)
I already have numpy from the repo

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.