2017-12-08 19 views
-1

私はオープンソースプロジェクト(GridCal)を持っており、ユーザにUNIXシステム用のpip install GridCalまたはpip3 install GridCalというパッケージをインストールするように指示します。時間から依存関係のインストールに失敗したピップ

from distutils.core import setup 
import sys 
import os 
import platform 
from GridCal.grid.CalculationEngine import __GridCal_VERSION__ 

name = "GridCal" 
version = str(__GridCal_VERSION__) 
description = "Research Oriented electrical simulation software." 

# Python 3.5 or later needed 
if sys.version_info < (3, 5, 0, 'final', 0): 
    raise (SystemExit, 'Python 3.5 or later is required!') 

# Build a list of all project modules 
packages = [] 
for dir_name, dir_names, file_names in os.walk(name): 
     if '__init__.py' in file_names: 
      packages.append(dir_name.replace('/', '.')) 

package_dir = {name: name} 

# Data_files (e.g. doc) needs (directory, files-in-this-directory) tuples 
data_files = [] 
for dir_name, dir_names, file_names in os.walk('doc'): 
     files_list = [] 
     for filename in file_names: 
      fullname = os.path.join(dir_name, filename) 
      files_list.append(fullname) 
     data_files.append(('share/' + name + '/' + dir_name, files_list)) 

if platform.system() == 'Windows': 
    # list the packages (On windows anaconda is assumed) 
    required_packages = ["numpy", 
         "scipy", 
         "networkx", 
         "pandas", 
         "xlwt", 
         "xlrd", 
         # "PyQt5", 
         "matplotlib", 
         "qtconsole", 
         "pysot", 
         "openpyxl", 
         "pulp" 
         ] 
else: 
    # make the desktop entry 
    make_linux_desktop_file(version_=version, comment=description) 

    # list the packages 
    required_packages = ["numpy", 
         "scipy", 
         "networkx", 
         "pandas", 
         "xlwt", 
         "xlrd", 
         "PyQt5", 
         "matplotlib", 
         "qtconsole", 
         "pysot", 
         "openpyxl", 
         "pulp" 
         ] 

# Read the license 
with open('LICENSE.txt', 'r') as f: 
    license_text = f.read() 

setup(
    # Application name: 
    name=name, 

    # Version number (initial): 
    version=version, 

    # Application author details: 
    author="Santiago Peñate Vera", 
    author_email="[email protected]", 

    # Packages 
    packages=packages, 

    data_files=data_files, 

    # Include additional files into the package 
    include_package_data=True, 

    # Details 
    url="http://pypi.python.org/pypi/GridCal/", 

    # License file 
    license=license_text, 

    # description 
    description=description, 

    # long_description=open("README.txt").read(), 

    # Dependent packages (distributions) 
    install_requires=required_packages, 

    setup_requires=required_packages 
) 

時間に私はプログラムをモジュールが不足しているというユーザーのレポートを取得:

セットアップファイルがこれですhttps://github.com/SanPen/GridCal/issues/12

私はinstall_requiressetup_requiresに両方のパッケージのリストを指定しています。

これはピンクのバグですか、それとも別のことをしなければなりませんか?

+0

依存関係のリストに 'pyDOE'が表示されません。どのようにインストールされていますか?それはリストされた依存のdependenciyですか? – phd

+0

私はあなたが 'install_requires'と' setup_requires'の両方を同時に必要とするのではないかと疑います。 https://pip.pypa.io/en/stable/user_guide/?highlight=setup_requires#installation-bundles:*最後に、setup.pyのsetup_requiresキーワードargに注意してください。 * – phd

+0

pyDOEはpySOTと一緒にインストールされ、この設定はLinuxでは完全に機能し、時にはWindowsではあまりうまくいかない場合もあります。したがって、疑問。 –

答えて

0

setup.pyGridCal.grid.CalculationEngineほとんどすべての依存関係をインポートします。私。あなたのsetup.pyのインポート依存関係の前にをインストールしてください。

はあなたのグローバルsite-packagesから切り離さ新しい空の仮想ENVでそれをインストールしてみます - 確かに動作しません:

$ virtualenv --no-site-packages --python python3.4 test-gcal 
Running virtualenv with interpreter /usr/bin/python3.4 
Using base prefix '/usr' 
New python executable in /home/phd/tmp/test-gcal/bin/python3.4 
Also creating executable in /home/phd/tmp/test-gcal/bin/python 
Installing setuptools, pip, wheel...done. 

$ source test-gcal/bin/activate 

$ pip install GridCal 
Collecting GridCal 
    Using cached GridCal-1.85.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/tmp/pip-build-c7q9pbep/GridCal/setup.py", line 5, in <module> 
     from GridCal.grid.CalculationEngine import __GridCal_VERSION__ 
     File "/tmp/pip-build-c7q9pbep/GridCal/GridCal/grid/CalculationEngine.py", line 18, in <module> 
     from GridCal.grid.JacobianBased import IwamotoNR, Jacobian, LevenbergMarquardtPF 
     File "/tmp/pip-build-c7q9pbep/GridCal/GridCal/grid/JacobianBased.py", line 19, in <module> 
     from numpy import array, angle, exp, linalg, r_, Inf, conj, diag, asmatrix, asarray, zeros_like, zeros, complex128, \ 
    ImportError: No module named 'numpy' 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-c7q9pbep/GridCal/ 

修正は比較的簡単です:あなたは、別のGridCal/Engine/CalculationEngine.pyから__GridCal_VERSION__を移動する必要がありますGridCal/version.py(または__version__.pyまたはこれに類するもの)from GridCal.version import __GridCal_VERSION__setup.pyにします。

インポートは、GridCal/__init__.pyが空であるか、組み込み/標準モジュールのみをインポートする場合にのみ機能します。上記__init__.pyが(まだインストールされていない)依存関係を直接的または間接的にインポートする場合、インポートすることができませんでしたversion.pysetup.pyでこれを克服する方法がありますが、今のところそれをスキップします。あなたの解決策が必要な場合は、もう一度お尋ねください。

関連する問題