问题
I have setup.py set to get the dependencies from requirements.txt that I generate from my virtual environment of the project. As follows:
In my venv:
pip3 freeze > requirements.txt
Then:
with open('requirements.txt') as f:
required = f.read().splitlines()
setuptools.setup(
...
install_requires=required,
...
)
But I have this error displayed when I try to install my package:
raise RequirementParseError(str(e))
pip._vendor.pkg_resources.RequirementParseError: Parse error at "'(===file'": Expected stringEnd
So when checking my requirements.txt file, I found this which must be the root cause of package installation failure:
avro-python3===file-.avro-VERSION.txt
I didn't install it explicitly it is a transitive dependency. And when I try to install avro-python3 it, I get the following error:
Requirement already satisfied: avro-python3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (file-.avro-VERSION.txt)
What can I do to fix my problem?
Thank you.
回答1:
This error happens because the setup
method is not expecting a version to have the format file-.avro-VERSION.txt
. I suspect that the character "-" is what bothers the parser, as it expects the string to end instead of that character.
I suggest you try to use one of the official versions on the requirements.txt
file and the problem should be gone.
来源:https://stackoverflow.com/questions/64223796/problem-installing-package-using-setup-py