Closed scotgopal closed 2 weeks ago
Could not import extension jaraco.packaging.sphinx (exception: No module named 'jaraco')
It looks like Esbonio is not using the right environment for your project.
In order to work correctly, Esbonio needs to use the same Python environment you use when building your docs outside of VSCode. Have you tried using the Python: Select Interpter
and/or setting the esbonio.server.pythonPath
option to select a different environment?
I can confirm that during the installation of the extension, Esbonio installed itself in my virtualenv.
I have used Python: Select Interpreter to ensure the correct selection of interpreter for this workspace and also have set the following in my workspace's settings.json
{
"esbonio.server.pythonPath": "/home/scotrraajgopal/setuptools/venv/bin/python"
}
I then reloaded VSCode, but still no changes.
I took things into my own hands and started pip installing the following packages into my virtualenv as they emerge as an ImportError in esbonio's output in VSCode:-
Now I'm facing the following error:-
Running Sphinx v8.0.2
loading translations [en]...
done
[esbonio.lsp] Traceback (most recent call last):
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/sphinx/events.py", line 100, in emit
results.append(listener.handler(self.app, *args))
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/jaraco/packaging/sphinx.py", line 115, in load_config_from_setup
meta = _load_metadata_from_wheel() or jp_metadata.load(root)
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/jaraco/packaging/metadata.py", line 15, in load
return util.project_wheel_metadata(source_dir, isolated, **kwargs)
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/build/util.py", line 49, in project_wheel_metadata
env.install(builder.get_requires_for_build('wheel'))
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/build/_builder.py", line 219, in get_requires_for_build
with self._handle_backend(hook_name):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/build/_builder.py", line 339, in _handle_backend
raise BuildBackendException(
build._exceptions.BuildBackendException: Backend 'setuptools.build_meta' is not available.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/esbonio/lsp/sphinx/__init__.py", line 149, in _initialize_sphinx
return self.create_sphinx_app(self.user_config) # type: ignore
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/esbonio/lsp/sphinx/__init__.py", line 343, in create_sphinx_app
app = Sphinx(**self.sphinx_args)
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/sphinx/application.py", line 277, in __init__
self.events.emit('config-inited', self.config)
File "/home/scotrraajgopal/setuptools/venv/lib/python3.10/site-packages/sphinx/events.py", line 111, in emit
raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function load_config_from_setup at 0x7f9a01f177f0> for event 'config-inited' threw an exception (exception: Backend 'setuptools.build_meta' is not available.)
For context, I'm trying to view the RSTs from setuptools
repo v59.8.0
I have setuptools v65.5.0 installed in the virtualenv.
It looks like you are still running into errors specific to the setuptools docs (which unfortunately I cannot help that much with).
I have setuptools v65.5.0 installed in the virtualenv.
I'm certainly not a setuptools expert, but there is a chance that is conflicting with the version of setuptools you're trying to build the docs for.
Looking at their developer guide they use tox to build the docs
$ tox -e docs
It might be worth giving that a go, tox
will create it's own isolated envrionment - probably in a path like /home/.../setuptools/.tox/docs
which you can then tell Esbonio to use.
It might also be worth trying the pre-release version of Esbonio (v0.95.1
), it will remove the requirement of having to install the esbonio
Python package into the docs
environment tox creates. If you do try it, just note the configuration is slightly different, instead of
// v0.11.0
{
"esbonio.server.pythonPath": "/home/scotrraajgopal/setuptools/venv/bin/python"
}
You would need
// v0.95.1
{
"esbonio.sphinx.pythonCommand": ["/home/scotrraajgopal/setuptools/venv/bin/python"]
}
Thank you for your kind support @alcarney . I have already tried tox -e docs
on v59.8.0 tag, but there seems to be an error, plus I'm only interested with viewing one of the .rst in their docs. Hence, I looked for an extension and came across esbonio.
I have tried to use the pre-release version and updated the settings.json
, but even then, I face the same issues as the release version.
I then checked-out setuptools's main branch and created a new venv. On this branch, I have no errors running tox -e docs
. But after re-installing esbonio Release Version, I am slightly dissapointed that it too doesn't work.
As a final resort, I am simply copy-pasting the content I want to read in an online rst viewer.
Maybe I'd have a better chance to debug this once I better understand how Sphinx works.
Pls do close this issue if this case doesn't need any more attention.
No worries! Sorry to hear you couldn't get it working, feel free to open another issue if you need help in the future :)
Expected behavior
When the render button (see image below) is clicked or if Ctrl+Shift+V keyboard combination, the rendered view of the .rst file should open to the side.
Esbonio version:
v0.11.0
Actual behavior
Nothing happens.
Log output
(Optional) Settings from conf.py
No response