Pipenv: ERROR: Could not find a version that matches requests

Created on 21 Feb 2019  Ā·  16Comments  Ā·  Source: pypa/pipenv

I ran:

$ mkdir test
$ cd test
$ pipenv install requests

but this caused the following error:

ERROR: ERROR: Could not find a version that matches requests
No versions found
Was https://pypi.org/simple reachable?

I thought this problem is due to proxy, but the following successfully run.

$ pip install requests

Please help me...


$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/home/tamura/.local/lib/python3.5/site-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.5.2: /usr/bin/python3
  • 2.7.12: /usr/bin/python2.7
  • 3.6.8: /home/tamura/my_path/anaconda3/envs/smiles/bin/python
  • 3.7.2: /home/tamura/my_path/anaconda3/bin/python3.7m
  • 3.5.2: /usr/bin/python3.5m

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.5.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-21-generic',
 'platform_system': 'Linux',
 'platform_version': '#37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016',
 'python_full_version': '3.5.2',
 'python_version': '3.5',
 'sys_platform': 'linux'}

System environment variables:

  • https_proxy
  • SHLVL
  • BYOBU_ULIMIT
  • no_proxy
  • PYTHONDONTWRITEBYTECODE
  • SHELL_TYPE
  • IGNOREEOF
  • HOME
  • TERM
  • UNZIP
  • SUPPRESS_BRANCH_TIMEOUT_MESSAGE
  • UPDATE_COMPLETIONS_ON_KEYPRESS
  • LANG
  • BYOBU_TIME
  • LS_COLORS
  • BYOBU_LIGHT
  • UPDATE_PROMPT_ON_KEYPRESS
  • XONSH_AUTOPAIR
  • GTK_IM_MODULE
  • BYOBU_SED
  • QT_IM_MODULE
  • XONSH_LOGIN
  • BYOBU_READLINK
  • LESSOPEN
  • BYOBU_DISTRO
  • BYOBU_CHARMAP
  • BYOBU_PYTHON
  • _
  • PATH
  • SSH_CLIENT
  • http_proxy
  • BASH_COMPLETIONS
  • BYOBU_WINDOW_NAME
  • RIGHT_PROMPT
  • ZIPINFO
  • INDENT
  • TMUX_PANE
  • CONDA_PREFIX
  • GTK_MODULES
  • BYOBU_RUN_DIR
  • TMUX
  • SHELL
  • BYOBU_ACCENT
  • XONSHRC
  • _DEFAULT_CONDA_PATH
  • BYOBU_CONFIG_DIR
  • LOADED_RC_FILES
  • PYTHONFINDER_IGNORE_UNSUPPORTED
  • NVM_DIR
  • XDG_RUNTIME_DIR
  • BOTTOM_TOOLBAR
  • LOGNAME
  • PIP_PYTHON_PATH
  • CONDA_DEFAULT_ENV
  • VI_MODE
  • NVM_CD_FLAGS
  • PIP_SHIMS_BASE_MODULE
  • NVM_BIN
  • VISUAL
  • JUPYTER_PATH
  • PIP_DISABLE_PIP_VERSION_CHECK
  • BYOBU_DATE
  • BYOBU_DARK
  • XDG_SESSION_ID
  • BYOBU_PAGER
  • QT_QPA_PLATFORMTHEME
  • XONSH_INTERACTIVE
  • SSH_CONNECTION
  • OLDPWD
  • PWD
  • USER
  • PYTHONPATH
  • BYOBU_BACKEND
  • MAIL
  • BYOBU_PREFIX
  • XONSH_VERSION
  • XMODIFIERS
  • XONSH_SHOW_TRACEBACK
  • XDG_DATA_DIRS
  • SSH_TTY
  • BYOBU_TTY
  • AUTO_CD
  • LESSCLOSE
  • CONDA_SHLVL
  • BYOBU_HIGHLIGHT
  • CASE_SENSITIVE_COMPLETIONS
  • DISPLAY
  • CONDA_EXE

Pipenvā€“specific environment variables:

Debugā€“specific environment variables:

  • PATH: /home/tamura/my_path/anaconda3/envs/smiles/bin:/home/tamura/.nvm/versions/node/v11.9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/tamura/my_path/bin/:/usr/local/cuda/lib64/:/usr/local/cuda/bin/:/home/tamura/my_path/anaconda3/envs/main/bin/:/home/tamura/my_path/bin/:/usr/local/cuda/lib64/:/usr/local/cuda/bin/:/home/tamura/.local/bin:/home/tamura/my_path/anaconda3/bin
  • SHELL: /bin/bash
  • LANG: ja_JP.UTF-8
  • PWD: /home/tamura/work/test

Contents of Pipfile ('/home/tamura/work/test/Pipfile'):

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

[dev-packages]

[packages]
requests = "*"

[requires]
python_version = "3.7"

Status Needs More Information

Most helpful comment

These steps solved similar issue I had recently:

Delete the virtual environment and pipfile(s)

$ pipenv --rm 
$ rm Pipfile
$ rm Pipfile.lock 

then reinstall project dependencies
$ pipenv install package1 package2 package3

All 16 comments

Yeah pipenv doens't read the proxy settings set somewhere in pip.conf.

Please use HTTP_PROXY/HTTPS_PROXY env vars instead

Thanks for reply!
However, I cannot resolve this issue.
I ran:

$ export HTTP_PROXY=http://my-proxy-server:port
$ export HTTPS_PROXY=http://my-proxy-server:port
$ pipenv install requests

What should I do?

