Skip to content
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

pip-sync uses first pip script on PATH instead of the one from the Python version it is run with #734

Closed
kb-1000 opened this issue Feb 14, 2019 · 3 comments
Labels
bug Something is not working PR wanted Feature is discussed or bug is confirmed, PR needed

Comments

@kb-1000
Copy link

kb-1000 commented Feb 14, 2019

Describe the issue briefly here.

Environment Versions
  1. OS Type: Android 8.1 aarch64/Latest Termux
  2. Python version: 3.7.2
  3. pip version: pip 18.1 from /data/data/com.termux/files/usr/lib/python2.7/site-packages/pip (python 2.7) (pip3.7 --version is `pip 19.0.2 from /data/data/com.termux/files/usr/lib/python3.7/site-packages/pip (python 3.7)
  4. pip-tools version: pip-compile, version 3.3.2
Steps to replicate
  1. Get Termux
  2. Run pkg up && pkg install python python2
  3. Install pip on Python 3 (get-pip.py)
  4. Install pip on Python 2 (get-pip.py)
  5. Install piptools on Python 3
  6. Use pip-sync with a requirements.txt file and watch it installing to Python 2
Expected result

Installs into Python 3 if ran on Python 3 and to Python 2 if ran on Python2

Actual result

Installs to whichever Python version pip script on PATH is from

Extra information

If using Python 2 and 3 together, an extra pip-compile and pip-sync script per Python major and per Python minor version to be able to select Python version to run piptools on would be very useful.

@atugushev
Copy link
Member

atugushev commented Feb 15, 2019

Hello @kaeptmblaubaer1000,

Thank you for the detailed report! The issue is probably here:

pip-tools/piptools/sync.py

Lines 140 to 141 in 200bc6b

# find pip in same directory as pip-sync entry-point script
pip = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'pip')

Since pip uses python2.7 it would install packages to python2. I think pip-sync should decide to use pip2 or pip3, depending on python's version.

@kb-1000
Copy link
Author

kb-1000 commented Feb 15, 2019

Or use console_scripts.pip entry point and execute it inside the script.

@atugushev atugushev added PR wanted Feature is discussed or bug is confirmed, PR needed bug Something is not working labels Feb 15, 2019
atugushev added a commit to atugushev/pip-tools that referenced this issue Feb 15, 2019
@Asurasaintking
Copy link

I'm getting an : unable to locate pip
Error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working PR wanted Feature is discussed or bug is confirmed, PR needed
Projects
None yet
Development

No branches or pull requests

3 participants