When developing a WEB API that runs on Elastic Beanstalk on AWS, [you need to use Python 3.4, which is a slightly older version](http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/ dg / create-deploy-python-container.html).
And this time, I encountered a situation where there is a library that works properly in Python 3.6, but does not work in 3.4 unless you specify the version in detail.
Therefore, when I investigated how to comment out to make a note of the information "Why are you not using the latest version" in `requirements.txt```, it is OK with` `#`
as in Python itself. was.
...
ply==3.8
# Python3.4 fails to import the latest version
protobuf==3.2.0rc2
pyasn1==0.3.3
...
I found it in this description. Normally, it is automatically generated by pip freeze> requirements.txt
, so it seems that there are not many opportunities to write comments.
https://github.com/pypa/pip/issues/564
A line beginning with # is treated as a comment and ignored, so you can just place your comment on the line above instead of on the same line.
This is the end of the subject of this article, but I am not convinced that the behavior itself that "it does not work unless you specify the version in detail in 3.4", so I will investigate it once it is ready to work.
Specifically, in Python 3.4, an error occurs in importing 3.4.0 of `` `protobuf``` library, so 3.2. I had to use 0rc2 (even the versions before and after that didn't work).
File "/home/ninomiyt/eb-virt/local/lib/python3.4/site-packages/google/cloud/client.py", line 26, in <module>
from google.cloud._helpers import _determine_default_project
File "/home/ninomiyt/eb-virt/local/lib/python3.4/site-packages/google/cloud/_helpers.py", line 33, in <module>
from google.protobuf import duration_pb2
ImportError: No module named 'google.protobuf'
Normally, it would be cool to be able to write an article after identifying the cause of the error and sending a pull request (or raising an issue), but for the time being, giving priority to releasing and finishing the work.
Recommended Posts