首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用旧安装Cantera的麻烦(?)Python3模块对Debian进行测试以运行SCons脚本

用旧安装Cantera的麻烦(?)Python3模块对Debian进行测试以运行SCons脚本
EN

Stack Overflow用户
提问于 2021-04-07 20:07:23
回答 1查看 134关注 0票数 0

更新

这是到cantera的链接:在这里输入链接描述和我确实安装了scons;

代码语言:javascript
复制
 apt-cache policy scons*
  scons:
 Installed: 4.0.1+dfsg-2
 Candidate: 4.0.1+dfsg-2
 Version table:
 *** 4.0.1+dfsg-2 900
    900 http://deb.debian.org/debian testing/main amd64 Packages
    100 /var/lib/dpkg/status
     3.0.1-2 500
    500 http://http.us.debian.org/debian stable/main amd64 Packages

与消息来源的直接联系:

在这里输入链接描述

下面是一个调用安装脚本的示例;

scons build prefix='/home/X/SW/Cantera/installed/' --config=force

我一直在尝试升级/安装Cantera (cantera.org),它依赖于Scons (脚本'SConstruct‘是使用的)。我注意到脚本中有一行,from buildutils import *。我试着使用python3 -m pip install --user buildutils安装它,但是我得到了一个大错误:

代码语言:javascript
复制
2016|0|X@X ~/SW/Cantera/cantera $ Wed  7 04 2021, 13:24:08 
 python3 -m pip install --user buildutils
Collecting buildutils
  Using cached buildutils-0.3.tar.gz (47 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v3fu4kdk/buildutils_3a844402d1bc49ec99a3331d798a6021/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v3fu4kdk/buildutils_3a844402d1bc49ec99a3331d798a6021/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-owjzbfid
         cwd: /tmp/pip-install-v3fu4kdk/buildutils_3a844402d1bc49ec99a3331d798a6021/
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-v3fu4kdk/buildutils_3a844402d1bc49ec99a3331d798a6021/setup.py", line 5, in <module>
        from ez_setup import use_setuptools
      File "/tmp/pip-install-v3fu4kdk/buildutils_3a844402d1bc49ec99a3331d798a6021/ez_setup.py", line 91
        except pkg_resources.VersionConflict, e:
                                            ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/b2/84/797607896d265c2bf00cdaff35c901713f738dfc4efe8ee23bdedb42c789/buildutils-0.3.tar.gz#sha256=8f9921cf145a1879986b4028db0af4f028f65fe6eae29936490174037ba7dfc5 (from https://pypi.org/simple/buildutils/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached buildutils-0.1.2.tar.gz (42 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v3fu4kdk/buildutils_861964493705449c937dc2face33fe7e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v3fu4kdk/buildutils_861964493705449c937dc2face33fe7e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-28mf5gk7
         cwd: /tmp/pip-install-v3fu4kdk/buildutils_861964493705449c937dc2face33fe7e/
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-v3fu4kdk/buildutils_861964493705449c937dc2face33fe7e/setup.py", line 5, in <module>
        from ez_setup import use_setuptools
      File "/tmp/pip-install-v3fu4kdk/buildutils_861964493705449c937dc2face33fe7e/ez_setup.py", line 160
        print "Setuptools successfully installed or upgraded."
              ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Setuptools successfully installed or upgraded.")?
    ----------------------------------------
WARNING: Discarding  https://files.pythonhosted.org/packages/d7/62/b25a56b638d9e1cfc08eba7fd0aa5876f3e2c86f30ca4c5b8c3cda2af524/buildutils-0.1.2.tar.gz#sha256=ad9d597e6836535010880128e5614145f84939c7e26a64c186a7eb37454fa8db (from https://pypi.org/simple/buildutils/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement buildutils
ERROR: No matching distribution found for buildutils

我看到“版本冲突”和一个括号的问题..。我还注意到最新的版本是2007年发布的.https://pypi.org/project/buildutils/是否有一个更新的替代版本?

我想尝试从源代码手动安装它(很明显,鸡蛋文件是为python2构建的),但是没有错误就无法成功地执行ez_setup.pysetup.py。我只看了一页,但从来没有做过,我不知道发生了什么。

我在互联网上看到很多关于模块找不到的请求,但是大多数的答案都是关于错误命名它(无法为Python安装PyZMP --依赖项),或者它没有安装。

我从Debian中寻找一些与buildutils相关的信息,但是没有出现任何相关的信息。

这源于我从scon脚本中得到的关于KeyValue的一个错误,这里的相关部分显示:

代码语言:javascript
复制
...
...
--------------------- end config.log ---------------------
INFO: Using NumPy version 1.19.5.
INFO: Using Cython version 0.29.21.
INFO: Building the full Python package for Python 3.9
KeyError: 'HAS_CLANG':
  File "/home/X/SW/Cantera/cantera/SConstruct", line 1543:
    if env['OS'] == 'Solaris' or env['HAS_CLANG']:
  File "/home/X/.local/lib/python3.9/site-packages/SCons/Environment.py", line 388:
    return self._dict[key]

因此,1543年左右的脚本SConstruct的行是;

代码语言:javascript
复制
...
196 env = Environment(tools=toolchain+['textfile', 'subst', 'recursiveInstall', 'wix', 'gch'],
197                   ENV={'PATH': os.environ['PATH']},
198                   toolchain=toolchain,
199                   **extraEnvArgs)
200
201 env['OS'] = platform.system()
202 env['OS_BITS'] = int(platform.architecture()[0][:2])
...
825 conf = Configure(env, custom_tests={'CheckStatement': CheckStatement})
...
1032 env['HAS_CLANG'] = conf.CheckDeclaration('__clang__', '', 'C++')
...
1526
1527 configh = {}
1528
1529 configh['CANTERA_VERSION'] = quoted(env['cantera_version'])
1530 configh['CANTERA_SHORT_VERSION'] = quoted(env['cantera_short_version'])
1531
1532 # Conditional defines
1533 def cdefine(definevar, configvar, comp=True, value=1):
1534     if env.get(configvar) == comp:
1535         configh[definevar] = value
1536     else:
1537         configh[definevar] = None
1538
1539 # Need to test all of these to see what platform.system() returns
1540 configh['SOLARIS'] = 1 if env['OS'] == 'Solaris' else None
1541 configh['DARWIN'] = 1 if env['OS'] == 'Darwin' else None
1542
1543 if env['OS'] == 'Solaris' or env['HAS_CLANG']:
1544     configh['NEEDS_GENERIC_TEMPL_STATIC_DECL'] = 1
1545
1546 configh['CT_SUNDIALS_VERSION'] = env['sundials_version'].replace('.','')
1547
1548 if env.get('has_sundials_lapack') and env['use_lapack']:
1549     configh['CT_SUNDIALS_USE_LAPACK'] = 1
1550 else:
1551     configh['CT_SUNDIALS_USE_LAPACK'] = 0
1552
1553 cdefine('LAPACK_FTN_STRING_LEN_AT_END', 'lapack_ftn_string_len_at_end')

这看起来很像字典,即快速启动部分:在这里输入链接描述,但是我在目录(grep -nRHI "def Environment" *)的脚本中找不到一个def Environment (可能也是这个配置),所以我假设它可能是这个模块buildutils的一部分。这就解释了为什么我试图安装它和随后的错误。我知道我可以试着评论第1543行和第1544行,因为我确实有声音,但我不确定我是否有“正确”的响声.

编辑

我有buildutil,搜索PyPl,也许这是替代.用于buildutils的mercurial存储库链接似乎不起作用,但也许我可以通过awk替换整个项目的名称.我还在https://pypi.org/project/buildutil/上看到,它可能只对python3.6有好处.

编辑2

我现在想知道这是否只是一个重命名.,因为这两个名字都列在https://github.com/tedicreations/buildutil上.所以也许只是awk脚本把名字从buildutils改为buildutil.

编辑3根据2to3的建议,我尝试了用这些变化显示;

代码语言:javascript
复制
 2to3 -f all -w SConstruct
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored SConstruct
--- SConstruct  (original)
+++ SConstruct  (refactored)
@@ -37,7 +37,7 @@
     'scons doxygen' - Build the Doxygen documentation
 """
 
-from __future__ import print_function
+
 from buildutils import *
 
 if not COMMAND_LINE_TARGETS:
@@ -216,7 +216,7 @@
 
 # Fix an issue with Unicode sneaking into the environment on Windows
 if os.name == 'nt':
-    for key,val in env['ENV'].items():
+    for key,val in list(env['ENV'].items()):
         env['ENV'][key] = str(val)
 
 if 'FRAMEWORKS' not in env:
@@ -327,7 +327,7 @@
 defaults.python_prefix = '$prefix' if env['OS'] != 'Windows' else ''
 
 # Transform lists into strings to keep cantera.conf clean
-for key,value in defaults.__dict__.items():
+for key,value in list(defaults.__dict__.items()):
     if isinstance(value, (list, tuple)):
         setattr(defaults, key, ' '.join(value))
 
@@ -660,7 +660,7 @@
 
 # Expand ~/ and environment variables used in cantera.conf (variables used on
 # the command line will be expanded by the shell)
-for option in opts.keys():
+for option in list(opts.keys()):
     original = env[option]
     if isinstance(original, str):
         modified = os.path.expandvars(os.path.expanduser(env[option]))
RefactoringTool: Files that were modified:
RefactoringTool: SConstruct

但是在scons cleanscons test-clean之后,错误仍然存在(可能是字典问题.);

代码语言:javascript
复制
 scons build prefix='/home/X/SW/Cantera/installed/'  --config=force
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: /usr/bin/python3
Configuration variables read from 'cantera.conf' and command line:
    prefix = '/home/X/SW/Cantera/installed/'

Checking for C++ header file cmath... yes
Checking for C++ header file fmt/ostream.h... yes
INFO: Using system installation of fmt library.
INFO: Found fmt version 7.1.3
Checking for C++ header file yaml-cpp/yaml.h... yes
INFO: Using system installation of yaml-cpp library.
Checking for C++ header file gtest/gtest.h... no
Checking for C++ header file gmock/gmock.h... no
INFO: Using Googletest from Git submodule
Checking for C++ header file Eigen/Dense... no
INFO: Using private installation of Eigen.
INFO: Found Eigen version 3.3.7
Checking whether __GLIBCXX__ is declared... yes
Checking whether __clang__ is declared... no
Checking for C++ header file omp.h... yes
INFO: Found Boost version 1.74
Checking whether boost::core::demangle is declared... yes
Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... no
Checking for CVodeCreate(CV_BDF) in C++ library sundials_cvodes... yes
Checking for double x; log(x) in C library None... no
INFO: Using system installation of Sundials version 4.1.0.
Checking whether SUNDIALS_BLAS_LAPACK is declared... yes
sh: 1: .sconf_temp/conftest_9d002cee8d847914673abd8559024f70_0_3ae94ee097a5c84b400a349871c73680: not found
WARNING: Unable to use 'gfortran' to compile the Fortran interface. See config.log for details.
INFO: Skipping compilation of the Fortran 90 interface.
INFO: Using NumPy version 1.19.5.
INFO: Using Cython version 0.29.21.
INFO: Building the full Python package for Python 3.9
KeyError: 'HAS_CLANG':
  File "/home/X/SW/Cantera/cantera/SConstruct", line 1542:
    if env['OS'] == 'Solaris' or env['HAS_CLANG']:
  File "/home/X/.local/lib/python3.9/site-packages/SCons/Environment.py", line 388:
    return self._dict[key]

我注意到,2to3的规则可能无法将模块从buildutils转换为buildutil,如果这确实是一个适当的更改.

还有..。

这是来自modernize模块,因为它没有摆脱buildutils (我没有),尝试运行它似乎毫无意义.我做了..。还是同样的错误。

代码语言:javascript
复制
 python3 -m modernize -w SConstruct 
 Loading the following fixers:
    fissix.fixes.fix_apply  (apply)
    fissix.fixes.fix_except  (except)
    fissix.fixes.fix_exec  (exec)
    fissix.fixes.fix_execfile  (execfile)
    fissix.fixes.fix_exitfunc  (exitfunc)
    fissix.fixes.fix_funcattrs  (funcattrs)
    fissix.fixes.fix_has_key  (has_key)
    fissix.fixes.fix_idioms  (idioms)
    fissix.fixes.fix_long  (long)
    fissix.fixes.fix_methodattrs  (methodattrs)
    fissix.fixes.fix_ne  (ne)
    fissix.fixes.fix_numliterals  (numliterals)
    fissix.fixes.fix_operator  (operator)
    fissix.fixes.fix_paren  (paren)
    fissix.fixes.fix_reduce  (reduce)
    fissix.fixes.fix_renames  (renames)
    fissix.fixes.fix_repr  (repr)
    fissix.fixes.fix_set_literal  (set_literal)
    fissix.fixes.fix_standarderror  (standarderror)
    fissix.fixes.fix_sys_exc  (sys_exc)
    fissix.fixes.fix_throw  (throw)
    fissix.fixes.fix_tuple_params  (tuple_params)
    fissix.fixes.fix_types  (types)
    fissix.fixes.fix_ws_comma  (ws_comma)
    fissix.fixes.fix_xreadlines  (xreadlines)
    libmodernize.fixes.fix_basestring  (basestring)
    libmodernize.fixes.fix_dict_six  (dict_six)
    libmodernize.fixes.fix_file  (file)
    libmodernize.fixes.fix_filter  (filter)
    libmodernize.fixes.fix_import  (import)
    libmodernize.fixes.fix_imports_six  (imports_six)
    libmodernize.fixes.fix_input_six  (input_six)
    libmodernize.fixes.fix_int_long_tuple  (int_long_tuple)
    libmodernize.fixes.fix_itertools_imports_six  (itertools_imports_six)
    libmodernize.fixes.fix_itertools_six  (itertools_six)
    libmodernize.fixes.fix_map  (map)
    libmodernize.fixes.fix_metaclass  (metaclass)
    libmodernize.fixes.fix_next  (next)
    libmodernize.fixes.fix_print  (print)
    libmodernize.fixes.fix_raise  (raise)
    libmodernize.fixes.fix_raise_six  (raise_six)
    libmodernize.fixes.fix_unichr  (unichr)
    libmodernize.fixes.fix_unicode_type  (unicode_type)
    libmodernize.fixes.fix_urllib_six  (urllib_six)
    libmodernize.fixes.fix_xrange_six  (xrange_six)
    libmodernize.fixes.fix_zip  (zip)
 Applying the following explicit transformations:
    (None)

RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored SConstruct
--- SConstruct  (original)
+++ SConstruct  (refactored)
@@ -38,6 +38,7 @@
 """
 
 from __future__ import print_function
+from __future__ import absolute_import
 from buildutils import *
 
 if not COMMAND_LINE_TARGETS:
RefactoringTool: Files that were modified:
RefactoringTool: SConstruct
EN

回答 1

Stack Overflow用户

发布于 2021-04-07 21:32:04

一些旧包可以用2至3工具修复,在旧的源文件夹上运行,然后尝试使用python3进行安装。另一种方法是安装python2。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66993447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档