Cannot enable plugins

I cannot seem to enable the bundled plugins on my Google Cloud VM Tutor instance.

When issuing the tutor plugins enable ecommerce (for example) command, I get:

XXXXXXXXXXXX:~$ tutor plugins enable ecommerce
Error applying action 'plugins:loaded:mfe': func=<function discover_package.<locals>.load at 0x7fd01edc9820> contexts=['plugins']'
⚠️  Failed to enable plugin 'mfe': (PyYAML 5.3.1 (/usr/lib/python3/dist-packages), Requirement.parse('pyyaml>=5.4.1'), {'kubernetes'})
Error applying action 'plugins:loaded:ecommerce': func=<function discover_package.<locals>.load at 0x7fd01edc9d30> contexts=['plugins']'
Traceback (most recent call last):
  File "/home/matthew_petersen/.local/bin/tutor", line 8, in <module>
    sys.exit(main())
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/commands/cli.py", line 24, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/click/decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/commands/plugins.py", line 73, in enable
    plugins.load(plugin)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/plugins/__init__.py", line 91, in load
    hooks.Actions.PLUGIN_LOADED(name).do()
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/hooks/actions.py", line 107, in do
    self.do_from_context(None, *args, **kwargs)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/hooks/actions.py", line 121, in do_from_context
    callback.do(
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/hooks/actions.py", line 34, in do
    self.func(*args, **kwargs)
  File "/home/matthew_petersen/.local/lib/python3.8/site-packages/tutor/plugins/v1.py", line 77, in load
    entrypoint.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2444, in load
    self.require(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2467, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (PyYAML 5.3.1 (/usr/lib/python3/dist-packages), Requirement.parse('pyyaml>=5.4.1'), {'kubernetes'})

I’m a total newcomer to Linux admin, so any clues would be appreciated.

Matthew P

According to the error message, you currently have PyYAML 5.3.1 installed and you need PyYAML 5.4.1

I would suggest you install PyYAML 5.4.1 with:
pip install PyYAML==5.4.1

You can check the version installed with:
pip show PyYAML

Thanks Pierre, I realise the answer was self evident in the message, but I was concerned about updating something that shouldn’t be updated (as noted in the Native install instructions).

As a matter of course, in Tutor, if something asks to be updated, should I take that advice? Any situations when I definitely shouldn’t?

I’ll try that update now.

Matthew P

Normally no, you are right you shouldn’t update anything that asks to be updated without you looking for the update. This is standard good security practice.

But in this case it is a dependency of the ecommerce plugins and kubernetes settings for Tutor. It doesn’t ask you to be updated. It tells you the appropriate version isn’t installed.

You can go ahead and install it.

This is an issue that has occurred to different people. Yet, I am unable to reproduce it. Can you help me understand what is going on by running the following commands, and pasting the output below:

pip freeze | grep tutor
pip freeze | grep kubernetes

I was one of these people. I guess the standard version of PyYAML installed with Ubuntu 20.04 was 5.3.1. On my case, I simply upgraded to 5.4.1 as soon as I encountered the error message the first time.

This is from an installation of one of my current test servers. Do not mind the tutor-ecommerce fork we use, it’s in order to forcibly remove PayPal from the Payment MFE page and forcibly display prices in CAD instead of USD on the Payment MFE too. Long history as they are both “standard” and “default” in the Payment MFE.

ubuntu@ip-10-0-0-73:~$ pip freeze | grep tutor

tutor==14.2.1

tutor-android==14.0.0

-e git+https://github.com/overhangio/tutor-discovery.git@fec9f3202cf690d436581d09ab2ab033dfd2e4f5#egg=tutor_discovery

-e git+https://github.com/EDUlib/tutor-ecommerce.git@43377843b2cc9a819d7154eb6470fc8deb6dd4a5#egg=tutor_ecommerce

tutor-forum==14.0.0

tutor-license==14.0.0

tutor-mfe==14.0.2

tutor-minio==14.0.0

tutor-notes==14.0.1

tutor-richie==14.0.0

tutor-webui==14.0.0

tutor-xqueue==14.0.0

ubuntu@ip-10-0-0-73:~$ pip freeze | grep kubernetes

kubernetes==24.2.0

Right. But installing kubernetes==24.2.0 should cause PyYaml>=5.4.1 to be installed, according to the package requirements:

I do not understand why pyyaml is not upgraded as part of the Tutor installation.

I was in the process of testing something for my migration and related to another issue.

I just ran this command on a server where I wanted to upgrade from Maple to Nutmeg:
pip install "tutor[full]==v14.2.3"

and somewhere near the end

ERROR: kubernetes 25.3.0 has requirement pyyaml>=5.4.1, but you’ll have pyyaml 5.3.1 which is incompatible.

And this time, I didn’t install 5.4.1 up until now.

ubuntu@ip-10-0-0-133:~$ pip show PyYAML

Name: PyYAML

Version: 5.3.1

Summary: YAML parser and emitter for Python

Home-page: GitHub - yaml/pyyaml: Canonical source repository for PyYAML

Author: Kirill Simonov

Author-email: xi@resolvent.net

License: MIT

Location: /usr/lib/python3/dist-packages

Requires:

Required-by: tutor, kubernetes

I can also confirm that I needed to install PyYAML 5.4.1 manually after I tried to run
**tutor plugins enable discovery ecommerce notes xqueue mfe forum**

It might be useful to know that up until Nutmeg, I was installing the binary version of Tutor. It complained about PyYAML 5.3.1 as soon as I tried to install it with pip.

Thanks for this detailed info. What OS are you running?

OK I managed to reproduce the issue on Ubuntu 20.04. I suspect that the issue occurs because tutor depends on pyyaml>=4.2b1. This minimal requirement will be upgraded to pyyaml>=6.0 in Olive, which should solve the issue once and for all.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.