question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Read timed out" error while generating lock file.

See original GitHub issue
Issue description

Creating the virtual environment and installing packages from pip with pipenv install is fine, but I get a Read timed out. error while creating the lock file. I’m running pipenv install numpy as the working example with Python version 2.7.12 on Ubuntu 16.04. (I do have pyenv installed but for this example the shim just points to the system python.)

Running pip list in the virtual environment shows the package installed correctly. (As does running the import statement in the python shell.) It’s just the lock file that has problems. I also tried running pipenv lock --clear with the created Pipfile, and the same error shows up.

Expected result

Clean exit and production of Pipfile.lock (not produced in practice)

Actual result
pipenv install numpy --verbose
Installing numpy...
⠋Installing u'numpy'
$ "/home/andrew/.local/share/virtualenvs/pipenv-test-folder-5LVhMAsj/bin/pip" install   --verbose    "numpy" -i https://pypi.org/simple --exists-action w
...
Adding numpy to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
using sources: [{u'url': u'https://pypi.org/simple', u'verify_ssl': True, u'name': u'pypi'}]
Using pip: -i https://pypi.org/simple

                          ROUND 1                           
Current constraints:
  numpy (from -r /tmp/pipenv-bKDTaP-requirements/pipenv-p_tTUY-constraints.txt (line 2))

Finding the best candidates:
  found candidate numpy==1.15.0 (constraint was <any>)

Finding secondary dependencies:
  numpy==1.15.0             requires numpy==1.15.0; python_version >= "2.7" and python_version != "3.0.*" and python_version != "3.1.*" and python_version != "3.2.*" and python_version != "3.3.*"

New dependencies found in this round:
  adding [u'numpy', '==1.15.0', '[]']
Removed dependencies in this round:
Unsafe dependencies in this round:
------------------------------------------------------------
Result of round 1: not stable

                          ROUND 2                           
Current constraints:
  numpy==1.15.0 (from -r /tmp/pipenv-bKDTaP-requirements/pipenv-p_tTUY-constraints.txt (line 2))

Finding the best candidates:
  found candidate numpy==1.15.0 (constraint was ==1.15.0)
Finding secondary dependencies:
  numpy==1.15.0             requires numpy==1.15.0; python_version >= "2.7" and python_version != "3.0.*" and python_version != "3.1.*" and python_version != "3.2.*" and python_version != "3.3.*"
------------------------------------------------------------
Result of round 2: stable, done

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pipenv/resolver.py", line 87, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/pipenv/resolver.py", line 76, in main
    system=system,
  File "/usr/local/lib/python2.7/dist-packages/pipenv/resolver.py", line 63, in resolve
    allow_global=system,
  File "/usr/local/lib/python2.7/dist-packages/pipenv/utils.py", line 402, in resolve_deps
    req_dir=req_dir
  File "/usr/local/lib/python2.7/dist-packages/pipenv/utils.py", line 294, in actually_resolve_deps
    hashes = resolver.resolve_hashes(results)
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/resolver.py", line 74, in resolve_hashes
    return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/resolver.py", line 74, in <dictcomp>
    return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 448, in get_hashes
    for candidate in matching_candidates
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 448, in <setcomp>
    for candidate in matching_candidates
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 72, in get_hash
    hash_value = self._get_file_hash(location)
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 81, in _get_file_hash
    for chunk in iter(lambda: fp.read(8096), b""):
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 81, in <lambda>
    for chunk in iter(lambda: fp.read(8096), b""):
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/notpip/_vendor/urllib3/response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/pipenv/patched/notpip/_vendor/urllib3/response.py", line 316, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pipenv.patched.notpip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
/usr/local/lib/python2.7/dist-packages/pipenv/_compat.py:113: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-bKDTaP-requirements'>
  warnings.warn(warn_message, ResourceWarning)

/usr/local/lib/python2.7/dist-packages/pipenv/_compat.py:113: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-IF40st-requirements'>
  warnings.warn(warn_message, ResourceWarning)
Steps to replicate

Just pipenv install numpy in a clean folder.


$ pipenv --support

Pipenv version: '2018.7.1'

Pipenv location: '/usr/local/lib/python2.7/dist-packages/pipenv'

Python location: '/usr/bin/python'

Other Python installations in PATH:

  • 2.7: /home/andrew/.pyenv/shims/python2.7

  • 2.7: /home/andrew/.pyenv/shims/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.5: /home/andrew/.pyenv/shims/python3.5m

  • 3.5: /home/andrew/.pyenv/shims/python3.5

  • 3.5: /usr/bin/python3.5

  • 3.5: /home/andrew/anaconda3/bin/python3.5

  • 2.7.12: /home/andrew/.pyenv/shims/python

  • 2.7.12: /usr/bin/python

  • 3.5.2: /home/andrew/anaconda3/bin/python

  • 2.7.12: /home/andrew/.pyenv/shims/python2

  • 2.7.12: /usr/bin/python2

  • 3.5.2: /home/andrew/.pyenv/shims/python3

  • 3.5.2: /usr/bin/python3

  • 3.5.2: /home/andrew/anaconda3/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-131-generic',
 'platform_system': 'Linux',
 'platform_version': '#157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018',
 'python_full_version': '2.7.12',
 'python_version': '2.7',
 'sys_platform': 'linux2'}

