Colcon build cannot import name 'autocomplete' from 'argcomplete' [closed]

asked 2020-12-12 16:29:52 -0500

guiljaune gravatar image

updated 2020-12-14 11:44:12 -0500

sloretz gravatar image

Hi

I am running (trying) ros2 on ubuntu virtual machine by following a tutorial. When I try to build the package in the workspace, i get this error. Anyone could help? I am thinking that my installation is not correct but i have retried everything...

Thanks, BTW I am a total beginner in Linux and ros...

Traceback (most recent call last):
  File "/usr/bin/colcon", line 11, in <module>
    load_entry_point('colcon-core==0.6.1', 'console_scripts', 'colcon')()
  File "/usr/lib/python3/dist-packages/colcon_core/command.py", line 118, in main
    return _main(command_name=command_name, argv=argv)
  File "/usr/lib/python3/dist-packages/colcon_core/command.py", line 161, in _main
    args = parser.parse_args(args=argv)
  File "/usr/lib/python3/dist-packages/colcon_defaults/argument_parser/defaults.py", line 129, in parse_args
    return self._parser.parse_args(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/colcon_argcomplete/argument_parser/argcomplete/__init__.py", line 85, in parse_args
    from argcomplete import autocomplete
ImportError: cannot import name 'autocomplete' from 'argcomplete' (/home/guiljaune/.local/lib/python3.8/site-packages/argcomplete/__init__.py)
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by guiljaune
close date 2020-12-18 15:38:39.983475

Comments

Hmm, looks like a problem with the argcomplete installation. What's the output of this command pip3 freeze | grep argcomplete inside the virtual machine?

sloretz gravatar image sloretz  ( 2020-12-14 11:43:47 -0500 )edit

argcomplete==1.12.2 colcon-argcomplete==0.3.3

guiljaune gravatar image guiljaune  ( 2020-12-14 14:05:07 -0500 )edit

Hmm, I installed argcomplete1.12.2, and the python import from argcomplete import autocomplete succeeds. What's the output of

python3 -c 'import argcomplete; import inspect; print(inspect.getsourcefile(argcomplete)); from argcomplete import autocomplete; print(autocomplete)'

I see

/tmp/env3/lib/python3.6/site-packages/argcomplete/__init__.py
<argcomplete.CompletionFinder object at 0x7fe2803e7ba8>

(/tmp/env3 because I created a venv to test argcomplete 1.12.2)

sloretz gravatar image sloretz  ( 2020-12-18 12:42:22 -0500 )edit
1

I don't understand why but I uninstalled argcomplete than source the ros2 setup.bash file and reinstalled the argcomplete and it worked?

FYi I am following a tutorial on Udemy

guiljaune gravatar image guiljaune  ( 2020-12-18 15:38:14 -0500 )edit

I have a similar error can you show me how you went about uninstalling argcomplete?

DMTxZel gravatar image DMTxZel  ( 2021-03-08 19:57:52 -0500 )edit