Given the following Nix packages (you may be able to install six manually rather than managing it by Nix, but anyway, this was my setup):
pkgs.python310Full
pkgs.python310Packages.six
I would very often run into this situation:
/usr/local/bin/pip: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
This is because a certain version of pip is hard-coded with a shebang to use the macOS python rather than just the one on your path (your Nix one).
I found the only way forwards was to edit it:
# Find where pip is installed
$ which pip
/usr/local/bin/pip
# Edit it
$ sudo nano /usr/local/bin/pip
I edited it to hard-code the version number of my own installation of pip
, and made it use the python on my path, which is Python v3.10.
#!/Users/jamie/.nix-profile/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==22.3.1','console_scripts','pip'
__requires__ = 'pip==22.3.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==22.3.1', 'console_scripts', 'pip')()
)
From there, I tried pip install --upgrade pip
as many comments on StackOverflow recommended, but it seemed to no-op.
After that, just:
pip install six
... and then nativescript doctor
was happy.
I'd better remove the redundant pkgs.python310Packages.six
now, though.