I have a requirements.txt file for a Python code base. The file has everything specified:
pytz==2017.2 requests==2.18.4 six==1.11.0
I am adding a new package. Should I list its version? If yes, how do I pick a version to specify?
A requirements file is a list of all of a project's dependencies. This includes the dependencies needed by the dependencies. It also contains the specific version of each dependency, specified with a double equals sign ( == ). pip freeze will list the current projects dependencies to stdout .
In Python requirement. txt file is a type of file that usually stores information about all the libraries, modules, and packages in itself that are used while developing a particular project. It also stores all files and packages on which that project is dependent or requires to run. Typically this file "requirement.
Solution 1: Just update pip You just need to update pip and your error will be resolve. Just follow this command. If you are windows users Then run this command. And then also upgrade setuptools after doing the above.
Check out the pip docs for more info, but basically you do not need to specify a version. Doing so can avoid headaches though, as specifying a version allows you to guarantee you do not end up in dependency hell.
Note that if you are creating a package to be deployed and pip-installed, you should use the install-requires metadata instead of relying on requirements.txt.
Also, it's a good idea to get into the habit of using virtual environments to avoid dependency issues, especially when developing your own stuff. Anaconda offers a simple solution with the conda create
command, and virtualenv
works great with virtualenvwrapper
for a lighter-weight solution. Another solution, pipenv
, is quite popular.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With