Yotta + mac issue: installed ... or is it?

I needed to use the --user python parameter to get yotta to install through pip on Mac OS X.

However, now yotta shows as installed under pip but “yotta” command yields “-bash: yotta: command not found”

any advice?

Manually symlink from your python modules folder into /usr/local/bin (or something else in your path) seems to be the easiest.

1 Like

Gonna try this when I get back to my Mac. Thank you!

UPDATE:

Unfortunately, now I have a gruesome python error. Not to be a troll but whenever I embark on a new project which involves python, it feels like a huge chance of one of these giant stacktrace spews happening and/or install nightmares. OK, rant off. here’s the spew:

info: get versions for st-nucleo-f401re-gcc
Fatal Exception, yotta=0.16.4
Traceback (most recent call last):
  File "/usr/local/bin/yotta", line 4, in <module>
    yotta.main()
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/main.py", line 61, in wrapped
    return fn(*args, **kwargs)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/main.py", line 46, in wrapped
    return fn(*args, **kwargs)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/main.py", line 243, in main
    status = args.command(args, following_args)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/build.py", line 46, in execCommand
    status = installAndBuild(args, following_args)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/build.py", line 74, in installAndBuild
    target, errors = c.satisfyTarget(args.target, additional_config=args.config)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/component.py", line 677, in satisfyTarget
    shrinkwrap = self.getShrinkwrap()
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/target.py", line 166, in getDerivedTarget
    inherit_shrinkwrap = shrinkwrap
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/access.py", line 385, in satisfyVersion
    name, version_required, working_directory, type=type, inherit_shrinkwrap = inherit_shrinkwrap
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/access.py", line 314, in satisfyVersionByInstalling
    v = latestSuitableVersion(name, version_required, _registryNamespaceForType(type))
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/access.py", line 107, in latestSuitableVersion
    vers = remote_component.availableVersions()
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/registry_access.py", line 484, in availableVersions
    return _listVersions(self.namespace, self.name)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/registry_access.py", line 100, in wrapped
    return fn(*args, **kwargs)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/registry_access.py", line 235, in _listVersions
    request_headers = _headersForRegistry(registry)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/registry_access.py", line 409, in _headersForRegistry
    auth_token = generate_jwt_token(_getPrivateKeyObject(registry), registry)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/registry_access.py", line 378, in _getPrivateKeyObject
    pubkey_pem, privatekey_pem = _generateAndSaveKeys(registry)
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/yotta/lib/registry_access.py", line 337, in _generateAndSaveKeys
    public_exponent=65537, key_size=2048, backend=default_backend()
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/cryptography/hazmat/backends/__init__.py", line 35, in default_backend
    _default_backend = MultiBackend(_available_backends())
  File "/Users/Malachi/Library/Python/2.7/lib/python/site-packages/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends
    "cryptography.backends"
AttributeError: 'EntryPoint' object has no attribute 'resolve'

This project last I checked compiles and runs properly from my other machines, but I can’t see what’s different here

OK, on Mac OS X you have to be careful. You must not only :

brew install python

But also be sure that THAT python is the one being used. By default, mac finds /usr/bin/python first before it finds /usr/local/bin/python. This is bad for us, because /usr/bin/python is a preinstalled python (on my 2 Macs) which doesn’t play nice with yotta. We want the /usr/local/bin/python, which is what brew installs.

Solution?

Use a .profile script which does this:

export PATH=~/.local/bin:$PATH

Then make a folder .local/bin and symlink (or copy in) the python of your choice

If you’re feeling brave you can meddle with /etc/paths and perhaps change the ordering. I wasn’t brave enough for that :slight_smile:

FYI, there’s more info on the why and such of that error here: yt target x86-linux-native fails with 'EntryPoint' object has no attribute 'resolve' · Issue #764 · ARMmbed/yotta · GitHub

(I ran into it as well, and I feel your pain).