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

ImportError: cannot import name 'with_argparser_and_unknown_args' from 'cmd2' #42

Open
mdhuynh opened this issue Sep 30, 2021 · 4 comments

Comments

@mdhuynh
Copy link

mdhuynh commented Sep 30, 2021

Hi, after installing mptcpanalyzer I cannot use it because of import error. I already check tshark 3.2.3 and python version is 3.8.10.

The full error when call mptcpanalyzer:

root@ubuntu:~# mptcpanalyzer 
Traceback (most recent call last):
  File "/root/.local/bin/mptcpanalyzer", line 5, in <module>
    from mptcpanalyzer.cli import main
  File "/root/.local/lib/python3.8/site-packages/mptcpanalyzer/cli.py", line 52, in <module>
    from cmd2 import with_argparser, with_argparser_and_unknown_args, with_category, argparse_completer
ImportError: cannot import name 'with_argparser_and_unknown_args' from 'cmd2' (/root/.local/lib/python3.8/site-packages/cmd2/__init__.py)
@teto
Copy link
Owner

teto commented Oct 5, 2021

thanks for the report, I need to do a new release as cmd2 has evolved a lot.

@huynhducmanh
Copy link

Thank you!

@teto
Copy link
Owner

teto commented Oct 11, 2021

I've merged some changes in master, could you try installing/running it with poetry ? poetry install once in the mptcpanalyzer folder.

@mdhuynh
Copy link
Author

mdhuynh commented Oct 13, 2021

poetry install
Creating virtualenv mptcpanalyzer-zORLJ__I-py3.8 in /home/manh/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 31 installs, 0 updates, 0 removals

• Installing certifi (2021.10.8)
• Installing charset-normalizer (2.0.6)
• Installing idna (3.2)
• Installing pycparser (2.20)
• Installing six (1.16.0)
• Installing urllib3 (1.26.7)
• Installing wcwidth (0.2.5)
• Installing attrs (21.2.0)
• Installing blessed (1.19.0)
• Installing cffi (1.14.6)
• Installing colorama (0.4.4)
• Installing cycler (0.10.0)
• Installing docopt (0.6.2)
• Installing kiwisolver (1.3.2)
• Installing numpy (1.21.1)
• Installing pbr (5.6.0)
• Installing pillow (8.3.2)
• Installing pycairo (1.20.1): Failed

EnvCommandError

Command ['/home/manh/.cache/pypoetry/virtualenvs/mptcpanalyzer-zORLJ__I-py3.8/bin/pip', 'install', '--no-deps', '/home/manh/.cache/pypoetry/artifacts/3e/20/e5/21a82739918dbf71bd51804af7a9d5acf7a8a035e3609f2e3bf734102d/pycairo-1.20.1.tar.gz'] errored with the following return code 1, and output:
Processing /home/manh/.cache/pypoetry/artifacts/3e/20/e5/21a82739918dbf71bd51804af7a9d5acf7a8a035e3609f2e3bf734102d/pycairo-1.20.1.tar.gz
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: pycairo
Building wheel for pycairo (PEP 517): started
Building wheel for pycairo (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/manh/.cache/pypoetry/virtualenvs/mptcpanalyzer-zORLJ__I-py3.8/bin/python /home/manh/.cache/pypoetry/virtualenvs/mptcpanalyzer-zORLJ__I-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpqd1jsooz
cwd: /tmp/pip-req-build-67f2iqst
Complete output (12 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cairo
copying cairo/init.py -> build/lib.linux-x86_64-3.8/cairo
copying cairo/init.pyi -> build/lib.linux-x86_64-3.8/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
running build_ext
'pkg-config' not found.
Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']
----------------------------------------
ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 21.2.4; however, version 21.3 is available.
You should consider upgrading via the '/home/manh/.cache/pypoetry/virtualenvs/mptcpanalyzer-zORLJ__I-py3.8/bin/python -m pip install --upgrade pip' command.

at ~/.local/lib/python3.8/site-packages/poetry/utils/env.py:1183 in run
1179│ output = subprocess.check_output(
1180│ cmd, stderr=subprocess.STDOUT, **kwargs
1181│ )
1182│ except CalledProcessError as e:
→ 1183│ raise EnvCommandError(e, input=input
)
1184│
1185│ return decode(output)
1186│
1187│ def execute(self, bin, *args, **kwargs):

• Installing pyparsing (2.4.7)
• Installing pyperclip (1.8.2)
• Installing python-dateutil (2.8.2)
• Installing pytz (2021.3)
• Installing requests (2.26.0)

I got the above return, then I tried to brew install pycairo and then run mptcpanalyzer but mptcpanalyzer: command not found

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

No branches or pull requests

3 participants