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.

`pipenv install XYZ` command sometimes hangs indefinitely at "Locking [packages] dependencies"

See original GitHub issue

Similar to these issues:

Summary

When using pipenv install XYZ, the process hangs indefinitely at “Locking [packages] dependencies”.

This doesn’t happen every time, and may be related to which package is being installed. This morning it is happening every time I try to install tensorflow. Last night it was happening for numpy as well, but today numpy is fine.

The hanged response seems to last indefinitely (though I did manually terminate the process after an hour). The Pipfile.lock is not written, but the Pipfile is written and the expected packages are installed and listed when I run pipenv run pip freeze.

I was able to reproduce this using various permutations of:

  • (L)ubuntu 16.04 and (X)ubuntu 17.10
  • pipenv --three and pipenv --two
  • pipenv installed through python 2.7 and pipenv installed through python 3.5
  • …and I downloaded the pipenv source and installed that in an isolated environment to see if the issue was specific to pipenv version 11.8.3. I experienced the same behavior in 11.9.0.

I am also able to reproduce it by simply running pipenv lock or pipenv update if I have tensorflow (or whatever package is currently causing me trouble) listed in my Pipfile.

$ python -m pipenv.help output

Pipenv version: '11.8.3'

Pipenv location: '/home/mary/.local/lib/python2.7/site-packages/pipenv'

Python location: '/usr/bin/python'

Other Python installations in PATH:

  • 2.7: /usr/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.5: /usr/bin/python3.5m

  • 3.5: /usr/bin/python3.5

  • 2.7.12: /usr/bin/python

  • 2.7.12: /usr/bin/python2

  • 3.5.2: /usr/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.13.0-37-generic',
 'platform_system': 'Linux',
 'platform_version': '#42~16.04.1-Ubuntu SMP Wed Mar 7 16:03:28 UTC 2018',
 'python_full_version': '2.7.12',
 'python_version': '2.7',
 'sys_platform': 'linux2'}

System environment variables:

  • MANDATORY_PATH
  • _LXSESSION_PID
  • XDG_GREETER_DATA_DIR
  • PROJECT_HOME
  • LC_CTYPE
  • PYTHONDONTWRITEBYTECODE
  • XDG_CURRENT_DESKTOP
  • XDG_SESSION_TYPE
  • LOGNAME
  • XDG_SEAT
  • PATH
  • XDG_VTNR
  • QT_PLATFORM_PLUGIN
  • PYTHONUNBUFFERED
  • VIRTUALENVWRAPPER_SCRIPT
  • ZSH
  • DISPLAY
  • SSH_AGENT_PID
  • LANG
  • TERM
  • SHELL
  • XDG_SESSION_PATH
  • XAUTHORITY
  • LANGUAGE
  • SHLVL
  • QT_LINUX_ACCESSIBILITY_ALWAYS_ON
  • QT_QPA_PLATFORMTHEME
  • SESSION_FOLDER
  • QT_ACCESSIBILITY
  • WINDOWID
  • LIBVIRT_DEFAULT_URI
  • HOME
  • XDG_SESSION_DESKTOP
  • SAL_USE_VCLPLUGIN
  • XDG_RUNTIME_DIR
  • WORKON_HOME
  • SSH_AUTH_SOCK
  • VTE_VERSION
  • GDMSESSION
  • VIRTUALENVWRAPPER_WORKON_CD
  • XDG_SEAT_PATH
  • PIP_PYTHON_PATH
  • XDG_SESSION_ID
  • DBUS_SESSION_BUS_ADDRESS
  • _
  • VIRTUALENVWRAPPER_HOOK_DIR
  • VIRTUALENVWRAPPER_PROJECT_FILENAME
  • DESKTOP_SESSION
  • LSCOLORS
  • XDG_CONFIG_DIRS
  • DEFAULTS_PATH
  • XDG_CONFIG_HOME
  • OLDPWD
  • LS_COLORS
  • GDM_LANG
  • XDG_DATA_DIRS
  • PWD
  • XDG_MENU_PREFIX
  • LESS
  • PAGER
  • USER

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/mary/bin:/home/mary/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
  • SHELL: /usr/bin/zsh
  • LANG: en_US.UTF-8
  • PWD: /home/mary/Development/Projects/poor_mans_smart_camera

Contents of Pipfile (‘/home/mary/Development/Projects/poor_mans_smart_camera/Pipfile’):

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

[dev-packages]

[packages]
numpy = "*"
tensorflow = "*"

[requires]
python_version = "3.5"


Expected result

I expect the step in which the Pipfile.lock is generated to take at most a minute.

I have good hardware with lots of free memory and processing power, so I don’t think this is a resource constraint. My internet speed is 60 Mbps, so I doubt it is a networking issue when requesting packages.

Actual result

verbose_output.txt

While this screenshot doesn’t show verbose output like the file above, it does visually demonstrate what I am experiencing. image

Steps to replicate
  1. Spin up new virtualenv using pipenv --three or pipenv --two.
  2. Confirm things are working as expected with a package you know is installing fine such as pipenv install pylint.
  3. Now cause it to hang by installing a package that is not working for whatever reason such as pipenv install tensorflow.

Pipfile

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:29
  • Comments:78 (32 by maintainers)

github_iconTop GitHub Comments

23reactions
sersorrelcommented, Mar 30, 2018

Would it be feasible to display the package that’s currently being locked? I think that would at least help to stop people thinking that Pipenv is hanging.

10reactions
MarenstainBearcommented, Apr 11, 2018

@uranusjr @techalchemy @jtratner

Holy buckets, Batman! It worked!

mary@marvel:~
> sudo rm ~/.cache/pip* -rf
[sudo] password for mary: 

mary@marvel:~
> mktmpenv 
Using base prefix '/usr'
New python executable in /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/python3
Also creating executable in /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/preactivate
virtualenvwrapper.user_scripts creating /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/postactivate
virtualenvwrapper.user_scripts creating /home/mary/Development/.virtualenvs/tmp-60224356c1829db/bin/get_env_details
This is a temporary environment. It will be deleted when you run 'deactivate'.
(tmp-60224356c1829db) 
mary@marvel:~/Development/.virtualenvs/tmp-60224356c1829db
> pipenv install protobuf
Creating a Pipfile for this project…
Installing protobuf…
Collecting protobuf
  Downloading protobuf-3.5.2.post1-cp35-cp35m-manylinux1_x86_64.whl (6.4MB)
Requirement already satisfied: setuptools in ./lib/python3.5/site-packages (from protobuf)
Collecting six>=1.9 (from protobuf)
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six, protobuf
Successfully installed protobuf-3.5.2.post1 six-1.11.0

Adding protobuf to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (735738)!
Installing dependencies from Pipfile.lock (735738)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:00
(tmp-60224356c1829db) 
mary@marvel:~/Development/.virtualenvs/tmp-60224356c1829db
> 

Let’s see if this solution works for some of the other people reporting the same issue. @roddds @jlhood @roveo @claytonaalves If you’re still able to reproduce pipenv hanging indefinitely at “Lock… [packages] dependencies”, try clearing your pip (and pipenv?) cache at ~/.cache/.pip and report back on whether that resolved the issue with pipenv hanging. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pipenv stuck " Locking..." - python - Stack Overflow
pipenv lock is used to create a Pipfile.lock, which declares all dependencies (and sub-dependencies) of your project, their latest available ...
Read more >
Common Pipenv Errors and How to Solve Them: Why Won't it ...
The second most common reason locking fails is that we attempt to install a package that is a pre-release version. You can resolve...
Read more >
pipenv Documentation - Read the Docs
Pipenv is a tool that aims to bring the best of all packaging worlds ... Generates and checks file hashes for locked dependencies...
Read more >
Pipenv Hangs At Install From Existing Pipfile.Lock ... - ADocLib
pipenv install XYZ command sometimes hangs indefinitely at Locking [packages] dependencies. Similar to these issues: https://github.com/pypa/pipenv/issues/.
Read more >
Pipenv: A Guide to the New Python Packaging Tool
This command allows you to get exact versions for all 3rd party libraries currently installed, including the sub-dependencies pip installed automatically. So ...
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