Task exception at: Install Python packages
See original GitHub issueThis was de message:
TASK [nickjj.docker : Install Python packages] **************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named pkg_resources
failed: [droplet_ave] (item={u'state': u'present', u'name': u'docker'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "docker", "state": "present"}, "msg": "Failed to import the required Python library (setuptools) on ave's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named pkg_resources
failed: [droplet_ave] (item={u'path': u'/usr/local/bin/docker-compose', u'state': u'present', u'version': u'', u'name': u'docker-compose', u'src': u'/usr/local/lib/docker/virtualenv/bin/docker-compose'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "docker-compose", "path": "/usr/local/bin/docker-compose", "src": "/usr/local/lib/docker/virtualenv/bin/docker-compose", "state": "present", "version": ""}, "msg": "Failed to import the required Python library (setuptools) on ave's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
I fixed it executing this at target host:
sudo apt-get install --reinstall python-pkg-resources
Then Docker was successfully installed:
Docker version 19.03.12, build 48a66213fe
Some host details:
$ uname -a
Linux lhpc 5.3.0-62-generic #56-Ubuntu SMP Tue Jun 23 11:20:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
I am not sure if this case should be handled. Thanks. 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Running gulp task to install python libraries fails due ... - GitHub
Run the gulp task installPythonLibs. Expected It should install all the python libraries. Actual ERROR: Invalid requirement: '#' ERROR: ...
Read more >Azure DevOps python feed error on pip install - Stack Overflow
Azure DevOps python feed error on pip install. First, you need double check if the version 0.0.1234 of that package in the feed....
Read more >Installing Python Modules (Legacy version) — Python 3.11.1 ...
The “prefix scheme” is useful when you wish to use one Python installation to perform the build/install (i.e., to run the setup script),...
Read more >Python 3.11 Preview: Task and Exception Groups
Python 3.11 will be released in October 2022. In this tutorial, you'll install the latest alpha release of Python 3.11 in order to...
Read more >task - PyPI
Task cli tool. ... task 0.2.5. pip install task. Copy PIP instructions ... git clone https://github.com/matteyeux/task $ cd task $ poetry install ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

hi,
I fix that by adding
vars: ansible_python_interpreter: /usr/bin/python3before roles.
No problem. If you get an opportunity to test it with Python 3 and it still fails feel free to re-open this.
But I do use DigitalOcean personally and I tend to manually test the role on their latest Ubuntu / Debian releases before cutting any releases. I haven’t seen this popup when using Python 3.