2015-07-03 13 views
10

Sto cercando di installare scikits.audiolab utilizzando lo strumento pip. Pip sembra eseguire il comando python setup.py egg_info dall'interno della directory dei sorgenti di scikits.audiolab. Quando lo fa, ottengo questo errore:Errore nell'installazione di scikits.audiolab quando si utilizza python setup.py egg_info

Andrews-MacBook-Pro-2:scikits.audiolab-0.11.0 andrewhannigan$ pip install scikits.audiolab 
Collecting scikits.audiolab 
    Using cached scikits.audiolab-0.11.0.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 20, in <module> 
     File "/private/var/folders/xb/qwlsm44s1wxfr82kytrgjtl80000gn/T/pip-build-vSZaU8/scikits.audiolab/setup.py", line 32, in <module> 
     from numpy.distutils.core import setup 
    ImportError: No module named numpy.distutils.core 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/xb/qwlsm44s1wxfr82kytrgjtl80000gn/T/pip-build-vSZaU8/scikits.audiolab 

Il problema è chiaramente che non può importare numpy.distutils.core. Guardando lo script setup.py, questa importazione avviene nella fase iniziale (in fondo frammento di seguito):

#! /usr/bin/env python 
# Last Change: Fri Mar 27 05:00 PM 2009 J 

# Copyright (C) 2006-2007 Cournapeau David <[email protected]> 
# 
# This library is free software; you can redistribute it and/or modify it under 
# the terms of the GNU Lesser General Public License as published by the Free 
# Software Foundation; either version 2.1 of the License, or (at your option) any 
# later version. 
# 
# This library is distributed in the hope that it will be useful, but WITHOUT ANY 
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
# details. 
# 
# You should have received a copy of the GNU Lesser General Public License along 
# with this library; if not, write to the Free Software Foundation, Inc., 51 
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 

# TODO: 
# - check how to handle cmd line build options with distutils and use 
# it in the building process 

from os.path import join 
import os 
import sys 

# The following is more or less random copy/paste from numpy.distutils ... 
import setuptools 

from distutils.errors import DistutilsError 
from numpy.distutils.core import setup 

La parte strana è che se ho appena eseguito il frammento di codice dello script setup.py via python setup.py , Non ho ricevuto l'errore di importazione. In che modo l'argomento della riga di comando egg_info influisce sul modo in cui viene eseguito setup.py e perché all'improvviso Python non riesce a importare da numpy.distutils.core?

+1

sembra improbabile che sia il comando egg_info, ma piuttosto che pip sta cambiando l'ambiente in qualche modo .. . Pip usa l'ambiente giusto? Puoi controllare che con pip -V –

+0

forse questo è legato al tuo problema: https://github.com/scipy/scipy/blob/v0.13.0b1/setup.py#L203 – denfromufa

+0

se numpy è installato in questo modo, quindi potrebbe funzionare: pip install numpy --user – denfromufa

risposta

2

C'è un problema nel file setup.pyscikits.audiolab. Date un'occhiata a https://github.com/cournape/audiolab/blob/master/setup.py:

import os 

# The following is more or less random copy/paste from numpy.distutils ... 
import setuptools 

from numpy.distutils.core import setup 

La prima cosa che fa è importazione da numpy. Se numpy non è installato, è garantito un errore con l'errore di importazione che hai condiviso.

Sospetto che tra il tentativo di installazione non riuscito e la corretta installazione, è stato installato manualmente numpy con pip install numpy. È improbabile che lo egg_info abbia qualcosa a che fare con questo.

Ecco una dimostrazione di come ovviare a questo problema, preso dal progetto scipy del setup.py:

def setup_package(): 
    ... 
    build_requires = [] 
    try: 
     import numpy 
    except: 
     build_requires = ['numpy'] 

    metadata = dict(
     ... 
     setup_requires = build_requires, 
     install_requires = build_requires, 
    ) 
Problemi correlati