2015-07-03 22 views
10

Próbuję zainstalować scikits.audiolab przy użyciu narzędzia pip. Pip wydaje się uruchamiać polecenie python setup.py egg_info z katalogu źródłowego scikits.audiolab. Gdy to uczyni, otrzymuję ten błąd:Błąd podczas instalowania scikits.audiolab podczas korzystania z 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 

problem jest wyraźnie, że nie można importować numpy.distutils.core. Patrząc na setup.py skryptu, to import dzieje się na początku (na dole fragmentu poniżej):

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

Dziwne jest to, że jeśli po prostu uruchomić powyższy fragment z setup.py skryptu przez python setup.py , Nie dostaję błędu importu. Jak argument egg_info wpływa na sposób, w jaki działa setup.py i dlaczego nagle uniemożliwia importowanie Pythona z numpy.distutils.core?

+1

wydaje się mało prawdopodobne, że jest to polecenie egg_info, ale raczej, że PIP zmienia środowisko w jakiś sposób .. Czy PIP używa właściwego środowiska? Możesz to sprawdzić za pomocą pip -V –

+0

, być może jest to związane z twoim problemem: https://github.com/scipy/scipy/blob/v0.13.0b1/setup.py#L203 – denfromufa

+0

jeśli numpy jest zainstalowany w ten sposób, to może działać: pip install numpy --user – denfromufa

Odpowiedz

2

Wystąpił problem w pliku scikits.audiolab o numerze setup.py. Spójrz na 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 

Pierwszą rzeczą, robi to import z numpy. Jeśli nie zainstalowano numpy, gwarantuje to błąd z powodu błędu importu, który udostępniono.

Podejrzewam, że pomiędzy nieudaną próbą instalacji a udaną instalacją, zainstalowałeś numpy ręcznie z pip install numpy. Jest mało prawdopodobne, że egg_info miał z tym coś wspólnego.

Oto demonstracja sposobu obejścia tego problemu, zaczerpnięte z projektu scipy na setup.py:

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

    metadata = dict(
     ... 
     setup_requires = build_requires, 
     install_requires = build_requires, 
    ) 
Powiązane problemy