Error: `PluginNotFound: plugin pybtex.database.input.bibtex not found` when using pybtex on `Google Colab`
Running the following lines on Google Colab
gives an error but running the same lines locally with the same version of pybtex
gives no error.
Script
%pip show pybtex
import pybtex
citations = pybtex.format_from_file(
"./book.bib",
"plain"
)
citations
Error
Name: pybtex
Version: 0.24.0
Summary: A BibTeX-compatible bibliography processor in Python
Home-page: https://pybtex.org/
Author: Andrey Golovizin
Author-email: ag@sologoc.com
License: MIT
Location: /usr/local/lib/python3.7/dist-packages
Requires: six, latexcodec, PyYAML
Required-by: pybamm
---------------------------------------------------------------------------
PluginNotFound Traceback (most recent call last)
<ipython-input-30-a0a7db8f2057> in <module>()
3 citations = pybtex.format_from_file(
4 "./book.bib",
----> 5 "plain"
6 )
7 citations
4 frames
/usr/local/lib/python3.7/dist-packages/pybtex/plugin/__init__.py in _load_entry_point(group, name, use_aliases)
79 for entry_point in pkg_resources.iter_entry_points(search_group, name):
80 return entry_point.load()
---> 81 raise PluginNotFound(group, name)
82
83
PluginNotFound: plugin pybtex.database.input.bibtex not found
Full trace
---------------------------------------------------------------------------
PluginNotFound Traceback (most recent call last)
<ipython-input-30-a0a7db8f2057> in <module>()
3 citations = pybtex.format_from_file(
4 "./book.bib",
----> 5 "plain"
6 )
7 citations
4 frames
/usr/local/lib/python3.7/dist-packages/pybtex/__init__.py in format_from_file(*args, **kwargs)
180 def format_from_file(*args, **kwargs):
181 """A convenience function that calls :py:meth:`.PybtexEngine.format_from_file`."""
--> 182 return PybtexEngine().format_from_file(*args, **kwargs)
183
184
/usr/local/lib/python3.7/dist-packages/pybtex/__init__.py in format_from_file(self, filename, *args, **kwargs)
90 :py:meth:`~.Engine.format_from_files`.
91 """
---> 92 return self.format_from_files([filename], *args, **kwargs)
93
94 def format_from_files(*args, **kwargs):
/usr/local/lib/python3.7/dist-packages/pybtex/__init__.py in format_from_files(self, bib_files_or_filenames, style, citations, bib_format, bib_encoding, output_backend, output_encoding, min_crossrefs, output_filename, add_output_suffix, **kwargs)
147 from pybtex.plugin import find_plugin
148
--> 149 bib_parser = find_plugin('pybtex.database.input', bib_format)
150 bib_data = bib_parser(
151 encoding=bib_encoding,
/usr/local/lib/python3.7/dist-packages/pybtex/plugin/__init__.py in find_plugin(plugin_group, name, filename)
109 return _load_entry_point(plugin_group + '.suffixes', suffix)
110 else:
--> 111 return _load_entry_point(plugin_group, _DEFAULT_PLUGINS[plugin_group])
112
113
/usr/local/lib/python3.7/dist-packages/pybtex/plugin/__init__.py in _load_entry_point(group, name, use_aliases)
79 for entry_point in pkg_resources.iter_entry_points(search_group, name):
80 return entry_point.load()
---> 81 raise PluginNotFound(group, name)
82
83
PluginNotFound: plugin pybtex.database.input.bibtex not found
Comments (5)
-
-
Hi, I run into the same issue, using the
to_string()
method in a local Jupyter notebook. It works if I run the same code from the console or a script. -
reporter Apologies for not following up. Thank you for your response, @mcmtroffaes, but this still does not work.
I tried installing pybtex explicitly, but the error persists. Here is where this error was reported again - https://github.com/pybamm-team/PyBaMM/issues/2524 - if it helps.
-
I might have a related issue: When running
python -m doctest pybtex/richtext.py
on a fresh repository clone, many tests fail withpybtex.plugin.PluginNotFound: plugin pybtex.backends.latex not found
Any ideas if this is related? (Or any advice on how to run the doctests?)
-
I ran into this issue in Jupyter by installing pybtex after starting my Python kernel. Whatever the cause, restarting the kernel after pybtex installation fixed the issue for me.
- Log in to comment
One scenario where I’ve seen similar errors (PluginNotFound) is when the entry points are not installed, for whatever reason. Is it possible to install pybtex on Google Colab by running
!pip install pybtex
? This seems to be documented here: https://colab.research.google.com/notebooks/snippets/importing_libraries.ipynb Bear in mind I know nothing about Google Colab, so my apologies if you’re already doing that and it didn’t work.