MycroftAI / mycroft-core

Mycroft Core, the Mycroft Artificial Intelligence platform.
https://mycroft.ai
Apache License 2.0
6.48k stars 1.27k forks source link

Picroft mycroft-msk fails with import error on git library #3106

Open mikejgray opened 2 years ago

mikejgray commented 2 years ago

Describe the bug When I try to run mycroft-msk on a Picroft, I get an import error:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/bin/msk", line 5, in <module>
    from msk.__main__ import main
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/msk/__main__.py", line 23, in <module>
    from msk.actions.create import CreateAction
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/msk/actions/create.py", line 34, in <module>
    from msk.console_action import ConsoleAction
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/msk/console_action.py", line 21, in <module>
    from msk.global_context import GlobalContext
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/msk/global_context.py", line 23, in <module>
    from msk.util import ask_for_github_token
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/msk/util.py", line 25, in <module>
    from git.config import GitConfigParser, get_config_path
ImportError: cannot import name 'get_config_path' from 'git.config' (/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/git/config.py)

To Reproduce Steps to reproduce the behavior:

  1. Install Picroft on a Raspberry Pi 4 using the latest image from the documentation
  2. Execute mycroft-msk from the CLI

Expected behavior I get the wizard to create a skill template.

Environment (please complete the following information):

Additional context This is a clean installation from the Picroft image available via the docs.

mikejgray commented 2 years ago

Ah, it looks like this is due to #48. The workaround fixed my problem.

mikejgray commented 2 years ago

Happy to try to close, just unsure where. Does the requirements.txt in this repo need the update, or is there someplace else where the Picroft images are built?

forslund commented 2 years ago

Hi, so this is a bit tricky. The msk setup.py requires the gitpython module to be atleast 3.0.5 but somehow it's not respected by pip.

We could try to bump it even further (it's at 3.1.27 now so it may be time for a bump anyways) but I'm not sure about the root cause of the issue.

If you think it's worth a try:

As I said we never quite found out why it didn't update to the expected version on the picroft image so this may or may not be the right solution. :)

derekantrican commented 1 year ago

So I'm trying to develop a new skill and I'm hitting this error. I've more-or-less got my skill all set up by following the docs & another skill as an example but I want to test it on my mycroft (picroft) instance. What's the best way to get around this?

forslund commented 1 year ago

@derekantrican I think the simplest workaround is to run mycroft-pip install gitpython==3.0.5

derekantrican commented 1 year ago

Ah - perfect! I tried that with the exception of the mycroft- prefix but that caused some other issues. Did I do something wrong or does mycroft-pip do different stuff than pip?

forslund commented 1 year ago

mycroft-pip ensures that the package is installed in the correct virtual environment. Pip without the mycroft- could try to install it among the system packages which can can cause issues, would need sudo and the pavkage in the mycroft venv would be preferred over that one also.

Pip might work if the mycroft venv is activated but using mycroft-pip should always do the right thing