question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Task exception at: Install Python packages

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sudankingcommented, Jul 22, 2020

hi,

I fix that by adding

vars: ansible_python_interpreter: /usr/bin/python3

before roles.

0reactions
nickjjcommented, Jul 19, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found