2015-07-03 28 views
10

Ich versuche, scikits.audioLab mit dem Pip-Tool zu installieren. Pip scheint den Befehl python setup.py egg_info aus dem Quellverzeichnis von scikits.audioLab auszuführen. Wenn es so tut, bekomme ich diesen Fehler:Fehler beim Installieren von scikits.audioLab bei der Verwendung von 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 

Das Problem ist klar, dass es nicht numpy.distutils.core importieren. Mit Blick auf dem setup.py-Skript, geschieht dies Import früh (am unteren Rande des Snippets unten):

#! /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 

Der ungeradee Teil ist, dass, wenn ich laufe nur das obige Snippet des setup.py-Skript über python setup.py Ich bekomme den Importfehler nicht. Wie wirkt sich das Befehlszeilenargument egg_info auf die Art und Weise aus, wie setup.py ausgeführt wird und warum es Python plötzlich unmöglich macht, von numpy.distutils.core zu importieren?

+1

scheint unwahrscheinlich, dass es die egg_info Befehl ist, sondern vielmehr, dass pip die Umwelt in irgendeiner Weise verändert .. Ist Pip die richtige Umgebung? Du kannst das mit pip -V –

+0

überprüfen, vielleicht hängt das mit deinem Problem zusammen: https://github.com/scipy/scipy/blob/v0.13.0b1/setup.py#L203 – denfromufa

+0

wenn numpy so installiert ist, dann es kann funktionieren: pip installieren numpy --user – denfromufa

Antwort

2

Es gibt ein Problem in scikits.audiolab 's setup.py Datei. Werfen Sie einen Blick auf 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 

Das allererste, was es Import von numpy tut, ist. Wenn numpy nicht installiert ist, wird dies mit dem von Ihnen freigegebenen Importfehler garantiert fehlschlagen.

Ich vermute, dass Sie zwischen Ihrem fehlgeschlagenen Installationsversuch und Ihrer erfolgreichen Installation manuell mit pip install numpy NUMPY installiert haben. Es ist unwahrscheinlich, dass egg_info etwas damit zu tun hatte.

Hier ist ein Beispiel dafür, wie dieses Problem zu umgehen, von der setup.py des scipy genommen Projekt:

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

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