Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing mbed-cli fails to install prettytable #245

Closed
bremoran opened this issue Jun 29, 2016 · 10 comments
Closed

Installing mbed-cli fails to install prettytable #245

bremoran opened this issue Jun 29, 2016 · 10 comments

Comments

@bremoran
Copy link
Contributor

mbed-cli requires prettytable, but it is not installed by pip which makes it impossible to compile with mbed compile

File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/make.py", line 42, in <module>
    from tools.options import get_default_options_parser
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/options.py", line 18, in <module>
    from tools.toolchains import TOOLCHAINS
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/toolchains/__init__.py", line 34, in <module>
    from tools.memap import MemapParser
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/memap.py", line 13, in <module>
    from prettytable import PrettyTable
ImportError: No module named prettytable
[mbed ERROR] "python" returned error code 1.
@screamerbg
Copy link
Contributor

@bremoran Can you copy paste the output of mbed import mbed-os?

@bremoran
Copy link
Contributor Author

I have installed prettytable now.

In my application directory,

$ mbed import mbed-os
[mbed ERROR] Cannot import program in the specified location "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os" because it's already part of a program "mbed-os-ucmm".
[mbed ERROR] Please change your working directory to a different location or use "mbed add" to import the URL as a library.
---

outside of it,

$ mbed import mbed-os
[mbed] Importing program "mbed-os" from "https://github.com/ARMmbed/mbed-os/" at latest revision in the current branch
Username for 'https://github.com': 

@screamerbg
Copy link
Contributor

screamerbg commented Jun 29, 2016

@bremoran Either mbed import <url> or mbed add <url> will give you warning about missing python modules based on the requirements of the mbed OS release. E.g.

[mbed] WARNING: The mbed build tools in this program require Python modules that are not installed.
[mbed] WARNING: This might prevent compiling code or exporting to IDEs and other toolchains.
[mbed] WARNING: The missing Python modules are: mbed-greentea, junit-xml, requests
[mbed] WARNING: You can install all missing modules by running "pip install -r requirements.txt" in "/private/tmp/testme/core"

Different versions of the OS might require different python modules or even different versions of the same python module (e.g. project-generator). The process of installing python modules is left up to the user as they may want to use venv instead of global for example.

As for the issue itself, have you actually followed the onscreen instructions? :)

@bremoran
Copy link
Contributor Author

Yes, I have followed the instructions.

I uninstalled everything and have reproduced the problem:

annirak:~/workspace $ python --version
Python 2.7.6
annirak:~/workspace $ sudo pip install mbed-cli                                                                                                                                                               
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mbed-cli
Installing collected packages: mbed-cli
Successfully installed mbed-cli-0.8.1
annirak:~/workspace $ mbed new --protocol ssh mbed-os-ucmm
[mbed] WARNING: Directory "mbed-os-ucmm" is not empty.
---
[mbed] Creating new program "mbed-os-ucmm" (git)
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os/" at latest revision in the current branch
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/core" from "https://github.com/mbedmicro/mbed/" at rev #737a7809f9e7
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_IPV6/sal-stack-nanostack-eventloop" from "https://github.com/ARMmbed/sal-stack-nanostack-eventloop/" at rev #c163be9183b0
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_IPV6/mbed-mesh-api" from "https://github.com/ARMmbed/mbed-mesh-api/" at rev #0e92921f3dce
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_IPV6/nanostack-hal-mbed-cmsis-rtos" from "https://github.com/ARMmbed/nanostack-hal-mbed-cmsis-rtos/" at rev #36968fc133c7
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_IPV6/mbed-trace" from "https://github.com/ARMmbed/mbed-trace/" at rev #e419c488f4f8
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_IPV6/sal-stack-nanostack-private" from "https://github.com/ARMmbed/sal-stack-nanostack-private/" at rev #5d3365ce7df3
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_IPV6/nanostack-libservice" from "https://github.com/ARMmbed/nanostack-libservice/" at rev #f61c845e0c59
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_CLIENT/mbed-client-randlib" from "https://github.com/ARMmbed/mbed-client-randlib/" at rev #80f5c491dd4d
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_CLIENT/coap-service" from "https://github.com/ARMmbed/coap-service/" at rev #7a11be1ccb07
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_CLIENT/mbed-client-mbed-tls" from "https://github.com/ARMmbed/mbed-client-mbed-tls/" at rev #b14e7b3303c8
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_CLIENT/mbed-client" from "https://github.com/ARMmbed/mbed-client/" at rev #a6a46726f027
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_CLIENT/mbed-client-classic" from "https://github.com/ARMmbed/mbed-client-classic/" at rev #c8ccada6b9ff
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/features/FEATURE_CLIENT/mbed-client-c" from "https://github.com/ARMmbed/mbed-client-c/" at rev #086b9c97f65b
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/frameworks/greentea-client" from "https://github.com/ARMmbed/greentea-client/" at rev #646297c0a1aa
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Adding library "mbed-os/frameworks/unity" from "https://github.com/ARMmbed/unity/" at rev #14fd303f30f9
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[mbed] Updating reference "mbed-os" -> "https://github.com/ARMmbed/mbed-os/#60b8656d29dbd5a9d7f619f3cace1a7a1da96c7d"
The following paths are ignored by one of your .gitignore files:
mbed-os.lib
Use -f if you really want to add them.
annirak:~/workspace $ cd mbed-os-ucmm/
annirak:~/workspace/mbed-os-ucmm (master) $ mbed compile -t GCC_ARM -m K64F
Traceback (most recent call last):
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/make.py", line 42, in <module>
    from tools.options import get_default_options_parser
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/options.py", line 18, in <module>
    from tools.toolchains import TOOLCHAINS
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/toolchains/__init__.py", line 34, in <module>
    from tools.memap import MemapParser
  File "/home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/memap.py", line 13, in <module>
    from prettytable import PrettyTable
ImportError: No module named prettytable
[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u /home/ubuntu/workspace/mbed-os-ucmm/mbed-os/core/tools/make.py -t GCC_ARM -m K64F --source . --build ./.build/K64F/GCC_ARM" in "/home/ubuntu/workspace/mbed-os-ucmm"
---
annirak:~/workspace/mbed-os-ucmm (master) $ 

@bremoran
Copy link
Contributor Author

Different versions of the OS might require different python modules or even different versions of the same python module (e.g. project-generator). The process of installing python modules is left up to the user as they may want to use venv instead of global for example.

This is setup.py's responsibility, not the user's.

@screamerbg
Copy link
Contributor

screamerbg commented Jul 1, 2016

@bremoran Please update mbed CLI to 0.8.2 (latest). This should give you a warning that you have python modules missing and provide you with clear instructions how to install them (either inside venv or global)

@bremoran
Copy link
Contributor Author

bremoran commented Jul 5, 2016

@screamerbg It is standard practice in python modules to automatically install missing dependencies that are available via pip. Is there a reason we are not following this well-established convention?

@screamerbg
Copy link
Contributor

PR #280 (and requirements in #262) aim to handle this.

@screamerbg
Copy link
Contributor

This will be handled directly in the mbed OS tools. See @sg- 's comment here #280 and also ARMmbed/mbed-os#2257

@screamerbg
Copy link
Contributor

Is already being handled in the tools. Just update to the latest revision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants