-
-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommend pip
instead of python -m pip
, fix minor error
#551
Conversation
@@ -186,7 +186,7 @@ while adding ``pip`` to the build requirements: | |||
- pip | |||
|
|||
These options should be used to ensure a clean installation of the package without its | |||
dependencies and without ``egg-info`` directories, which do not interact well with conda. | |||
dependencies, which do not interact well with conda. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"which do not interact well with conda" should be applicable to both, egg-info
dirs and pip
-installed deps, so I left this in. @nicoddemus, would you agree this is fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, sounds fine to me! 👍
See https://bugs.python.org/issue22295 and a more concise version at https://stackoverflow.com/questions/25749621/whats-the-difference-between-pip-install-and-python-m-pip-install for the reasons conda-forge chose |
Sorry, but I don't think this is really applicable here. That https://bugs.python.org/ issue and Stack Overflow question are about non-Conda installations. |
The |
One could even argue -- by an, admittedly, long stretch -- that |
conda-forge provides also recipes, not only packages, the safest generic setup is with
One can have python from
We can discuss a closed issue and I'm happy to merge this if you can proof me that we can be safe with just
Indeed a long stretch. |
This is a good point: if you forget to include the |
Yep. That is one of the reasons for |
FWIW I can see value in cutting down the length of this command. It feels like a lot of cognitive load to be carrying around. Given we already tell people to add On |
It's just like calling another So, your arguments can be summarized with
right? (With which I agree, of course.) Regarding
(Rhetoric question) How could I? I don't know "all setups" and there is a plethora of ways to mess with the execution of [OT: Re: open/closed issue, that's just because of the "awareness factor" 😉 (hence the ping).] |
There is no cognitive load b/c people either copy-n-paste that. I would argue that should be in conda-skeleton to reduce it even further.
Not a paranoia. A Fact. Again, conda-forge recipes are used outside of conda-forge and good practices do not hurt anyone. |
Re:
|
I've definitely forgotten to include |
|
The presence of the |
Second that! Also, many scientist use
@mbargull empty package is only one of issues from that change. Even though I appreciate your PR this change is a hard no for me. It would break tons of stuff outside of conda-forge just to save a few keystrokes, that very few people actually type. Not worth it. |
Copy and paste is the consequence of people acting under cognitive load. IOW people thinking, "What is this? Whatever I can't be bothered to think about it...". This will become more obvious later when we tell people they need to add even more options and they are confused. ( pypa/pip#5033 ) Ultimately this thinking is a serious concern for a community oriented package management project. So it really deserves consideration on our part in terms of what we are asking of people.
Where |
Read it again with more care and thinking of others, maybe you will. Also, there are other options that we must pass that will always cause people to copy-n-paste. We cannot get rid of those too. |
Sure, that comment was just to say "no need to do that part, already done".
I for one don't really care about two more "words"/few keystrokes. To me, it's just that I think If supporting setups outside of conda-forge is an objective for you, let me ask another way: |
One would argue that it is meant to be run that way in the context safely building packages vs a local user usage that you are describing. |
Speaking as a maintainer of several recipes, but not a core conda-forge member, I find the argument about "congnitive load" lack. I buy it for the other command link junk that may be needed, but |
Never did, don't care about "local user" in this context.
What we exactly want by invoking pip (irregardless of how), is just to run that helper application. While doing this -- and this is the important part why this discussion is controversial -- we want to be sure to operate on the Python environment that is intended to be used for the recipe. So, I disagree with the explanations the both of you give. But this is nothing we have to dwell on. TBH, as said before, if you think there is an uncertainty with this, then something like script: '"${PREFIX}/bin/pip" install --no-deps --ignore-installed .' # [not win]
script: '"%PREFIX%\Scripts\pip" install --no-deps --ignore-installed .' # [win] is the safer bet. If things like this are too error-prone or create too much code duplication, they can be put into helper scripts and such. (This is generally speaking -- |
As a conda-forge contributor of several recipes, I wholeheartedly agree with @ocefpaf and @dopplershift: using |
python -m is the canonical way to ask python to resolve the path to a
module and run it as a program,
You expect the "correct" python to be on PATH (which, btw, isn't just a
"shell setting") and have that python configured to only pick up the
associated pip.
That’s not an “expectation” your install is seriously broken if -m doesn’t
work.
Many people (including me) recommend the -m approach to newbies, too. There
are a lot of errors when people “pip install” stuff, and then can’t import
it. Particularly when someone has py2 and py3 I stalked at once.
I expect the "correct" pip of the associated python to be on PATH.
You can expect it all you want, and it may be a reasonable expectation
within conda-build, but it’s not a safe expectation in general.
In fact, I think the python.org installer (at least on OS-X) only installs
“pip3”, and not “pip” with py3 by default.
'"${PREFIX}/bin/pip" install --no-deps --ignore-installed .' # [not win]
script: '"%PREFIX%\Scripts\pip" install --no-deps --ignore-installed
.' # [win]
is the safer bet.
That is less safe than $PYTHON -m
…-CHB
|
Yes, Conda/
This is untrue. |
Okay guys, if there is so much disapproval regarding that change, let's not repeat ourselves, leave this closed and get back to working on more pressing things. |
There should be no advantage in using
python -m pip
overpip
, so we should use the latter. Even under Windows we always have apip.exe
available, so really no reason not to use it.Additionally, the docs say a
pip install --no-deps --ignore-installed .
invocation would not createegg-info
dirs, which is not true, so I removed that part of the sentence.