Does Python requirements file have to specify version?How do I copy a file in Python?Does Python have a ternary conditional operator?How do I determine the size of an object in Python?How do I sort a dictionary by value?How do I check what version of Python is running my script?Use different Python version with virtualenvDoes Python have a string 'contains' substring method?Find all files in a directory with extension .txt in PythonHow do you append to a file in Python?Python and pip, list all versions of a package that's available?
How do conventional missiles fly?
What is required to make GPS signals available indoors?
Is it a bad idea to plug the other end of ESD strap to wall ground?
How badly should I try to prevent a user from XSSing themselves?
How obscure is the use of 令 in 令和?
Is this draw by repetition?
When handwriting 黄 (huáng; yellow) is it incorrect to have a disconnected 草 (cǎo; grass) radical on top?
Can compressed videos be decoded back to their uncompresed original format?
Should I tell management that I intend to leave due to bad software development practices?
Could neural networks be considered metaheuristics?
How does a dynamic QR code work?
Does int main() need a declaration on C++?
Car headlights in a world without electricity
How to stretch the corners of this image so that it looks like a perfect rectangle?
How could indestructible materials be used in power generation?
Do Iron Man suits sport waste management systems?
Why are UK visa biometrics appointments suspended at USCIS Application Support Centers?
Forgetting the musical notes while performing in concert
Is it possible to create a QR code using text?
How to compactly explain secondary and tertiary characters without resorting to stereotypes?
Finitely generated matrix groups whose eigenvalues are all algebraic
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Were days ever written as ordinal numbers when writing day-month-year?
Processor speed limited at 0.4 Ghz
Does Python requirements file have to specify version?
How do I copy a file in Python?Does Python have a ternary conditional operator?How do I determine the size of an object in Python?How do I sort a dictionary by value?How do I check what version of Python is running my script?Use different Python version with virtualenvDoes Python have a string 'contains' substring method?Find all files in a directory with extension .txt in PythonHow do you append to a file in Python?Python and pip, list all versions of a package that's available?
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?
python requirements.txt
add a comment |
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?
python requirements.txt
Are you using a virtual environment?
– Tom Mac
Mar 7 at 20:42
You happened to stumble on a contentious debate in Python. No you don't have to. Should you depends on your application. Can you describe what you are trying to do?
– pylang
Mar 7 at 22:08
@Tom Mac Yes, but out of curiosity, why do you ask?
– Intrastellar Explorer
Mar 7 at 23:27
@pylang I am just wondering, I try to follow best practices. The application is manufacturing automation - in this case a driver written in Python.
– Intrastellar Explorer
Mar 7 at 23:27
@Intrastellar Explorer I was going to suggest using one before you pip freezed into your requirements but you're sorted
– Tom Mac
Mar 7 at 23:56
add a comment |
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?
python requirements.txt
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?
python requirements.txt
python requirements.txt
edited Mar 7 at 21:36
Tom Mac
89113
89113
asked Mar 7 at 20:38
Intrastellar ExplorerIntrastellar Explorer
998
998
Are you using a virtual environment?
– Tom Mac
Mar 7 at 20:42
You happened to stumble on a contentious debate in Python. No you don't have to. Should you depends on your application. Can you describe what you are trying to do?
– pylang
Mar 7 at 22:08
@Tom Mac Yes, but out of curiosity, why do you ask?
– Intrastellar Explorer
Mar 7 at 23:27
@pylang I am just wondering, I try to follow best practices. The application is manufacturing automation - in this case a driver written in Python.
– Intrastellar Explorer
Mar 7 at 23:27
@Intrastellar Explorer I was going to suggest using one before you pip freezed into your requirements but you're sorted
– Tom Mac
Mar 7 at 23:56
add a comment |
Are you using a virtual environment?
– Tom Mac
Mar 7 at 20:42
You happened to stumble on a contentious debate in Python. No you don't have to. Should you depends on your application. Can you describe what you are trying to do?
– pylang
Mar 7 at 22:08
@Tom Mac Yes, but out of curiosity, why do you ask?
– Intrastellar Explorer
Mar 7 at 23:27
@pylang I am just wondering, I try to follow best practices. The application is manufacturing automation - in this case a driver written in Python.
– Intrastellar Explorer
Mar 7 at 23:27
@Intrastellar Explorer I was going to suggest using one before you pip freezed into your requirements but you're sorted
– Tom Mac
Mar 7 at 23:56
Are you using a virtual environment?
– Tom Mac
Mar 7 at 20:42
Are you using a virtual environment?
– Tom Mac
Mar 7 at 20:42
You happened to stumble on a contentious debate in Python. No you don't have to. Should you depends on your application. Can you describe what you are trying to do?
– pylang
Mar 7 at 22:08
You happened to stumble on a contentious debate in Python. No you don't have to. Should you depends on your application. Can you describe what you are trying to do?
– pylang
Mar 7 at 22:08
@Tom Mac Yes, but out of curiosity, why do you ask?
– Intrastellar Explorer
Mar 7 at 23:27
@Tom Mac Yes, but out of curiosity, why do you ask?
– Intrastellar Explorer
Mar 7 at 23:27
@pylang I am just wondering, I try to follow best practices. The application is manufacturing automation - in this case a driver written in Python.
– Intrastellar Explorer
Mar 7 at 23:27
@pylang I am just wondering, I try to follow best practices. The application is manufacturing automation - in this case a driver written in Python.
– Intrastellar Explorer
Mar 7 at 23:27
@Intrastellar Explorer I was going to suggest using one before you pip freezed into your requirements but you're sorted
– Tom Mac
Mar 7 at 23:56
@Intrastellar Explorer I was going to suggest using one before you pip freezed into your requirements but you're sorted
– Tom Mac
Mar 7 at 23:56
add a comment |
3 Answers
3
active
oldest
votes
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.
add a comment |
Specifying a version is not a requirement though it does help a lot in the future. Some versions of packages will not work well with other packages and their respective versions. It is hard to predict how changes in the future will effect these interrelationships. This is why it is very beneficial to create a snapshot in time (in your requirements.txt) showing which version interrelationships do work.
To create a requirements.txt file including the versions of the packages that you're using do the following. In your console/ terminal cd into the location that you would like your requirement.txt to be and enter:
pip freeze > requirements.txt
This will automatically generate a requirement.txt file including the packages that you have installed with their respective versions.
A tip - you should aim to be using a virtual environment for each individual project that you'll be working on. This creates a 'bubble' for you to work within and to install specific package versions in, without it effecting your other projects. It will save you a lot of headaches in the future as your packages and versions will be kept project specific. I suggest using Anacondas virtual environment.
add a comment |
No, there is no need to specify a version. It's probably a good idea to specify one, though.
If you want to specify a version but you don't know which version to specify, try using pip freeze, which will dump out a list of all the packages you currently have installed and what their versions are.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052434%2fdoes-python-requirements-file-have-to-specify-version%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
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.
edited Mar 7 at 20:47
answered Mar 7 at 20:42
EngineeroEngineero
6,41132351
6,41132351
add a comment |
add a comment |
Specifying a version is not a requirement though it does help a lot in the future. Some versions of packages will not work well with other packages and their respective versions. It is hard to predict how changes in the future will effect these interrelationships. This is why it is very beneficial to create a snapshot in time (in your requirements.txt) showing which version interrelationships do work.
To create a requirements.txt file including the versions of the packages that you're using do the following. In your console/ terminal cd into the location that you would like your requirement.txt to be and enter:
pip freeze > requirements.txt
This will automatically generate a requirement.txt file including the packages that you have installed with their respective versions.
A tip - you should aim to be using a virtual environment for each individual project that you'll be working on. This creates a 'bubble' for you to work within and to install specific package versions in, without it effecting your other projects. It will save you a lot of headaches in the future as your packages and versions will be kept project specific. I suggest using Anacondas virtual environment.
add a comment |
Specifying a version is not a requirement though it does help a lot in the future. Some versions of packages will not work well with other packages and their respective versions. It is hard to predict how changes in the future will effect these interrelationships. This is why it is very beneficial to create a snapshot in time (in your requirements.txt) showing which version interrelationships do work.
To create a requirements.txt file including the versions of the packages that you're using do the following. In your console/ terminal cd into the location that you would like your requirement.txt to be and enter:
pip freeze > requirements.txt
This will automatically generate a requirement.txt file including the packages that you have installed with their respective versions.
A tip - you should aim to be using a virtual environment for each individual project that you'll be working on. This creates a 'bubble' for you to work within and to install specific package versions in, without it effecting your other projects. It will save you a lot of headaches in the future as your packages and versions will be kept project specific. I suggest using Anacondas virtual environment.
add a comment |
Specifying a version is not a requirement though it does help a lot in the future. Some versions of packages will not work well with other packages and their respective versions. It is hard to predict how changes in the future will effect these interrelationships. This is why it is very beneficial to create a snapshot in time (in your requirements.txt) showing which version interrelationships do work.
To create a requirements.txt file including the versions of the packages that you're using do the following. In your console/ terminal cd into the location that you would like your requirement.txt to be and enter:
pip freeze > requirements.txt
This will automatically generate a requirement.txt file including the packages that you have installed with their respective versions.
A tip - you should aim to be using a virtual environment for each individual project that you'll be working on. This creates a 'bubble' for you to work within and to install specific package versions in, without it effecting your other projects. It will save you a lot of headaches in the future as your packages and versions will be kept project specific. I suggest using Anacondas virtual environment.
Specifying a version is not a requirement though it does help a lot in the future. Some versions of packages will not work well with other packages and their respective versions. It is hard to predict how changes in the future will effect these interrelationships. This is why it is very beneficial to create a snapshot in time (in your requirements.txt) showing which version interrelationships do work.
To create a requirements.txt file including the versions of the packages that you're using do the following. In your console/ terminal cd into the location that you would like your requirement.txt to be and enter:
pip freeze > requirements.txt
This will automatically generate a requirement.txt file including the packages that you have installed with their respective versions.
A tip - you should aim to be using a virtual environment for each individual project that you'll be working on. This creates a 'bubble' for you to work within and to install specific package versions in, without it effecting your other projects. It will save you a lot of headaches in the future as your packages and versions will be kept project specific. I suggest using Anacondas virtual environment.
edited Mar 7 at 21:09
answered Mar 7 at 20:44
Tom MacTom Mac
89113
89113
add a comment |
add a comment |
No, there is no need to specify a version. It's probably a good idea to specify one, though.
If you want to specify a version but you don't know which version to specify, try using pip freeze, which will dump out a list of all the packages you currently have installed and what their versions are.
add a comment |
No, there is no need to specify a version. It's probably a good idea to specify one, though.
If you want to specify a version but you don't know which version to specify, try using pip freeze, which will dump out a list of all the packages you currently have installed and what their versions are.
add a comment |
No, there is no need to specify a version. It's probably a good idea to specify one, though.
If you want to specify a version but you don't know which version to specify, try using pip freeze, which will dump out a list of all the packages you currently have installed and what their versions are.
No, there is no need to specify a version. It's probably a good idea to specify one, though.
If you want to specify a version but you don't know which version to specify, try using pip freeze, which will dump out a list of all the packages you currently have installed and what their versions are.
answered Mar 7 at 20:43
Daniel PrydenDaniel Pryden
47.2k975117
47.2k975117
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052434%2fdoes-python-requirements-file-have-to-specify-version%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you using a virtual environment?
– Tom Mac
Mar 7 at 20:42
You happened to stumble on a contentious debate in Python. No you don't have to. Should you depends on your application. Can you describe what you are trying to do?
– pylang
Mar 7 at 22:08
@Tom Mac Yes, but out of curiosity, why do you ask?
– Intrastellar Explorer
Mar 7 at 23:27
@pylang I am just wondering, I try to follow best practices. The application is manufacturing automation - in this case a driver written in Python.
– Intrastellar Explorer
Mar 7 at 23:27
@Intrastellar Explorer I was going to suggest using one before you pip freezed into your requirements but you're sorted
– Tom Mac
Mar 7 at 23:56