如何在conda环境中安装pybel?

时间:2018-02-14 21:03:39

标签: python-3.x anaconda conda pybel

我尝试在conda中安装pybel,但它确实不起作用,即使安装看起来不错,所有模块的API函数都不存在。

me$ conda create --name py34 python=3.4
Fetching package metadata .................
Solving package specifications: .

Package plan for installation in environment /Users/me/anaconda3/envs/py34:

The following NEW packages will be INSTALLED:

    ca-certificates: 2018.1.18-0      conda-forge
    certifi:         2017.1.23-py34_0 conda-forge
    ncurses:         5.9-10           conda-forge
    openssl:         1.0.2n-0         conda-forge
    pip:             9.0.1-py34_0     conda-forge
    python:          3.4.5-2          conda-forge
    readline:        6.2-0            conda-forge
    setuptools:      32.3.1-py34_0    conda-forge
    sqlite:          3.13.0-1         conda-forge
    tk:              8.5.19-2         conda-forge
    wheel:           0.29.0-py34_0    conda-forge
    xz:              5.2.3-0          conda-forge
    zlib:            1.2.11-0         conda-forge

Proceed ([y]/n)? y

#
# To activate this environment, use:
# > source activate py34
#
# To deactivate an active environment, use:
# > source deactivate
#

激活了环境:

me$ source activate py34
    (py34) iMac:me$ pip install pybel
    Collecting pybel
      Using cached PyBEL-0.11.0-py2.py3-none-any.whl
    Collecting click (from pybel)
      Using cached click-6.7-py2.py3-none-any.whl
    Collecting pyparsing (from pybel)
      Using cached pyparsing-2.2.0-py2.py3-none-any.whl
    Collecting six (from pybel)
      Using cached six-1.11.0-py2.py3-none-any.whl
    Collecting sqlalchemy==1.1.15 (from pybel)
    Collecting requests-file (from pybel)
      Using cached requests_file-1.4.3-py2.py3-none-any.whl
    Collecting requests (from pybel)
      Using cached requests-2.18.4-py2.py3-none-any.whl
    Collecting networkx==1.11 (from pybel)
      Using cached networkx-1.11-py2.py3-none-any.whl
    Collecting certifi>=2017.4.17 (from requests->pybel)
      Using cached certifi-2018.1.18-py2.py3-none-any.whl
    Collecting idna<2.7,>=2.5 (from requests->pybel)
      Using cached idna-2.6-py2.py3-none-any.whl
    Collecting urllib3<1.23,>=1.21.1 (from requests->pybel)
      Using cached urllib3-1.22-py2.py3-none-any.whl
    Collecting chardet<3.1.0,>=3.0.2 (from requests->pybel)
      Using cached chardet-3.0.4-py2.py3-none-any.whl
    Collecting decorator>=3.4.0 (from networkx==1.11->pybel)
      Using cached decorator-4.2.1-py2.py3-none-any.whl
    Installing collected packages: click, pyparsing, six, sqlalchemy, certifi, idna, urllib3, chardet, requests, requests-file, decorator, networkx, pybel
      Found existing installation: certifi 2017.1.23
        DEPRECATION: Uninstalling a distutils installed project (certifi) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
        Uninstalling certifi-2017.1.23:
          Successfully uninstalled certifi-2017.1.23
    Successfully installed certifi-2018.1.18 chardet-3.0.4 click-6.7 decorator-4.2.1 idna-2.6 networkx-1.11 pybel-0.11.0 pyparsing-2.2.0 requests-2.18.4 requests-file-1.4.3 six-1.11.0 sqlalchemy-1.1.15 urllib3-1.22
    (py34) iMac: me$ pip install pybel
    Requirement already satisfied: pybel in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages
    Requirement already satisfied: sqlalchemy==1.1.15 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: click in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: requests in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: six in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: networkx==1.11 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: requests-file in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: pyparsing in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from pybel)
    Requirement already satisfied: idna<2.7,>=2.5 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
    Requirement already satisfied: urllib3<1.23,>=1.21.1 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
    Requirement already satisfied: certifi>=2017.4.17 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from requests->pybel)
    Requirement already satisfied: decorator>=3.4.0 in /Users/me/anaconda3/envs/py34/lib/python3.4/site-packages (from networkx==1.11->pybel)

