I'm trying to set up a new environment and Ive run into an issue with PIPENV.
Pipenv will create the virtual env, but when I try to install any package using the command pipenv install <package>
the
install and the lock fails - see an example of the traceback below.
I can bypass the package install issue with pipenv run pip install <package>
but even after that, the lock will still fail.
pipenv lock --pre
fails with the same errorI've read through the tracebacks, but I can't figure out what's going wrong. The only variable here is the new OS (Ventura), but not sure what about it could be causing the problem.
Installing requests...
Resolving requests...
Added requests to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
⠸ Locking...False
ERROR:pip.subprocessor:[present-rich] python setup.py egg_info exited with 1
[ResolutionFailure]: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/resolver.py", line 645, in _main
[ResolutionFailure]: resolve_packages(
[ResolutionFailure]: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/resolver.py", line 612, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: ^^^^^^^^
[ResolutionFailure]: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/resolver.py", line 592, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: ^^^^^^^^^^^^^
[ResolutionFailure]: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 892, in resolve_deps
[ResolutionFailure]: results, hashes, internal_resolver = actually_resolve_deps(
[ResolutionFailure]: ^^^^^^^^^^^^^^^^^^^^^^
[ResolutionFailure]: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 665, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 442, in resolve
[ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
You can use $ pipenv run pip install <requirement_name> to bypass this mechanism, then run $ pipenv graph to inspect the versions actually installed in the virtualenv.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: metadata generation failed
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/cli/options.py", line 58, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/cli/command.py", line 209, in install
do_install(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/routines/install.py", line 297, in do_install
raise e
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/routines/install.py", line 281, in do_install
do_init(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/routines/install.py", line 672, in do_init
do_lock(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/routines/lock.py", line 65, in do_lock
venv_resolve_deps(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 833, in venv_resolve_deps
c = resolve(cmd, st, project=project)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 702, in resolve
raise RuntimeError("Failed to lock Pipfile.lock!")
RuntimeError: Failed to lock Pipfile.lock!
(test_project) bash-3.2$ pipenv graph
requests==2.31.0
├── certifi [required: >=2017.4.17, installed: 2023.7.22]
├── charset-normalizer [required: >=2,<4, installed: 3.3.0]
├── idna [required: >=2.5,<4, installed: 3.4]
└── urllib3 [required: >=1.21.1,<3, installed: 2.0.6]
##############################
Here is the output of pipenv --support
Pipenv version: '2023.10.3'
Pipenv location: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pipenv'
Python location: '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10'
OS Name: 'posix'
User pip version: '23.2.1'
user Python installations found:
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.10.11',
'os_name': 'posix',
'platform_machine': 'arm64',
'platform_python_implementation': 'CPython',
'platform_release': '22.6.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT '
'2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6020',
'python_full_version': '3.10.11',
'python_version': '3.10',
'sys_platform': 'darwin'}
System environment variables:
TERM_PROGRAM
PIP_PYTHON_PATH
TERM
SHELL
TMPDIR
PIPENV_VENV_IN_PROJECT
TERM_PROGRAM_VERSION
TERM_SESSION_ID
USER
SSH_AUTH_SOCK
__CF_USER_TEXT_ENCODING
VIRTUAL_ENV
PIPENV_ACTIVE
PATH
__CFBundleIdentifier
PWD
LANG
PYTHONFINDER_IGNORE_UNSUPPORTED
XPC_FLAGS
PS1
PYTHONDONTWRITEBYTECODE
XPC_SERVICE_NAME
HOME
SHLVL
LOGNAME
PIP_DISABLE_PIP_VERSION_CHECK
VIRTUAL_ENV_PROMPT
_
Pipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT
: 1
PIPENV_ACTIVE
: 1
Debug–specific environment variables:
PATH
: /Users/username/Documents/Github/test_project/.venv/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Little Snitch.app/Contents/Components:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
SHELL
: /bin/bash
LANG
: en_US.UTF-8
PWD
: /Users/username/Documents/Github/test_project
VIRTUAL_ENV
: /Users/username/Documents/Github/test_project/.venv
Contents of Pipfile
('/Users/username/Documents/Github/test_project/Pipfile'):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
aiohttp = "==3.8.1"
attr = "==0.3.1"
attrs = "==21.4.0"
blinker = "==1.4"
brotli = "==1.0.9"
ca-certs-locater = "==1.0"
click = "==8.0.4"
configparser = "==5.2.0"
cryptography = "==36.0.1"
cython = "==0.29.28"
dl = "==0.1.0"
docutils = "==0.18.1"
grpc-status = "==1.0.0"
htmlparser = "==0.0.2"
ipython = "==8.3.0"
ipywidgets = "==7.7.0"
jinja2 = "==3.1.2"
jnius = "==1.1.0"
keyring = "==23.5.0"
lockfile = "==0.12.2"
lxml = "==4.8.0"
numpy = "==1.22.2"
oauth2client = "==4.1.3"
ordereddict = "==1.1"
pillow = "==9.1.0"
pyopenssl = "==22.0.0"
pytest = "==7.0.1"
pyu2f = "==0.1.5"
railroad = "==0.5.0"
simplejson = "==3.17.6"
sphinx = "==4.5.0"
toml = "==0.10.2"
tornado = "==6.1"
unicodedata2 = "==14.0.0"
win-inet-pton = "==1.1.0"
xmlrpclib = "==1.0.1"
[dev-packages]
[requires]
python_version = "3.11"
Working off of @dom-hastings answer, all I had to do was pipenv --rm
then pipenv install
and pipenv shell
and everything was happy again.
Seems like when I did pipenv shell
first, it may have caused this mess in the first place but hard to tell for sure. I typically do pipenv install
followed by pipenv shell
and typically do not experience any issues.
I hit this same problem on my machine this week. I was having inconsistent results to others in my team too.
In my case, the problem was that:
brew
.pipenv
when my Python version was 3.10.When I ran:
head $(which pipenv)
I saw a reference to ...python3.10
... in the shebang line.
If you see something similar, you might have the same problem and I was able to resolve with the following:
brew uninstall [email protected]
brew install pipenv
brew link --overwrite pipenv
now head $(which pipenv)
shows no hardcoded reference to python3.10 and instead uses a Python version relative to its own directory, but from here I was able to:
pipenv --rm
pipenv shell
pipenv install
and everything worked as expected. Leaving this here for reference for anyone else that's having problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With