Pipenv: `--extra-index-url` does not work with `pipenv install`

Created on 7 Feb 2018  Â·  6Comments  Â·  Source: pypa/pipenv

Is the only way to install package on private index (specifically one which has public subdependencies on PyPI) to "manually" fill the "Pipfile" and do pipenv install as implied here?

In other words, pipenv install pkgname --extra-index-url <link-to-index> doesn't work (neither does pipenv install pkgname -i <link-to-index> (as it shouldn't since -i corresponds to --index-url which is not desirable in this context.)

Describe your environment
  1. OS Type: windows 7
  2. Python version: $ python -V 2.7
  3. Pipenv version: $ pipenv --version 9.0.3
Expected result

I expect for package to be installed from the private index, and its sub-dependencies (specified in its setup.py) be installed from the public index (PyPI). Ideally the additional [[sources]] paragraph would be added to the Pipefile and the private package's "index" key would point to this "extra-index-url" as its source.

I understand that this service just may not be provided by pipenv (yet?), but I wonder if there is some existing solution that i'm not finding.

Actual result

pipenv can't find the private package to collect/install it. This is using either the -i or --extra-index-url as mentioned above.

Error:  An error occurred while installing pkgname!
  Could not find a version that satisfies the requirement pkgname (from versions: )
No matching distribution found for pkgname
Steps to replicate
  • Create package called pkgname.
  • Use install_requires in its setup.py to specify some public package as a dependency (e.g., pandas)
  • Upload it to private index.
  • Try to install it with pipenv

    pipenv install pkgname --extra-index-url <link-to-index>

Most helpful comment

probably within the next few days

All 6 comments

In my case, pipenv explicitedly complains that _Private repos not supported. Skipping_.

$ pipenv --version
pipenv, version 9.0.3

$ pipenv install private-package '--extra-index-url https://xxxx:[email protected]/simple/'
Adding private-package to Pipfile's [packages]…
Installing --index-url https://pypi.internal/simple/…
/usr/lib/python3.6/site-packages/pipenv/vendor/requirements/parser.py:44: UserWarning: Private repos not supported. Skipping.
  warnings.warn('Private repos not supported. Skipping.')
…

So requirements/parser.py is vendored from pip.

It turned out that pypa/pip#3728 was recently merged. It allows variable expansion in requirements file, so you can have now, in pip, something like --extra-index-url=https://$PRIVATE_PYPI_USER:[email protected]/simple/ and everything will work as expected as long as you have those vars set in environment.

Maybe combining this new feature (by updating vendor) and using a custom package index will solve once and for all the problem with private repos. See for example #856.

For me the $PIP_EXTRA_INDEX_URL mentioned there works with pipenv install foo but doesn't work with pipenv lock.

You need to specify the index in your pipfile:

https://docs.pipenv.org/advanced/#specifying-package-indexes

What do you do if your extra index require credentials?

in the next version, you can use environment variables

I got it working with running pipenv install --skip-lock. Is that a reasonable workaround until the next version comes? Any eta on that version btw?

probably within the next few days

Was this page helpful?
0 / 5 - 0 ratings