Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing packages from internal PyPI indexes #1084

Closed
Gr1N opened this issue Nov 17, 2017 · 4 comments
Closed

Installing packages from internal PyPI indexes #1084

Gr1N opened this issue Nov 17, 2017 · 4 comments

Comments

@Gr1N
Copy link

Gr1N commented Nov 17, 2017

Can't install packages from internal PyPI indexes due to authentication error.

Describe your environment
  1. MacOS
  2. Python version: 3.6.3
  3. Pipenv version: 8.2.8
Expected result

I want to install part of packages from internal PyPI index. Due to documentation I declare additional index in my Pipfile:

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[[source]]
url = "https://company.jfrog.io/company/api/pypi/pypi-local/simple"
verify_ssl = true
name = "local"

[dev-packages]


[packages]
internal-package = {version = "*", index = "local"}

[requires]
python_version = "3.6"

I don't want to store credentials in url due to security issues, so I expect pipenv will ask my credentials (like pip did) and install my internal package.

Actual result
$ pipenv install --verbose --sequential
Pipfile.lock (c1cf88) out of date, updating to (6de47a)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
User for company.jfrog.io: nikita.grishko
Password:
Updated Pipfile.lock (6de47a)!
Installing dependencies from Pipfile.lock (6de47a)…
Installing "enum34==1.1.6; python_version < '3.4' --hash=sha256:6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79  --hash=sha256:644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a  --hash=sha256:8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1  --hash=sha256:2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850"
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-McYHJ7-requirement.txt --require-hashes -i https://pypi.python.org/simple --exists-action w
Installing 'python-dateutil==2.6.1 --hash=sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c  --hash=sha256:891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca'
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-p8XmtS-requirement.txt --require-hashes -i https://pypi.python.org/simple --exists-action w
Installing 'six==1.11.0 --hash=sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb  --hash=sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9'
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-VoTyfm-requirement.txt --require-hashes -i https://pypi.python.org/simple --exists-action w
Installing 'internal-package==0.10'▉▉▉▉▉▉▉▉▉▉▉ 3/5 — 00:00:00
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-PZ2N0R-requirement.txt -i https://company.jfrog.io/company/api/pypi/pypi-local/simple --exists-action w
Installing 'arrow==0.10.0 --hash=sha256:805906f09445afc1f0fc80187db8fe07670e3b25cdafa09b8d8ac264a8c0c722'
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-U4PvI0-requirement.txt --require-hashes -i https://pypi.python.org/simple --exists-action w
Ignoring enum34: markers 'python_version < "3.4"' don't match your environment

Requirement already satisfied: python-dateutil==2.6.1 in /Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages (from -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-p8XmtS-requirement.txt (line 1))
  Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.
Cleaning up...

Requirement already satisfied: six==1.11.0 in /Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages (from -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-VoTyfm-requirement.txt (line 1))
  Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.
Cleaning up...

Collecting internal-package==0.10 (from -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-PZ2N0R-requirement.txt (line 1))
  1 location(s) to search for versions of internal-package:
  * https://company.jfrog.io/company/api/pypi/pypi-local/simple/internal-package/
  Getting page https://company.jfrog.io/company/api/pypi/pypi-local/simple/internal-package/
  Looking up "https://company.jfrog.io/company/api/pypi/pypi-local/simple/internal-package/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): company.jfrog.io
  "GET /company/api/pypi/pypi-local/simple/internal-package/ HTTP/1.1" 401 91
User for company.jfrog.io: Cleaning up...

An error occurred while installing internal-package==0.10! Will try again.
Requirement already satisfied: arrow==0.10.0 in /Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages (from -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-U4PvI0-requirement.txt (line 1))
  Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.
Cleaning up...

  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 5/5 — 00:00:02
Installing initially–failed dependencies…
Installing 'internal-package==0.10'▉▉▉▉▉▉▉▉▉▉ 0/1 — 00:00:00
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-cUQW4H-requirement.txt -i https://pypi.python.org/simple --exists-action w
$ "/Users/ng/.virtualenvs/my-project-PomnPp3h/bin/pip" install   --verbose --no-deps  -r /var/folders/6q/v05l3g997ll76yh39ftdfzv40000gn/T/pipenv-cUQW4H-requirement.txt -i https://company.jfrog.io/company/api/pypi/pypi-local/simple --exists-action w
Collecting internal-package==0.10
  1 location(s) to search for versions of internal-package:
  * https://company.jfrog.io/company/api/pypi/pypi-local/simple/internal-package/
  Getting page https://company.jfrog.io/company/api/pypi/pypi-local/simple/internal-package/
  Looking up "https://company.jfrog.io/company/api/pypi/pypi-local/simple/internal-package/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): company.jfrog.io
  "GET /company/api/pypi/pypi-local/simple/internal-package/ HTTP/1.1" 401 91
User for company.jfrog.io: Cleaning up...

Exception:
Traceback (most recent call last):
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 602, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/Users/ng/.virtualenvs/my-project-PomnPp3h/lib/python3.6/site-packages/pip/download.py", line 181, in handle_401
    username = six.moves.input("User for %s: " % parsed.netloc)
EOFError: EOF when reading a line

  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/1 — 00:00:02
Steps to replicate

Just add index with authentication and try to install packages.

@techalchemy
Copy link
Member

Define the internal index in your pip config file with your username and password, or include it in your url in your Pipfile in the format https://user:password@host. Pipenv doesn’t accept user input for authentication, you have to set it up in your config ahead of time.

@Gr1N
Copy link
Author

Gr1N commented Nov 17, 2017

Still not works, here is my pip.conf file:

[distutils]
index-servers = local
[local]
repository: https://company.jfrog.io/company/api/pypi/pypi-local/simple
username: nikita.grishko
password: <secret>

What I'm doing wrong?

@techalchemy
Copy link
Member

pip.conf and .pypirc don’t use the same syntax.

[global]
index-url = http://user:password@host/pypi/simple

@Gr1N
Copy link
Author

Gr1N commented Nov 17, 2017

My bad, thank you for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants