【问题标题】:Python program "genipe" - TypeError: __init__() got an unexpected keyword argument 'normalize'Python 程序“genipe” - TypeError: __init__() got an unexpected keyword argument 'normalize'
【发布时间】:2017-11-01 08:17:48
【问题描述】:

我正在尝试运行 genipe 程序来进行一些全基因组生存分析。我已经安装了 genipe 和所有相关目录。但是,当我去运行程序时,我得到了错误:

"TypeError: _ init _() 得到了一个意外的关键字参数 'normalize'"

我没有编辑任何 genipe 脚本,并且我在不同的服务器上运行 genipe 没有任何问题,所以我不确定出了什么问题!任何帮助将不胜感激。

非常感谢,

卡拉

编辑: 我正在使用 python 版本 3.6.1

回溯如下:

Traceback (most recent call last):
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 965, in process_impute2_site
    use_ml=site_info.use_ml,
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 1048, in fit_cox
    cf = CoxPHFitter(alpha=0.95, tie_method="Efron", normalize=False)
TypeError: __init__() got an unexpected keyword argument 'normalize'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 811, in compute_statistics
    for result in pool.map(process_impute2_site, sites_to_process):
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 608, in get
    raise self._value
TypeError: __init__() got an unexpected keyword argument 'normalize'

[2017-05-31 14:18:53 ERROR] __init__() got an unexpected keyword argument 'normalize'
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 965, in process_impute2_site
    use_ml=site_info.use_ml,
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 1048, in fit_cox
    cf = CoxPHFitter(alpha=0.95, tie_method="Efron", normalize=False)
TypeError: __init__() got an unexpected keyword argument 'normalize'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/bin/imputed-stats", line 11, in <module>
    sys.exit(main())
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 161, in main
    options=args,
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py", line 811, in compute_statistics
    for result in pool.map(process_impute2_site, sites_to_process):
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/users/k1640238/miniconda/envs/genipe_pyvenv/lib/python3.6/multiprocessing/pool.py", line 608, in get
    raise self._value
TypeError: __init__() got an unexpected keyword argument 'normalize'

【问题讨论】:

  • 为了能够解决这个问题,真的需要整个回溯和您的 Python 版本。
  • 我已经编辑了问题以包括回溯和版本。

标签: python typeerror normalize


【解决方案1】:

根据lifeline changelog 判断,此关键字参数已从该特定函数中删除。 Lifeline 是一个包含此特定功能的包,地址为used by genipe

您可以自己安装以前版本的生命线,看看是否有帮助或等待 genipe 库中的更新。

查看您的 cmets 的更多错误,看起来像 this is problematic code。您正在尝试使用dmatrices,但它似乎没有定义。可能是因为提到的try/catch 块找不到statsmodel 安装,因此patsy 也没有导入。

尝试手动安装更多软件包,从

开始

然后看看你是否会得到任何错误......

【讨论】:

  • 太好了,谢谢勘误,今晚我会尝试安装以前的版本,看看是否可行。
  • 我已恢复到以前版本的生命线。但是我仍然有类似的问题。我已经安装了 genipe 说明中指定的所有软件包版本。
  • 错误:test_fit_cox_interaction_snp1 (genipe.tests.test_imputed_stats.TestImputedStatsCox) 使用交互测试“fit_cox”函数,第一个 SNP。回溯(最后一次调用):文件“/miniconda/envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tests/test_imputed_stats.py”,第 866 行,在 test_fit_cox_interaction_snp1 公式=公式,文件“/miniconda/ envs/genipe_pyvenv/lib/python3.6/site-packages/genipe/tools/imputed_stats.py”,第 1128 行,在 fit_cox y 中,X = dmatrices(formula, data=data, return_type="dataframe") NameError: name ' dmatrices' 未定义
  • @Caragh 更新了我的答案!
【解决方案2】:

请参阅上面的勘误表答案,我使用了一些依赖项的错误版本,但即使这样,程序仍然给我错误。但是,当我恢复到 python 3.4 时,该程序运行正常。

【讨论】:

    猜你喜欢
    • 2021-01-19
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 1970-01-01
    • 2021-06-11
    • 1970-01-01
    • 1970-01-01
    • 2018-03-29
    相关资源
    最近更新 更多