Comments (10)
Would a --pip-executable flag fix this problem? Ex:
$ pip2pi --pip-executable env/bin/pip …
On 2013-01-06, at 11:29, ToBeReplaced [email protected] wrote:
This assumes that there is a global pip installation. I am bootstrapping pip in to virtual environments with no global pip. Alternatively, you could use something like "os.path.join(os.path.dirname(sys.executable), 'pip')".
from pip2pi.
Yes, that would get the job done, but it doesn't feel quite right. It feels like the pip from the python interpreter that installed pip2pi should be used. I've never looked at internals of distutils/pip so I'm not sure how they accomplish it. What do you think?
from pip2pi.
On 2013-01-06, at 1:54 PM, ToBeReplaced [email protected] wrote:
Yes, that would get the job done, but it doesn't feel quite right. It feels like the pip from the python interpreter that installed pip2pi should be used.
mmm… ok, after some thought, this seems like a reasonable argument.
In fact, even more reasonable would be to import the pip package and call into it directly:
import pip
pip.main(["bundle", "-b", build_dir, bundle_zip] + argv[2:])
That, combined with adding pip as a requirement in setup.py, seems like The Right thing to do.
The downside of this is that it will subtly change the behaviour… As previously pip2pi could be installed in the system, but used from a virtualenv… But provided we can fall back to this (along with a deprecation warning), I think that should be fine:
try:
import pip
except ImportError as e:
import warnigns
warnings.warn((
"could not import pip package (%r), falling back to calling pip executable. "
"This behaviour is deprecated and will eventually be removed."
) %(e, ))
pip = None
def call_pip(argv):
if pip is None:
check_call(["pip"] + argv)
else:
pip.main(argv)
Sound reasonable?
I've never looked at internals of distutils/pip so I'm not sure how they accomplish it. What do you think?
How they accomplish which?
phone: (416) 906-0403
pgp: B230230D
from pip2pi.
That sounds like a good solution to me. Importing pip and adding it as a setup requirement makes a lot of sense. I'm not sure when it's a good idea to use a system-install of pip2pi from within a virtual env, so I agree with preserving the behavior and adding a warning.
As for the "how do they accomplish it" comment... That was referring to figuring out where the python environment's executables are. It doesn't apply because you can import pip directly, which is much better.
from pip2pi.
Awesome. Are you able to submit a pull request? Otherwise, I'll get to this after the holidays.
On 2013-01-06, at 16:20, ToBeReplaced [email protected] wrote:
That sounds like a good solution to me. Importing pip and adding it as a setup requirement makes a lot of sense. I'm not sure when it's a good idea to use a system-install of pip2pi from within a virtual env, so I agree with preserving the behavior and adding a warning.
from pip2pi.
Wouldn’t it be enough to pass os.environ to check_call? That way, you let the OS respect $PATH when trying to find the pip executable.
from pip2pi.
Wait… Doesn't check_call
with shell=True
automatically use $PATH
?
from pip2pi.
shell=True means unsafe=True :) That aside, I’m not sure.
from pip2pi.
For example, in fedora 19 they changed pip executable to [pip-python | python-pip] and that broke pip2tgz, importing pip would solve this in a cleaner way.
A quick solve is making a symbolic link to the new name. "ln -s /usr/bin/pip-python /usr/bin/pip"
from pip2pi.
Ah ha! This has been fixed by #19 and pushed in version 0.5.0!
from pip2pi.
Related Issues (20)
- Use pip compat layer
- Find sdist when project only provides wheels
- Create index.html files instead of autoindexing? HOT 4
- Handling unruly wheel filenames HOT 2
- Add json api output to local server
- module 'cgi' has no attribute 'escape' HOT 4
- dir2pi with folders and subfolders in packages/
- bug: symbol link "../../" on windows is incorrect HOT 1
- Bug on Windows: A required privilege is not held by the client
- oldest supported numpy dependency not downloaded for scikit-bio
- DEPRECATION warning ahead of pip 22.2
- Can a .tar.gz source file be published to pypi?
- Fails to install existing package in local package index HOT 1
- Wheels with 5 dashes not split correctly in file_to_package HOT 4
- create a repository for other OSs HOT 3
- I install scikit-learn==0.19.1 error report, other no problem HOT 13
- pip 19.3 breaks pip2pi 0.8.1 HOT 5
- cgi.escape was removed HOT 2
- Tag 0.8.1 missing
- Error if -r used without target directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pip2pi.