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

ec2_metadata package not installed automatically #38

Open
JeanFred opened this issue Apr 7, 2020 · 1 comment
Open

ec2_metadata package not installed automatically #38

JeanFred opened this issue Apr 7, 2020 · 1 comment
Assignees

Comments

@JeanFred
Copy link

JeanFred commented Apr 7, 2020

Hello,

The aws-ec2-assign-elastic-ip package (installed via pip) got upgraded in our environment from 0.8.1 to 0.10.2. With that new version, the call to aws-ec2-assign-elastic-ip fails with

Traceback (most recent call last):
  File "/usr/bin/aws-ec2-assign-elastic-ip", line 26, in <module>
    import aws_ec2_assign_elastic_ip
  File "/usr/lib/python2.7/site-packages/aws_ec2_assign_elastic_ip/__init__.py", line 14, in <module>
    from ec2_metadata import ec2_metadata
ImportError: No module named ec2_metadata

Checking with pip freeze, and indeed the ec2_metadata package is not installed.

For now we solved by pinning to version 0.8.1.

Relevant packages installed (via pip freeze):

aws-ec2-assign-elastic-ip==0.10.2
boto3==1.12.36
botocore==1.15.36

$ aws --version
aws-cli/1.18.36 Python/2.7.5 Linux/5.6.2-1.el7.elrepo.x86_64 botocore/1.15.36

Hope this helps!

@sebdah
Copy link
Owner

sebdah commented Apr 10, 2020

Thanks for reporting this. I'm not able to replicate the issue. Below is an example where I created a virtualenv and ran pip install aws-ec2-assign-elastic-ip. I can then import the ec2_metadata package and also assign IPs.

If you could show me what the pip install output looks like, it'd be great. Might be that we could find some clues there.

Package list

(venv) sebdah@ip-10-10-92-207:~/test$ pip freeze
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
aws-ec2-assign-elastic-ip==0.10.2
boto3==1.12.39
botocore==1.15.39
cached-property==1.5.1
certifi==2020.4.5.1
chardet==3.0.4
docutils==0.15.2
ec2-metadata==1.8.0
futures==3.3.0
idna==2.9
jmespath==0.9.5
netaddr==0.7.19
python-dateutil==2.8.1
requests==2.23.0
s3transfer==0.3.3
six==1.14.0
urllib3==1.25.8

Importing ec2_metadata

(venv) sebdah@ip-10-10-92-207:~/test$ python
Python 2.7.15+ (default, Oct  7 2019, 17:39:04)
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ec2_metadata
>>> quit()

Running the application

(venv) sebdah@ip-10-10-92-207:~/test$ aws-ec2-assign-elastic-ip --dry-run
2020-04-10 04:40:17,712 - aws-ec2-assign-eip - INFO - Connected to AWS EC2 in eu-west-1
2020-04-10 04:40:17,909 - aws-ec2-assign-eip - INFO - Would assign IP 34.247.120.9

AWS CLI details

(venv) sebdah@ip-10-10-92-207:~/test$ aws --version
aws-cli/1.16.184 Python/2.7.15+ Linux/4.15.0-1041-aws botocore/1.12.174

@sebdah sebdah self-assigned this Apr 10, 2020
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

2 participants