@tamuhey What step are you stuck in? Installation or locking? Was virtualenv created successfully?

@frostming Virtual env seems to be created successfully:

$ pipenv --where
$HOME/test

I think installation succeeded, but locking failed:

$ pipenv install requests
Installing requestsā€¦
Adding requests to Pipfile's [packages]ā€¦
āœ” Installation Succeeded
Pipfile.lock (444a6d) out of date, updating to (a65489)ā€¦
Locking [dev-packages] dependenciesā€¦
Locking [packages] dependenciesā€¦
āœ˜ Locking Failed!
...

I had a similar issue when I tried to create a new project. The workaround I found was to write the Pipfile myself:

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

[packages]
requests = "*"

any progress on this issue? this is a pip connectivity issue it seems like

if you can't make further progress please provide the output of pipenv install --verbose

$ pipenv install --verbose

Pipfile.lock not found, creatingā€¦
Locking [dev-packages] dependenciesā€¦
Locking [packages] dependenciesā€¦
āœ˜ Locking Failed!
Using pip: -i https://pypi.org/simple
Using pip: -i https://pypi.org/simple
Using pip: -i https://pypi.org/simple

                          ROUND 1
Current constraints:
  requests

Finding the best candidates:
Traceback (most recent call last):
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 198, in _resolve_one_round
    best_matches = {self.get_best_match(ireq) for ireq in constraints}
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 198, in <setcomp>
    best_matches = {self.get_best_match(ireq) for ireq in constraints}
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 263, in get_best_match
    best_match = self.repository.find_best_match(ireq, prereleases=self.prereleases)
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 175, in find_best_match
    raise NoCandidateFound(ireq, all_candidates, self.finder)
pipenv.patched.piptools.exceptions.NoCandidateFound: Could not find a version that matches requests
No versions found
Was https://pypi.org/simple reachable?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 726, in resolve_deps
    req_dir=req_dir,
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 395, in resolve
    raise ResolutionFailure(message=str(e))
pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches requests
No versions found
Was https://pypi.org/simple reachable?
Using pip: -i https://pypi.org/simple
Using pip: -i https://pypi.org/simple

                          ROUND 1
Current constraints:
  requests

Finding the best candidates:
Traceback (most recent call last):
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 198, in _resolve_one_round
    best_matches = {self.get_best_match(ireq) for ireq in constraints}
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 198, in <setcomp>
    best_matches = {self.get_best_match(ireq) for ireq in constraints}
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 263, in get_best_match
    best_match = self.repository.find_best_match(ireq, prereleases=self.prereleases)
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 175, in find_best_match
    raise NoCandidateFound(ireq, all_candidates, self.finder)
pipenv.patched.piptools.exceptions.NoCandidateFound: Could not find a version that matches requests
No versions found
Was https://pypi.org/simple reachable?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 726, in resolve_deps
    req_dir=req_dir,
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "/home/tamura/.local/lib/python3.5/site-packages/pipenv/utils.py", line 395, in resolve
    raise ResolutionFailure(message=str(e))
pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches requests
No versions found
Was https://pypi.org/simple reachable?

I think this problem is due to proxy, because the following command successes

$ pip install requests

Collecting requests
  Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Requirement already satisfied: certifi>=2017.4.17 in /home/tamura/my_path/anaconda3/envs/test/lib/python3.7/site-packages (from requests) (2018.11.29)
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.25,>=1.21.1 (from requests)
  Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
Installing collected packages: idna, chardet, urllib3, requests
Successfully installed chardet-3.0.4 idna-2.8 requests-2.21.0 urllib3-1.24.1

but the following fails

$ pipenv run pip install requests

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests

I'm facing a similar issue but haven't seen any resolution on this. I even removed verify_ssl=True from the pipfile but not success.
ERROR: ERROR: Could not find a version that matches numpy
1 [[source]]
2 url = "https://pypi.python.org/simple"
3 name = "pypi"
4
5 [packages]
6 numpy = " * "
7 pandas = " * "
8 scikit-learn = " * "

This is a problem with the proxy or firewall. Just try and add the HTTP_PROXY to you ~/.profile and see if it works.

@tamuhey From your last comment, it seems to due to a broken installation of Python.

You need to reinstall Python with SSL module enabled.

Not active for a long time, close it now.

I had installed Python 3.7.4 using pyenv and I don't fully understand the reason but my Pipfile had this line in package list

[packages]
3-7-4 = "*"

Removing the 3-7-4 line fixed the issue for me.

These steps solved similar issue I had recently:

Delete the virtual environment and pipfile(s)

$ pipenv --rm 
$ rm Pipfile
$ rm Pipfile.lock 

then reinstall project dependencies
$ pipenv install package1 package2 package3

This issue occured for me when I installed a brew package that installed a new version of python on my machine (3.8 vs 3.7.x which I was using)

When it did this it broke the OpenSSL installation that pip was using. This was the reason that it could not find any versions on pip.

I ended up having to reinstall python with:

brew reinstall python

This StackOverflow answer helps give more details on this for others:

https://stackoverflow.com/a/59280089/1327815

Anybody having problems with locking pipenv but it worked the first time around creating a virtualenv: copy the Pipfile in your new directory then try locking it again using pipenv lock

Locking [dev-packages] dependenciesā€¦
Locking [packages] dependenciesā€¦
Success!
Updated Pipfile.lock (30ae14)!

Why is this issue closed? This is still an issue on Windows. Are there any fixes for WINDOWS machines? Thanks.

Was this page helpful?
0 / 5 - 0 ratings