You are not logged in.

#1 2012-12-20 10:36:52

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

numpy package installs in the $HOME

I wanted to compile numpy with Atlas support, so I downloaded the package and edited the PKGBUILD adding the lib names:

# $Id: PKGBUILD 169025 2012-10-17 10:20:51Z allan $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Douglas Soares de Andrade <dsa@aur.archlinux.org>
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve> 

pkgbase=python-numpy
pkgname=('python2-numpy' 'python-numpy')
pkgver=1.7.0
_pkgver=1.7.0b2
pkgrel=1
pkgdesc="Scientific tools for Python"
arch=('i686' 'x86_64')
license=('custom')
url="http://numpy.scipy.org/"
makedepends=('lapack' 'python' 'python2' 'python-distribute' 'python2-distribute' 'gcc-fortran' 'python-nose')
source=(http://downloads.sourceforge.net/numpy/numpy-${_pkgver}.tar.gz)
md5sums=('1b62cf0e34e2db58b0241b00d603df24')

build() {
  cd "${srcdir}"
  cp -a numpy-${_pkgver} numpy-py2-${_pkgver}

  export BLAS=/usr/lib/libblas.so
  export LAPACK=/usr/lib/liblapack.so
  export ATLAS=/usr/lib/libatlas.so
  export LDFLAGS="$LDFLAGS -shared"

  echo "Building Python2"
  cd "${srcdir}/numpy-py2-${_pkgver}"
  python2 setup.py config_fc --fcompiler=gnu95 build

  echo "Building Python3"
  cd "${srcdir}/numpy-${_pkgver}"
  python setup.py config_fc --fcompiler=gnu95 build
}

package_python2-numpy() {
  depends=('lapack' 'python2')
  optdepends=('python-nose: testsuite')

  cd "${srcdir}/numpy-py2-${_pkgver}"
  python2 setup.py config_fc --fcompiler=gnu95 install --prefix=/usr --root="${pkgdir}" --optimize=1

  install -m755 -d "${pkgdir}/usr/share/licenses/python2-numpy"
  install -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/python2-numpy/"

  sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
         -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
         -e "s|#![ ]*/bin/env python$|#!/usr/bin/env python2|" \
             $(find ${pkgdir} -name '*.py')
}

package_python-numpy() {
  depends=('lapack' 'python')
  provides=("python3-numpy=${pkgver}")
  replaces=('python3-numpy')
  conflicts=('python3-numpy')

  cd "${srcdir}/numpy-${_pkgver}"
  python setup.py config_fc --fcompiler=gnu95 install --prefix=/usr --root="${pkgdir}" --optimize=1

  install -m755 -d "${pkgdir}/usr/share/licenses/python3-numpy"
  install -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/python3-numpy/"
}

as suggested in the numpy site I used ldd to double check that the .so files are indeed compiled with gfortran...
So far, so good.

I unset python related variables, and start the build:

$ unset PYTHONPATH
$ unset PYTHONSTARTUP
$ makepkg

But, the result still puts the files in the directory in my home!

$ find pkg
[...]
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/unixccompiler.py
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/misc_util.py
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/setupscons.py
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/mingw
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/mingw/gfortran_vs2003_hack.c
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/pathccompiler.py
pkg/python-numpy/home/ezzetabi/pythonlib/numpy/distutils/cpuinfo.py
[...]

How is possible? I am going crazy, help!

Thanks

Last edited by ezzetabi (2012-12-20 10:59:59)

Offline

#2 2012-12-20 10:58:16

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: numpy package installs in the $HOME

I don't see a command to install the package once it's created.  Using a bare makepkg command, without options, only creates a package to be installed using pacman.

https://wiki.archlinux.org/index.php/Arch_Build_System

Offline

#3 2012-12-20 10:58:23

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: numpy package installs in the $HOME

@thisoldman
What? Of course I did not installed it! The pkg directory shows a wrong structure! And the reason of that was the question.


Got it... I made time ago the ~/.pydistutils.cfg file to install a python package in my home and I forgot about it...

~/.pydistutils.cfg

[install]
install_lib = ~/pythonlib
install_scripts = ~/pythonlib/bin

My fault, yet I guess the package should ignore it somewhat...

Last edited by ezzetabi (2012-12-20 10:59:35)

Offline

#4 2012-12-20 11:12:20

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: numpy package installs in the $HOME

Glad you found the error.  I had a hard time believing you didn't install the package when I read your forum registration date.  But, I figured, I sometimes forget very basic stuff...

Offline

Board footer

Powered by FluxBB