[SOLVED] ImportError: No module named 'mycroft'

Might be a simple answer, but I can’t find it and the similar topics don’t fix it.

The update last week broke my little PiCroft (pi 3) that has run for a year.

(.venv) pi@picroft:~ $ mycroft-cli-client
/home/pi/mycroft-core/.venv/bin/python: Error while finding spec for ‘mycroft.client.text’ (<class ‘ImportError’>: No module named ‘mycroft’)

(.venv) pi@picroft:~ $ mycroft-speak hello
/home/pi/mycroft-core/.venv/bin/python: Error while finding spec for ‘mycroft.messagebus.send’ (<class ‘ImportError’>: No module named ‘mycroft’)

(.venv) pi@picroft:~ $ mycroft-say-to “what time is it”
/home/pi/mycroft-core/.venv/bin/python: Error while finding spec for ‘mycroft.messagebus.send’ (<class ‘ImportError’>: No module named ‘mycroft’)

Hi there @riddle - so that we can help diagnose this, are you able to provide your;

  • Picroft hardware - ie 3B or 3B+?
  • Version of Mycroft you’re running - ie 18.8.2
  • Whether you installed from a Git repo, or burnt a disk image

This will help us with the starting points of debugging.

Hi,

  • It is on a pi-3B.
  • Trying to run latest (update.log only logged 18.8) (the version file says “Lighting preview”).
    The update.sh was last run that installed packages on Oct. 5.
  • the SD image was burnt from the 2/12/2017 image.

OK, a few things to try here.

  • First, from the command line, run an update by doing sudo apt-get update && sudo apt-get upgrade. This will pull in any mycroft-core code changes.
  • Then, it’s worth rebooting the RPi just for good measure. The reboot will also force a Skill update, but this error is not related to Skills.

Can you let me know how you go after this?

Thanks,
I should have reported that the favorite thing to run every few days is:
sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get autoremove && sudo reboot

Did it again, just for you :slight_smile:
No change.
Speak and Say-to are still not working with the same ImportError.

BTW - “mycroft-msm list” runs ok

Might be important… most of the logs in /var/log/mycroft contain:
Traceback (most recent call last):
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 578, in _build_master
ws.require(requires)
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 895, in require
needed = self.resolve(parse_requirements(requirements))
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 786, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.13.0 (/opt/venvs/mycroft-core/lib/python3.4/site-packages), Requirement.parse(‘requests==2.19.1’), {‘mycroft-core’})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/venvs/mycroft-core/bin/mycroft-skills”, line 6, in
from pkg_resources import load_entry_point
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 3112, in
@_call_aside
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 3096, in _call_aside
f(*args, **kwargs)
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 3125, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 580, in _build_master
return cls._build_from_requirements(requires)
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 593, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/init.py”, line 781, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘requests==2.19.1’ distribution was not found and is required by mycroft-core

usually mycroft-update.log reports 1 not upgraded. this time:
Hit http://download.mono-project.com wheezy InRelease
Hit http://download.mono-project.com wheezy-apache24-compat InRelease
Get:1 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Hit http://mirrordirector.raspbian.org jessie InRelease
Get:2 http://archive.raspberrypi.org jessie/main armhf Packages [170 kB]
Hit http://repo.mycroft.ai debian InRelease
Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Hit http://repo.mycroft.ai debian/main armhf Packages
Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages
Get:3 http://repo.mycroft.ai debian/main Translation-en [336 B]
Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Hit http://download.mono-project.com wheezy/main armhf Packages
Get:4 http://repo.mycroft.ai debian/main Translation-en [336 B]
Get:5 http://repo.mycroft.ai debian/main Translation-en [336 B]
Get:6 http://repo.mycroft.ai debian/main Translation-en [336 B]
Get:7 http://repo.mycroft.ai debian/main Translation-en [336 B]
Ign http://repo.mycroft.ai debian/main Translation-en
Hit http://download.mono-project.com wheezy-apache24-compat/main armhf Packages
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Ign http://download.mono-project.com wheezy/main Translation-en
Ign http://download.mono-project.com wheezy-apache24-compat/main Translation-en
Fetched 193 kB in 29s (6436 B/s)
Reading package lists…
Reading package lists…
Building dependency tree…
Reading state information…
mimic is already the newest version.
mycroft-core is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

And every hour /var/log/mycroft/update.log has:


Tue Oct 9 10:17:01 PDT 2018
Starting update
Fetching remote repos
Repo version available: 18.8
allowedVer=‘18.8’ availVer=‘18.8’
Updating…
Reading package lists…
Building dependency tree…
Reading state information…
mycroft-mark-1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Done


Tue Oct 9 11:17:01 PDT 2018
Starting update
Fetching remote repos
Repo version available: 18.8
allowedVer=‘18.8’ availVer=‘18.8’
Updating…
Reading package lists…
Building dependency tree…
Reading state information…
mycroft-mark-1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Done

Does the above say that,
Venvs has requests 2.13.0 and mycroft-core requires 2.19.1 ?

Thanks @riddle, yes this looks like it may be a package dependency issue. The other thing I noticed was that your image was from February 2017 - we’ve had three major releases since then so it may also be an option to install from a fresh disk image.

Using some pip commands, I’d like to see what you have installed.

Are you able to enter the virtual environment and run:

  • pip list
    and
  • pip list --outdated

and let me know what you see?

Thanks, I am away all weekend and will re-image next week.
There is other stuff on that Pi that I did not want to distroy, so was trusting updater.

1 Like

Fixed. Newest image updated and works.
This ticket can be closed

1 Like

Thanks for confirming, @riddle

For Python mbus commands, install package using: mycroft-pip install mycroft-messagebus-client, after activating the venv with source venv-activate.sh` in ~/mycroft-core/venv-activate.sh. From: https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mycroft-core/message-bus