Error importing module with symbol 'package_dependencies'

Issue #262 new
Åsmund Hjulstad created an issue

Importing 'MASS' gives error message

LibraryError: The symbol package_dependencies in the package "tools" is conflicting with a Python object attribute

This symbol (package_dependencies) should not be important for r2py, and could be ignored or moved somewhere.

Comments (6)

  1. Laurent Gautier

    Can you share the code you are using ? I am unable to reproduce the issue:

    >>> from rpy2.robjects.packages import importr
    >>> mass=importr("MASS")
    >>> import rpy2
    >>> print(rpy2.__version__)
    2.5.5
    >>> import rpy2.rinterface
    >>> rpy2.rinterface.R_VERSION_BUILD
    ('3', '1.1', '', 66115L)
    
  2. Åsmund Hjulstad reporter

    I reproduce using:

    >>> import rpy2
    >>> print(rpy2.__version__)
    2.5.5
    >>> import rpy2.rinterface
    >>> print(rpy2.rinterface.R_VERSION_BUILD)
    ('3', '1.2', '', 66913)
    
    >>> import rpy2.interactive.packages
    >>> mass = rpy2.interactive.packages.importr("MASS")
    
    Traceback (most recent call last):
    
      File "<ipython-input-4-f6d30838b17f>", line 6, in <module>
        import rpy2.interactive.packages
    
      File "C:\appl\Anaconda3\lib\site-packages\rpy2\interactive\packages.py", line 54, in <module>
        importr(packname)
    
      File "C:\appl\Anaconda3\lib\site-packages\rpy2\interactive\packages.py", line 31, in importr
        packinstance = _importr(packname, on_conflict = 'warn')
    
      File "C:\appl\Anaconda3\lib\site-packages\rpy2\robjects\packages.py", line 412, in importr
        version = version)
    
      File "C:\appl\Anaconda3\lib\site-packages\rpy2\robjects\packages.py", line 178, in __init__
        self.__fill_rpy2r__(on_conflict = on_conflict)
    
      File "C:\appl\Anaconda3\lib\site-packages\rpy2\robjects\packages.py", line 280, in __fill_rpy2r__
        super(SignatureTranslatedPackage, self).__fill_rpy2r__(on_conflict = on_conflict)
    
      File "C:\appl\Anaconda3\lib\site-packages\rpy2\robjects\packages.py", line 224, in __fill_rpy2r__
        'a Python object attribute')
    
    LibraryError: The symbol package_dependencies in the package "tools" is conflicting with a Python object attribute
    
  3. Åsmund Hjulstad reporter

    However, this works:

    >>> from rpy2.robjects.packages import importr
    
    >>> mass = importr("MASS")
    
  4. Laurent Gautier

    I can't reproduce it with R 3.1.2.

    >>> mass=rpy2.interactive.packages.importr("MASS")
    >>> import rpy2.rinterface
    >>> rpy2.rinterface.R_VERSION_BUILD
    ('3', '1.2', 'Patched', 67199)
    

    Can anyone else confirm ?

  5. Åsmund Hjulstad reporter

    I have also tested with a brand new 2.7 install from anaconda. (on win-64).

    Some debug statements in robjects.packages.py:

                    if "package_dependencies" in rpyname:
                        print("Found rpyname: {} rname: {}, package: {}".format(rpyname, rname, name))
                        print(riobj)
                    if rpyname in self.__dict__ or rpyname == '__dict__':
                        print('-----------------------------------------')
                        print(repr(list(self.__dict__.keys())))
                        raise LibraryError('The symbol ' + rname +\
                                           ' in the package "' + name + '"' +\
                                           ' is conflicting with ' +\
                                           'a Python object attribute'`)
    

    Gives this output:

    Found rpyname: _package_dependencies rname: .package_dependencies, package: tools
    <rpy2.rinterface.SexpClosure - Python:0x0000000006733F60 / R:0x000000000A8838B8>
    Found rpyname: package_dependencies rname: package.dependencies, package: tools
    <rpy2.rinterface.SexpClosure - Python:0x0000000006733F60 / R:0x000000000B586200>
    Found rpyname: package_dependencies rname: package_dependencies, package: tools
    <rpy2.rinterface.SexpClosure - Python:0x0000000006733F30 / R:0x000000000B592160>
    
    -----------------------------------------
    ['_massage_file_parse_error_message', 'code2LazyLoadDB', 'C_parseLatex', '_read_repositories', '_get_requires_with_version_from_package_db', 'makeVignetteTable', '_get_ref_classes', 'format_check_Rd_xrefs', '_find_HTML_links_in_package', 'checkRd', '_vc_dir_names', 'format_PDF_Stream', '_get_standard_repository_db_fields', 'latexArgCount', '_make_file_exts', 'compareDependsPkgVersion', '_read_description', '_test_load_package', '_get_S3_group_generics', 'checkDocFiles', 'get_link', 'format_PDF_Dictionary', 'deparseLatex', '_transform_S4_method_markup', '_Rd_drop_nodes_with_tags', 'latex_canonical_encoding', 'fetchRdDB', '_find_calls_in_package_code', '_check_package_description2', '_packageName', '_get_S3_primitive_generics', '_build_data_index', 'format_check_make_vars', '_Rd_deparse', 'makeJSS', '%w/o%', '_install_package_vignettes', '_check_package_code_unload_functions', 'check_packages_in_dir_details', 'buildVignettes', '___NAMESPACE___', '_build_demo_index', 'analyze_licenses_in_repository', '_Rd_get_argument_names', '_vc_dir_names_re', '_gsub_with_transformed_matches', 'getDynamicFlags', '_check_packages_used_in_tests', 'find_missing_required_BibTeX_fields', '_R_top_srcdir_from_Rd', 'check_packages_in_dir_results', '_standardize_license_components', '_standardizable_license_specs_db', '__BioC_version_associated_with_R_version', 'check_compiled_code', 'format_check_package_code_data_into_globalenv', 'names_pdf_doc', '_S4_method_markup_regexp', 'format_check_compiled_code', 'find_wide_Rd_lines_in_Rd_object', 'fsub', 'htmlify', 'close_virtual_X11_db', 'latin9table', '_is_primitive_in_base', 'news2Rd', 'file_ext', '_onUnload', '_check_package_description_authors_at_R_field', 'list_files_with_exts', 'dependsOnPkgs', 'depMtrxToStrings', 'checkPoFiles', '_run_one_vignette', '_get_S3_generics_as_seen_from_package', '_pretty_format2', '_Rd_get_names_from_Rd_db', 'assertWarning', 'checkNEWS', 'as_alist_call', '_expand_BioC_repository_URLs', '_install_package_vignettes2', '_install_package_vignettes3', 'dirchmod', 'format_check_Rd_contents', 'findHTMLlinks', 'makeLazyLoadDB', 'checkS3methods', '_Rd_get_offending_autogenerated_content', 'nonAPI', '_build_repository_package_db', '_get_package_metadata', '_check_package_code_assign_to_globalenv', '_make_signatures', '___S3MethodsTable___', 'codeFilesAppend', 'check_nonASCII', '_Rtest_package_depends_R_version', '_check_package_code_startup_functions', 'format_check_package_code_unload_functions', '_valid_maintainer_field_regexp', '_build_Rd_index', 'CRAN_check_results', 'checkRdaFiles', '_check_package_code_syntax', '_keep_white_description_fields', 'checkMD5sums', 'make_translations_pkg', '_make_S3_methods_stop_list', 'getVignetteInfo', '_SHLIB', '_get_startup_function_calls_in_file', '_install_package_indices', '_get_S4_methods_list', '_check_package_code_data_into_globalenv', '_eval_with_capture', 'length_pdf_doc', '_write_description', '_load_package_quietly', 'delimMatch', 'format_check_package_description2', '_parse_usage_as_much_as_possible', 'format_pdf_fonts', '_make_S3_group_generic_env', '_get_vignette_metadata', 'getVignetteEngine', '_package_apply', 'get_system_ABI', 'format_check_package_depends', 'format_check_package_description_encoding', '_get_standard_package_names', '_check_package_code_attach', '_make_S3_primitive_generic_env', '_rpy2r', 'makeDemoTable', 'getDepMtrx', '_match_ids_to_pdf_doc_names', '_Rd_get_item_tags', 'get_exclude_patterns', '_Rd_get_methods_description_table', '_check_Rd_metadata', '_shlib_objects_symbol_tables', '_check_package_compact_datasets', '_Rd_get_text', '_install_packages', 'evalWithOpt', '_Rdconv', '[[_pdf_doc', '_dquote_method_markup', '_Rd_get_argument_table', '_get_namespace_S3_methods_db', 'analyze_licenses', 'format_check_package_code_startup_functions', 'file_path_sans_ext', 'charset_to_Unicode', '_get_DESCRIPTION_fields_in_R_exts', '_check_packages_used_in_vignettes', '_build_Rd_db', '_extract_dependency_package_names', '_print_via_format', '_check_depdef', 'data2LazyLoadDB', 'closeLog', 'package_dependencies', '_translation', '_con_read_bytes', '_build_news_db', '_check_make_vars', 'C_getfmts', '_format_check_package_description_authors_at_R_field_results', '_find_HTML_links_in_library', '_get_example_texts_from_source_dir', 'md5sum', 'buildDepList', '_get_namespace_package_depends', '_BioC_version_associated_with_R_version', '[_pdf_doc', '_extract_news_from_Rd', '_Rdfiles2tex', 'get_S4_generics_with_methods', 'checkReplaceFuns', 'bibstyle', 'fsub1', 'massageExamples', '_OStype', '_package_env', '_install_package_description', '_check_dotInternal', '_check_package_subdirs', 'isBlankLineRd', '_pretty_print', '_write_Rd_contents_as_RDS', '_format_lines_with_indent', '_install_package_namespace_info', '_make_RFC_2822_email_address_regexp', '_check_packages', '_get_example_texts_from_example_dir', '_get_S4_generics', '_try_quietly', 'format_PDF_String', '_Rdnewer', '_check_package_code_shlib', 'doTabExpand', '_check_package_code_tampers', 'latin2table', '_find_calls_in_file', 'getBibstyle', '_haveRds', '_check_packages_used', 'expand_license_spec_component_from_db', '_check_package_compact_sysdata', '_env', '_replace_chars_by_hex_subs', 'invalid_HTML_chars_re', 'format_check_package_code_assign_to_globalenv', '_build_vignette_index', '_make_R_license_db', 'codocClasses', 'check_nonASCII2', 'format_codocData', '_package_dependencies', '_pretty_format', 'format_checkDocStyle', '_check_Rd_contents', 'getVignetteEncoding', 'getVigDepMtrx', 'detachPackages', '_transform_S3_method_markup', '_update_package_rds', 'check_so_symbols', '_check_package_CRAN_incoming', 'getRemotePkgDepends', '_wrong_args', 'mime_canonical_encoding', 'file_test', 'noteLog', 'format_check_packages_used', '_split_op_version', 'format_compactPDF', 'messageLog', '_Rd_get_name', '_build_packages', 'latexToUtf8', '_check_T_and_F', '_test_package_depends_R_version', '_build_hsearch_index', 'config_val_to_logical', '_runPackageTestsR', '_writePkgIndices', '_Rd_format_title', '_getVignetteEncoding', 'escapeAmpersand', 'list_files_with_type', '_standardizable_license_specs', '_hidden_file_exclusions', '_build_library_links_index', '_remove_stale_dups', '_Rprof', '_DESCRIPTION_to_latex', 'find_vignette_product', '_check_packages_used_helper', 'format_check_depdef', '_noGenerics', '_check_package_datasets', 'installedDepends', '_build_repository_package_db_from_source_dirs', '_call_names', '_build_Rd_xref_db', 'format_check_package_datasets', '_createExdotR', '_expand_package_description_db_R_fields', 'format_checkTnF', '_system_with_capture', 'format_PDF_Array', 'format_checkReplaceFuns', '_is_ISO_8859', '_Rd_drop_comments', '_Rd_get_title', 'makeHelpTable', '_is_S3_generic', '_get_requires_from_package_db', 'get_IANA_character_sets', '_Rd_get_section', '_build_news_db_from_package_NEWS_Rd', 'isBlankRd', '_get_standard_repository_URLs', '_convertRdfiles', 'codoc', 'format_pdf_info', '_format_calls_in_file', '_con_seek', '_source_assignments_in_code_dir', 'format_check_Rd_line_widths', '_make_S3_primitive_nongeneric_env', '__Rdnewer', 'installFoundDepends', '_check_namespace', '_check_vignette_index', '_parse_CITATION_file', '_Rd2pdf', '__doc__', 'checkTnF', 'assertCondition', '_writeVignetteHtmlIndex', 'assertError', '_exported_names', 'delim_match', 'checkFF', '_check_citation', '_is_call_from_replacement_function_usage', '_check_package_license', 'makeLatexTable', '_bad_call_names_in_startup_functions', '_find_charset', '_get_namespace_from_package_env', '_split_description', 'analyze_check_log', 'analyze_license', '_ref_to_name', '_install_package_code_files', '__rname__', '_arg_names_from_call', 'as_alist_symbol', '_get_internal_S3_generics', '_makeDllRes', '_deparseTrim', 'CRAN_check_details', '_find_calls', 'format_summarize_CRAN_check_status', 'file_path_as_absolute', 'format_check_package_license', 'format_checkFF', '_functions_to_be_ignored_from_usage', '_vinstall_package_descriptions_as_RDS', 'buildVignette', 'analyze_licenses_in_license_db', '_file_path_relative_to_dir', 'format_check_T_and_F', 'format_check_Rd_metadata', 'loadVignetteBuilder', '_check_packages_used_in_examples', '_check_package_ASCII_code', 'getDepList', 'engineMatches', '_Rd_get_latex', '_pkg2tex', 'format_undoc', 'creatingLog', 'encoded_text_to_latex', '_unpacked_source_repository_apply', '_shlib_internal', '_parse_code_file', '_httpd_handlers_env', 'build_license_db', '_get_standard_Rd_keywords', 'foundDepends', '_check_code_usage_in_package', 'compactPDF', '%_IN_%', 'Adobe_glyphs', 'checkPoFile', 'add_datalist', '_vinstall_package_namespaces_as_RDS', 'expandDynamicFlags', 'codocData', 'deparseRdElement', 'newLog', 'check_packages_in_dir', '_install_package_Rd_objects', '_read_Rd_lines_quietly', 'as_character_Rd', '_Rd_get_example_code', '_build_news_db_from_R_NEWS_Rd', '_get_unload_function_calls_in_file', '_Rdiff', 'BibTeX_entry_field_db', 'C_parseRd', '_find_cinclude_paths', 'latexTable', '_split_dependencies', 'httpd', 'errorLog', '_file_append_ensuring_LFs', 'checkingLog', '__name__', '_install_package_demo_index', 'find_wide_Rd_lines_in_Rd_db', 'cleanupLatex', 'format_codocClasses', 'en_quote', '_installMD5sums', 'format_check_package_CRAN_incoming', '_news_reader_default', 'latin1table', '_find_owner_env', '_check_Rd_xrefs', 'list_data_in_pkg', '_read_collate_field', '_get_BibTeX_errors_from_blg_file', 'format_check_so_symbols', 'checkDocStyle', '_Rd_get_doc_type', 'format_subdir_tests', 'format_checkS3methods', '_check_Rd_line_widths', '_vinstall_package_indices', 'format_PDF_Indirect_Reference', 'find_gs_cmd', '_Rd_get_xrefs', 'HTMLheader', '_is_ASCII', 'format_check_package_code_attach', '_check_package_description', '_strip_whitespace', '_check_package_parseRd', 'httpdPort', '_make_R_license_db_vars', '_get_LaTeX_errors_from_log_file', 'format_check_nonAPI_calls', '_get_standard_DESCRIPTION_fields', '_install_package_Rd_indices', 'dir_exists', 'checkVignettes', '_Rd_get_metadata', 'isSatisfied', '_check_package_description_encoding', '_check_demo_index', '_onLoad', '_install_package_demos', 'CRAN_memtest_notes', '_check_package_depends', 'format_check_code_usage_in_package', '_S3_method_markup_regexp', 'makeLazyLoading', '_build_links_index', 'format_check_dotInternal', '_parse_text_as_much_as_possible', '_make_news_db', 'C_deparseRd', '_source_assignments', '_strip_backticks', 'latex_tag', '_make_siglist', 'get_CITATION_entry_fields', 'format_checkDocFiles', '_runPackageTests', '__Rd2pdf']
    

    Again, only with import from rpy2.interactive.

  6. Log in to comment