Comments (7)
I don't know what to make of the issue you reported so I guess I'm missing some essential context.
When pip-accel
invokes pip
it does so at the Python API level, that is to say it imports from the pip
namespace. The Python import statement doesn't support versioning; you'll just get the first module available on sys.path
. This means pip-accel
doesn't control what version of pip
it will import.
Are you talking about a system wide installation or virtual environments? Because it kind of sounds like your Python installation is broken; Python 2 modules shouldn't be available for import in a Python 3 interpreter.
from pip-accel.
I'm referring to a system wide installation. I have py2 and py3. When you run pip
, what you get back depends on how $PATH
is defined. Since my py2 install takes priority, pip
is the py2 version. I smylinked py3's pip
--> pip3
. Also, this is all on the command line... I'm not importing modules.
pip
reubano@tokpro [~]$ pip --version
pip 7.1.2 from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
reubano@tokpro [~]$ ls /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
reubano@tokpro [~]$ pip3 --version
pip 7.1.2 from /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip-7.1.2-py3.5.egg (python 3.5)
reubano@tokpro [~]$ ls /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pip
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pip
pip-accel
reubano@tokpro [~]$ l `which pip-accel`
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pip-accel
reubano@tokpro [~]$ l `which pip-accel3`
/Users/reubano/bin/pip-accel3 -> /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pip-accel
So my assumption is that the pip
that pip-accel3
runs references the py2 version. When I pip-accel3 <package>
on a package that uses future
to provide py2 & 3 compatibility, I see that future
is downloaded as well. This doesn't happen if I pip3 <package>
.
from pip-accel.
Two questions:
- Does anything break during or after you run the
pip-accel3 install <package>
command or are you worried that something might be going wrong (even though everything works fine at first glance)? - Can you give me the actual
pip3 install <package>
andpip-accel3 install <package>
commands so I can try to reproduce the behavior you are describing?
A bit more context about how I understand the situation thus far, because it may enable you to follow my train of thought so we can get to the bottom of what's going on here:
- You created a symbolic link
/Users/reubano/bin/pip-accel3
which points to/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pip-accel
. - When you run the
pip-accel3
command it will start a Python 3.5 interpreter to load thepip_accel.*
modules which import thepip.*
modules. - Because we started with a Python 3.5 interpreter the Python 2.7 module search path will be irrelevant, so
pip-accel
should definitely be importing the version ofpip
installed alongsidepip-accel
under/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
. - The version of
pip-accel
installed in the Python 3.5 environment should never even encounter the version ofpip
installed in the Python 2.7 environment becausepip-accel
never runspip
as a subprocess, it just imports thepip.*
modules.
from pip-accel.
A small addition: I can think of other reasons why the future
package might be downloaded on Python 3.x, but to confirm my suspicions I'll need to take a look at the actual Python packages involved. For example wheel distributions support conditional dependencies, e.g. to mark a dependency as Python 2.x only. Source distributions require other handling to implement this same logic, so if pip prefers a wheel distribution but pip-accel for some reason prefers the source distribution, you could be seeing different (though possibly harmless) behavior.
from pip-accel.
- Me seeing
future
in the download led me to believe something might be going wrong. - However, I was just trying to reproduce the behavior with
pygogo
and I seepip3
is now downloadingfuture
as well :(. I can't remember if I did something differently the first time around that avoided that particular download.
FYI, here is the optional py2 logic:
setup.py
...
if sys.version_info.major == 2:
requirements.append('future==0.15.2')
from pip-accel.
Working now! I figured out the proper way to declare optional dependencies and tested it out on a new repo. In case anyone else needs to do the same:
setup.py
...
# Conditional sdist dependencies:
if 'bdist_wheel' not in sys.argv and sys.version_info.major == 2:
requirements = py2_requirements
else:
requirements = py3_requirements
# Conditional bdist_wheel dependencies:
extras_require = sorted(set(py2_requirements).difference(py3_requirements))
setup(
...
install_requires=requirements,
extras_require={':python_version<"3.0"': extras_require},
...)
Thanks for the help!!
from pip-accel.
Hi Reuben,
Glad to hear you got things working and thanks for following up and documenting the solution you found!
from pip-accel.
Related Issues (20)
- pip-accel not updating package HOT 3
- Doesn't work with pip 7+ HOT 2
- Add option for terse logging. HOT 5
- Windows / Appveyor - same version of cached file - invalidated and built again HOT 5
- is_wheel fails when source_directory is None HOT 6
- Not able to use pip-accel both globally and inside a virtual environment HOT 4
- Upgrade to pip 8 HOT 4
- Disabling S3CacheBackend because it failed HOT 2
- pip-accel does not support running as a module HOT 6
- Is there any way to use pip-accel without installing to virtualenv?
- pip-accel is not compatible with `-e` editable installs of packages that use `setuptools_scm` HOT 2
- Why does `pip-accel` make an sdist (?) archive when I `pip-accel install -e .`? HOT 3
- pip-accel doesn't support the newest pip? HOT 4
- Not compatible with alternative install locations, e.g. `--user`? HOT 2
- [need advice] Do not cache development versions
- Failed to install some packages
- pip-accel should honor settings in pip.conf
- Is this project still alive? HOT 2
- Trying to install pip-accel, it insists on downgrading pip to 2.7. How can I get it to respect the current version, 21.1.2
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 pip-accel.