Pip will install Python3-only packages on Python2
See original GitHub issue- Pip version: 9.0.1
- Python version: 2.7.3
- Operating system: Debian GNU/Linux 8 on Docker (running Docker image python:2.7)
Description:
I’ve published a package on PyPI which only supports Python3, and I’m sure I’ve set the setup.py
metadata to describe it as only Python3… but I’ve discovered that someone running Python2.7 can do pip install <my package>
and Pip will happily install it.
Is this expected behaviour? Have I made a mistake in my project’s setup.py
?
Reading some of the discussion on #3984…
The over-specified version requirement thing is important. It’s way more irritating to have trouble installing a package that would work except it has incorrect metadata than to get a successful install of something that does not quite execute correctly.
… I’m not sure if this is a deliberate consequence of how version compatibility is checked?
What I’ve run:
$ docker run -it python:2.7 bash
root@aec4834958e1:/# pip --version
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
root@aec4834958e1:/# python --version
Python 2.7.13
root@aec4834958e1:/# cat /etc/issue
Debian GNU/Linux 8 \n \l
root@aec4834958e1:/# cd
root@aec4834958e1:~# pip install fang
Collecting fang
Downloading fang-0.7.6.tar.gz
Building wheels for collected packages: fang
Running setup.py bdist_wheel for fang ... done
Stored in directory: /root/.cache/pip/wheels/b1/db/be/9d9370b32b6004b4ef5bba6a21d3e7da3e1443b97be6c1fd9e
Successfully built fang
Installing collected packages: fang
Successfully installed fang-0.7.6
root@aec4834958e1:~# python
Python 2.7.13 (default, Feb 28 2017, 22:13:47)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fang
>>> fang
<module 'fang' from '/usr/local/lib/python2.7/site-packages/fang/__init__.pyc'>
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Installing Packages - Python Packaging User Guide - Python.org
This section covers the basics of how to install Python packages. ... This section describes the steps to follow before installing other Python...
Read more >Can pip (python2) and pip3 (python3) coexist? - Stack Overflow
1 Answer 1 · After installing python 3's pip (and having it overwrite python 2's pip), using the --force flag combined with the...
Read more >How to install and use Pip3 - ActiveState
pip3 is the official package manager and pip command for Python 3. It enables the installation and management of third party software packages...
Read more >How to Install Python PIP on Windows, Mac, and Linux
PIP is an acronym that stands for “PIP Installs Packages” or “Preferred Installer Program.” It's a package manager for Python that lets you ......
Read more >How to Install a Package in Python using PIP - Data to Fish
(5) Locate your Python Scripts path. The Scripts folder can be found within the Python application folder, where you originally installed Python ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I may have been using Pip ≥ 9, but I likely still didn’t get the desired behaviour because my package (Fang) doesn’t yet use the
python_requires
option in itssetup.py
.On Wed, 9 Aug 2017 12:37 pm Lucy He notifications@github.com wrote:
Which versions of pip starts to support python_requires? This post suggests it’s 9.0.0, but it looks like @ncraike was already using 9.0.1.