Deleting uuid python package on aws beanstalk

2019-06-18 06:51发布

Here is a follow-up post /question to the issue raised here, just in case that might come in handy for someone else.

Since the first post I have kept experimenting and tried to deploy other apps that had a slightly different structure.

Eventually, I managed to deploy successfully on Beanstalk until I mistakenly added the uuid package with a pip freeze > requirements.txt to my requirements.txt and deployed it.

And then, exact same error(s) again. Rolling-back and removing the uuid from the .txt then becomes useless as it seems that once the venv is "corrupted" there is no way to get the environment back on track.

I tried several commands such as the ones described here and the ones listed below to delete the package but it didn't work. Any interaction with the venv returns the error described in the original post.

Commands tested:

pip3 uninstall uuid==1.30
pip3.4 uninstall uuid==1.30
pip3 uninstall uuid
pip3.4 uninstall uuid

The only way I found to move forward was to spin up a new environment and re-deploy. Which is not really satisfactory...

Would anyone know how to remove the uuid in such case and / or fix the issue while keeping the same environment?

Thanks,

Stf

2条回答
Melony?
2楼-- · 2019-06-18 07:36

Alternatively to deploying the fix using a container command, you can "eb ssh" into your (one and only?) instance and issue the rm command yourself manually.

#eb ssh
[ec2-user@ip-172-xx-xx-xx ~]$ rm /opt/python/run/venv/local/lib/python3.6/site-packages/uuid.py

Then you can manually remove the entry from your requirements.txt and re-deploy.

查看更多
\"骚年 ilove
3楼-- · 2019-06-18 07:44

Create a remove_uuid.config file on your .ebextensions dir with the following

container_commands:
  00-my-task:
    command: "rm /opt/python/run/venv/local/lib/python3.6/site-packages/uuid.py"
查看更多
登录 后发表回答