0

To the best of my knowledge pip install .[extras_require here] has always worked. I can't find in any documentation when that feature was added, but I've never had any problem even on very old machines.

Is pip definitely the problem here. I could add 'pip install --upgrade pip', but I don't have merge rights to the repo that is currently having the problem.

From setup.py

extras_require={
    'test': ['flake8', 'pytest>=2.9.0'],
},

In python 2.7.9

$ python --version
Python 2.7.9
$ pip --version
pip 6.0.7 from /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (python 2.7)
$ pip install .[test]
Collecting .[test]
  Could not find any downloads that satisfy the requirement .[test]
  No distributions at all found for .[test]


The command "pip install .[test]" failed and exited with 1 during .

From 3.5.2:

$ python --version
Python 3.5.2
$ pip --version
pip 9.0.1 from /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (python 3.5)
$ pip install .[test]
Processing /home/travis/build/Brian-Williams/repo_python
Collecting flake8 (from refactor-me==0.1.0)
  Downloading flake8-3.3.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 6.1MB/s 
Requirement already satisfied: pytest>=2.9.0 in /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (from refactor-me==0.1.0)
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8->refactor-me==0.1.0)
  Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45kB)
    100% |███████████████���████████████████| 51kB 10.6MB/s 
Collecting mccabe<0.7.0,>=0.6.0 (from flake8->refactor-me==0.1.0)
  Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting pyflakes<1.6.0,>=1.5.0 (from flake8->refactor-me==0.1.0)
  Downloading pyflakes-1.5.0-py2.py3-none-any.whl (225kB)
    100% |████████████████████████████████| 225kB 7.1MB/s 
Requirement already satisfied: py>=1.4.29 in /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (from pytest>=2.9.0->refactor-me==0.1.0)
Installing collected packages: pycodestyle, mccabe, pyflakes, flake8, refactor-me
  Running setup.py install for refactor-me ... - done
Successfully installed flake8-3.3.0 mccabe-0.6.1 pycodestyle-2.3.1 pyflakes-1.5.0 refactor-me-0.1.0
Brian
  • 987
  • 10
  • 19
  • It looks like this has been supported in versions of pip as old as 1.1. See [here](http://stackoverflow.com/questions/4796936/does-pip-handle-extras-requires-from-setuptools-distribute-based-sources). – Brian Feb 28 '17 at 13:33

2 Answers2

1

For your version of pip you need to run

pip install -e .[test]

to be able to install extras from a directory

Nils Werner
  • 34,832
  • 7
  • 76
  • 98
  • That is what I'm doing. From .travis.yml: `'pip install ".[test]"'` – Brian Feb 28 '17 at 14:18
  • You are not doing it. you are missing the `-e`. – Nils Werner Mar 01 '17 at 11:36
  • The -e is just installing in editor mode which is unnecessary as this is part of a CI job where the code won't be edited and the container will be removed once completed. I also resolved the problem below, by upgrading pip and still am not installing in editor mode. It's a bad idea to have mutable code when there is no reason. – Brian Mar 01 '17 at 21:42
  • 1
    pip 6.0.7 could only install extras from paths when doing an editable install. Also, editable installs are not discouraged, the [pytest docs even specifically mention an editable install](http://doc.pytest.org/en/latest/goodpractices.html#choosing-a-test-layout-import-rules). – Nils Werner Mar 02 '17 at 07:55
  • Ok updated now that you edited answer to specify that editor mode was required in version. – Brian Mar 06 '17 at 12:24
0

I got merge access. Adding upgrade pip to the install stage of .travis.yml fixed it:

install:
  # update pip to ensure extras_require format is supported
  - 'pip install --upgrade pip'
  - 'pip install ".[test]"'

From the successful run replacing 6.0.7 with pip-9.0.1 was the delta.

Brian
  • 987
  • 10
  • 19