Closed eriknelson closed 1 year ago
Do you have six
installed (in the virtualenv)?
venv310 ❯ python3
Python 3.10.8 (main, Nov 26 2022, 14:47:47) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dopy
>>> from dopy.manager import DoError, DoManager
>>> dopy.__version__
'0.3.6'
>>>
venv310 ❮ python3
Python 3.10.8 (main, Nov 26 2022, 14:47:47) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dopy
>>> from dopy.manager import DoError, DoManager
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mark/venv310/lib/python3.10/site-packages/dopy/manager.py", line 10, in <module>
from six import wraps
ModuleNotFoundError: No module named 'six'
>>> dopy.__version__
'0.3.7'
I think we'd be seeing this in the Ansible output if this pass were replaced with raise
.
# python3
Python 3.10.8 (main, Nov 23 2022, 19:29:54) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dopy
>>> from dopy.manager import DoError, DoManager
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/git/dopy-issue-repro/.venv/lib/python3.10/site-packages/dopy/manager.py", line 10, in <module>
from six import wraps
ModuleNotFoundError: No module named 'six'
@mamercad +1, seeing the same error with 0.3.7. Is this unexpected behavior with 0.3.7 in that six should be pulled in automatically?
six should be pulled in automatically?
Yeah, seems like it should ... I'm not familiar enough with the idea behind ansible.module_utils.six
(i.e., seems like the Ansible project decided to vendor it for some reason ... why? I have no idea). It's also frustrating that Ansible still insists on Python 2.x support years after its end-of-life.
Manually installing the latest six
beforehand seems to do the trick:
venv310 ❯ pip3 install six
Collecting six
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six
Successfully installed six-1.16.0
venv310 ❯ python3
Python 3.10.8 (main, Nov 26 2022, 14:47:47) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dopy
>>> from dopy.manager import DoError, DoManager
>>> dopy.__version__
'0.3.7'
It's also frustrating that Ansible still insists on Python 2.x support years after its end-of-life.
+1, no problem. Thank you for your help @mamercad, I'll manually pull in six and will migrate to your updated collection when it arrives. Closing as its wontfix and I have a solid workaround.
It's also frustrating that Ansible still insists on Python 2.x support years after its end-of-life.
+1, no problem. Thank you for your help @mamercad, I'll manually pull in six and will migrate to your updated collection when it arrives. Closing as its wontfix and I have a solid workaround.
Sounds good, there'll be a ton of breaking changes, so, it'll definitely be a 2.x.y release.
SUMMARY
I am using Arch Linux and would like to use
pyenv
andvirtualenv
to keep my projects clean. I'm trying to use the DO collection to spawn some infra, but I am getting the following error despite havingdopy==0.3.7
installed into the virutalenv. If I revert to0.3.6
, it actually finds it, but I'm unable to spawn droplets as it complains about the usage ofbasestring
indopy
(I want to use python3).ISSUE TYPE
COMPONENT NAME
community.digitalocean.digital_ocean
, although all of the modules seem to be affected by the same problem.ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
pip 22.2.2 from /home/ernelson/.pyenv/versions/3.10.8/lib/python3.10/site-packages/pip (python 3.10)
virtualenv 20.17.1 from /home/ernelson/.pyenv/versions/3.10.8/lib/python3.10/site-packages/virtualenv/__init__.py
STEPS TO REPRODUCE
See https://github.com/eriknelson/dopy-issue-repro for a repository with instructions to reproduce. It's as close to what I considered essential extracted from a much larger project of mine.
EXPECTED RESULTS
dopy
should be recognizable as installed, and I should be able to use the pyenv installed python3 with my virtualenv.ACTUAL RESULTS