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.

ContextualVersionConflict on requirement to re-install when no egg_info and --process-dependency-links

See original GitHub issue
  • Pip version: 9.0.1
  • Python version: 2.7.12
  • Operating system: Ubuntu 16.04

Description:

In a particular case, unexpected ContextualVersionConflict occurs.

$ pip install --process-dependency-links -e .
Obtaining file:///.../pip-issue-4537
Exception:
Traceback (most recent call last):
  ...
ContextualVersionConflict: (simplejson 3.9.0 (.../env/lib/python2.7/site-packages), Requirement.parse('simplejson==3.10.0'), set(['pip-issue-4537']))

The conditions are:

  • pip==9.0.1 (no problem in 8.1.2)
  • The package to be installed has a dependency. The dependent package was already installed but different version. So it should be upgraded.
  • Use --process-dependency-links option.
  • Use -e option.
  • No egg_info directory yet.

What I’ve run:

Here’s the steps to reproduce this issue:

$ pip install pip==9.0.1
$ mkdir pip-issue-4537
$ cd pip-issue-4537
$ echo "from setuptools import setup" > setup.py
$ echo "setup(name='pip-issue-4537', install_requires=['simplejson==3.10.0'])" >> setup.py
$ pip install simplejson==3.9.0
$ pip install --process-dependency-links -e .
Obtaining file:///.../pip-issue-4537
Exception:
Traceback (most recent call last):
  ...
ContextualVersionConflict: (simplejson 3.9.0 (.../env/lib/python2.7/site-packages), Requirement.parse('simplejson==3.10.0'), set(['pip-issue-4537']))

But if we have a egg_info directory, this error doesn’t occur:

$ python setup.py install_egg_info
$ pip install --process-dependency-links -e .
Obtaining file:///.../pip-issue-4537
Exception:
Traceback (most recent call last):
  ...
ContextualVersionConflict: (simplejson 3.9.0 (.../env/lib/python2.7/site-packages), Requirement.parse('simplejson==3.10.0'), set(['pip-issue-4537']))

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

17reactions
mastakcommented, Mar 15, 2018

Hi,

We encounter this at Circleci. As a workaround you can make egg-info before:

python setup.py install_egg_info
pip install -e .
8reactions
NotSqrtcommented, Mar 15, 2018

Hi,

In case someone else encounters this situation:

I faced this issue on Gitlab CI when reusing the same virtualenv between builds. When the previous build had run pip install -e ., the corresponding *.egg-info/ is cleaned up at the start of the next build, which will result in ContextualVersionConflict exception when running pip install -e ..

By removing the *.egg-link file in the reused virtualenv, I can rerun pip install -e . without problems.

Thanks !


Edit: The most reliable way : pip remove the packages installed as -e on CI clean-up (after_script with Gitlab CI).

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 3.7.6 pip setup.py test with ContextualVersionConflict
I have tried to add the urllib3 version in install_requires , tests_require and in requirements.txt , but no luck so far. setuptools ·...
Read more >
pkg_resources.ContextualVersionConflict: importlib-metadata ...
I have no problems on building and uploading the package from local, this issue happens only with the Travis pipeline. This is the...
Read more >
Read error message carefully Python - Dance with Programming
Yesterday, I tried to install a python package in a conda environment. ... /tmp/pip-pip-egg-info-gipoehix cwd: /tmp/pip-req-build-vtqxcvpj/ ...
Read more >
mlagents-learn ContextualVersionConflict error related to ...
I'm not knowledgeable enough in Python packages configuration to know how ... raise VersionConflict(dist, req).with_context(dependent_req)
Read more >
[Solved] pip pip ImportError: cannot import name 'main' after update
pip ContextualVersionConflict on requirement to re-install when no egg_info and --process-dependency-links. Hi We encounter this at Circleci As a workaround ...
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