System environment variables:

  • UPSTART_EVENTS
  • PYTHONDONTWRITEBYTECODE
  • XDG_SESSION_TYPE
  • INFOPATH
  • SHELL
  • TEXINPUTS
  • PYENV_SHELL
  • XDG_DATA_DIRS
  • MANDATORY_PATH
  • COMPIZ_CONFIG_PROFILE
  • UNITY_DEFAULT_PROFILE
  • UPSTART_INSTANCE
  • JOB
  • SESSION
  • MANPATH
  • ALGENCAN
  • XMODIFIERS
  • JAVA_HOME
  • GTK2_MODULES
  • XDG_RUNTIME_DIR
  • TEC_360_2014
  • PYTHONPATH
  • COMPIZ_BIN_PATH
  • QT_ACCESSIBILITY
  • XDG_SESSION_ID
  • DBUS_SESSION_BUS_ADDRESS
  • DEFAULTS_PATH
  • DESKTOP_SESSION
  • GTK_MODULES
  • INSTANCE
  • PETSC_ARCH
  • XDG_MENU_PREFIX
  • LS_COLORS
  • GNOME_DESKTOP_SESSION_ID
  • TAPENADE_HOME
  • LESSOPEN
  • USER
  • XDG_VTNR
  • PYENV_VIRTUALENV_INIT
  • XAUTHORITY
  • LANGUAGE
  • SESSION_MANAGER
  • SHLVL
  • QT_QPA_PLATFORMTHEME
  • DISPLAY
  • CLUTTER_IM_MODULE
  • WINDOWID
  • PETSC_DIR
  • GPG_AGENT_INFO
  • XDG_SESSION_DESKTOP
  • GDMSESSION
  • UPSTART_JOB
  • XDG_SEAT_PATH
  • PIP_PYTHON_PATH
  • GTK_IM_MODULE
  • TEXMFHOME
  • XDG_CONFIG_DIRS
  • XLIB_SKIP_ARGB_VISUALS
  • PYENV_HOOK_PATH
  • PYENV_ROOT
  • TEC_360_2009
  • TAO_DIR
  • XDG_GREETER_DATA_DIR
  • QT4_IM_MODULE
  • GALAHAD
  • TEXMFCNF
  • HOME
  • LD_LIBRARY_PATH
  • LANG
  • QT_LINUX_ACCESSIBILITY_ALWAYS_ON
  • PYENV_VERSION
  • MASTSIF
  • VTE_VERSION
  • XDG_CURRENT_DESKTOP
  • LESSCLOSE
  • GNOME_KEYRING_PID
  • QRM_NUM_THREADS
  • ARCHDEFS
  • CUTEST
  • PYENV_DIR
  • UNITY_HAS_3D_SUPPORT
  • QT_IM_MODULE
  • LOGNAME
  • XDG_SEAT
  • GNOME_KEYRING_CONTROL
  • PATH
  • TERM
  • XDG_SESSION_PATH
  • SIFDECODE
  • SESSIONTYPE
  • IM_CONFIG_PHASE
  • SSH_AUTH_SOCK
  • LATEX_STYLES
  • UPSTART_SESSION
  • DEAL_II_DIR
  • GDM_LANG
  • MYARCH
  • PWD

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/bin:/home/andrew/.pyenv/libexec:/home/andrew/.pyenv/plugins/python-build/bin:/home/andrew/.pyenv/plugins/pyenv-virtualenv/bin:/home/andrew/.pyenv/plugins/pyenv-update/bin:/home/andrew/.pyenv/plugins/pyenv-installer/bin:/home/andrew/.pyenv/plugins/pyenv-doctor/bin:/home/andrew/.pyenv/plugins/pyenv-virtualenv/shims:/home/andrew/.pyenv/shims:~/.pyenv/bin:/usr/local/texlive/2012/bin/x86_64-linux:/home/andrew/git-code/cutest-mirror/bin:/home/andrew/git-code/sifdecode-mirror/bin:/home/andrew/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/tecplot360ex/bin:/home/andrew/galahad/bin:/home/andrew/packages/tapenade3.10/bin:/usr/ansys_inc/v140/icemcfd/linux64_amd/bin/:/home/andrew/anaconda3/bin:/home/andrew/ampl.linux64
  • SHELL: /bin/bash
  • LANG: en_CA.UTF-8
  • PWD: /home/andrew/git-code/pipenv-test-folder

Contents of Pipfile (‘/home/andrew/git-code/pipenv-test-folder/Pipfile’):

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

[dev-packages]

[packages]
numpy = "*"

[requires]
python_version = "2.7"

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:7

github_iconTop GitHub Comments

3reactions
rincewindcommented, Aug 13, 2018

I had the same problem. This seems to have something to do with #2110 and #2193. The problem went away when I upgraded my system wide certifi from 2018.1.18 to 2018.8.13:

$ PIP_REQUIRE_VIRTUALENV=false pip3 install certifi --upgrade
1reaction
ebuildycommented, Jan 15, 2019

what about adding a cache proxy on your machine?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error:Timeout waiting to lock buildscript class cache for build ...
The easiest way to solve this will be to delete everything under C:\Users\Administrator\.gradle\caches . There is a cache.properties.lock that is holding a ...
Read more >
Unexpected exception while running Enterprise Search: Error
Getting read timeout error while setting up, Appsearch in ECK cluster. Elastic is up and running fine.
Read more >
How to Fix a Lock Wait Timeout Exceeded Error in MySQL
This blog post covers the implications of a MySQL InnoDB lock wait timeout error, how to deal with it, and how to track...
Read more >
15.00 - 2575 Timed out waiting for lock on %DBID.%TVMID
2575 Timed out waiting for lock on %DBID.%TVMID Explanation: This error occurs when a transaction is unable to obtain a lock on a...
Read more >
The operation timed out while waiting for a lock - Moodle.org
Because you are on MySQL, the default lock factory you will be using is "file locking" - I would try switching to DB...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found