Ran python提示并尝试导入pybel,但它内部没有真正的API(例如readfile):

(py34) iMac: me$ python
Python 3.4.5 | packaged by conda-forge | (default, Sep  8 2016, 14:36:28) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybel
>>> dir(pybel)
['BELGraph', 'Manager', 'NDEX_SOURCE_FORMAT', 'NetworkManager', '__all__', '__author__', '__builtins__', '__cached__', '__copyright__', '__description__', '__doc__', '__email__', '__file__', '__license__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__title__', '__url__', '__version__', 'and_edge_predicates', 'build_annotation_dict_all_filter', 'build_annotation_dict_any_filter', 'cache_manager', 'canonicalize', 'concatenate_node_predicates', 'constants', 'count_functions', 'count_namespaces', 'count_passed_edge_filter', 'count_passed_node_filter', 'database_io', 'dsl', 'edge_has_activity', 'edge_has_annotation', 'edge_has_degradation', 'edge_has_translocation', 'edge_predicate', 'edge_to_bel', 'egf_graph', 'examples', 'exceptions', 'filter_edges', 'filter_nodes', 'from_biopax', 'from_bytes', 'from_cbn_jgif', 'from_cx', 'from_cx_file', 'from_cx_jsons', 'from_database', 'from_indra_pickle', 'from_indra_statements', 'from_jgif', 'from_json', 'from_json_file', 'from_jsons', 'from_lines', 'from_ndex', 'from_path', 'from_pickle', 'from_url', 'from_web', 'get_annotation_values_by_annotation', 'get_functions', 'get_names_by_namespace', 'get_namespaces', 'get_nodes', 'get_pubmed_identifiers', 'get_syntax_errors', 'get_unused_namespaces', 'has_activity', 'has_authors', 'has_causal_in_edges', 'has_causal_out_edges', 'has_fragment', 'has_gene_modification', 'has_hgvs', 'has_polarity', 'has_protein_modification', 'has_provenance', 'has_pubmed', 'has_variant', 'invert_edge_filter', 'io', 'is_abundance', 'is_associative_relation', 'is_causal_central', 'is_causal_relation', 'is_causal_sink', 'is_causal_source', 'is_degraded', 'is_direct_causal_relation', 'is_gene', 'is_pathology', 'is_protein', 'is_translocated', 'iter_annotation_value_pairs', 'iter_annotation_values', 'iterate_pubmed_identifiers', 'keep_node_permissive', 'language', 'left_full_join', 'left_node_intersection_join', 'left_outer_join', 'manager', 'node_exclusion_predicate_builder', 'node_inclusion_predicate_builder', 'node_intersection', 'node_to_bel', 'not_pathology', 'parser', 'resources', 'sialic_acid_graph', 'strip_annotations', 'struct', 'to_bel', 'to_bel_lines', 'to_bel_path', 'to_bytes', 'to_csv', 'to_cx', 'to_cx_file', 'to_cx_jsons', 'to_database', 'to_graphml', 'to_gsea', 'to_indra', 'to_jgif', 'to_json', 'to_json_file', 'to_jsons', 'to_ndex', 'to_neo4j', 'to_pickle', 'to_sif', 'to_web', 'tokens', 'union', 'utils']
>>> pybel.readfile("pdb","a.pdb")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'readfile'
>>> 

1 个答案:

答案 0 :(得分:1)

如果您使用的是 Windows,您可以使用以下命令:

python -m pip install pybel_tools

如果您使用的是 Linux:

sudo python3 -m pip install pybel_tools