Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Based on pypa/pip#3826 it sounds like this is a debian specific flag patched into pip, is that right?
If that is the case and we run this in any other platform this is likely going to return an error. In macOS:
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.
Look at:
#822
maybe...
'''
f = open("/etc/lsb-release",'r')
f.readlines()
['DISTRIB_ID=LinuxMint\n',
'DISTRIB_RELEASE=19\n',
'DISTRIB_CODENAME=tara\n',
'DISTRIB_DESCRIPTION="FREE_DESKTOP_2019.004c"\n']
'''
and check DISTRIB_ID against 'Debian/Ubuntu/LinuxMint/....' ?
And then add --system flag ?
I can make function like debian_detect() which returns True if it will be Debian or other... and then we could add --system to pip. I know, this will be "a hack', but I cannot see any other way to make it works.
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.
But do we understand the original problem? Perhaps there is a different workaround or fix.
The issue linked inside #822 is about mixing the
target
anduser
flags in pip, which is not being done in this file. Is it possible theuser
flag is being added somewhere else?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.
As I investigated the problem, in Debian's based distros the only way to install libs using pip in users directory (via
--target
) is when you use--system
option. And the only place I found in source is : @@ -447,7 +447,7 @@ def run_pip(self): - so i decided to place my--system
there.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.
But the
--system
flag has been added by debian to pip as a patch to install the package in the "system python directory", which is the opposite of what Mu should be doing, as it needs to install the package in a special location.Based on your error output in #822 it looks like the problem here could be that somehow the final command executed includes both the flags
user
andtarget
:In this case the
user
flag will try to install the package in the user home directory (not good), and thetarget
flag will try to install it in the location indicated by Mu (good, but contradictory to the other flag). Because of this, thesystem
flag "fixes" the problem by "cancelling out" theuser
flag.However, if this is the case, where is the
user
flag coming from? I think that's the thing we need to figure out.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.
Hi, I manage to find a pip.conf file inside .pip folder in my home directory. It has a parameter "user=true" in it. When I changed this parameter to false, I could finally use the -t option on pip.
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.
Good find @Saziba!
Were you installing packages with the default Mu installation, or did you edit the source code as well?