Dipu Krishnan
Dipu Krishnan

Reputation: 311

Conflicting module dependence in python project

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. cosmic-ray 8.3.5 requires virtualenv<=16.7.10, but you have virtualenv 20.21.0 which is incompatible.

Cosmic-ray uses very old version of virtualenv and its causing conflicts with other modules which uses relatively newer versions.

In my requirements-dev.txt, I have two packages, one internally use another package virtualenv with version 20 and another one with virtualenv version 16. When I try to install the packages I get the above error.

How should we handle such scenarios?

I tried the normal ways of not mentioning the version in requirements.txt but same error happens.

Upvotes: 0

Views: 1496

Answers (1)

CraftyClawBoom
CraftyClawBoom

Reputation: 1

There is no way for two versions of the same Python package to live in the same place. The dependency resolver in Python does not allow this.

In this case, there are a few things that you can do to help solve this problem:

  1. Use a virtual environment for each individual project on your machine. This will make sure that you can avoid conflicts between projects that use different versions of the same package.
  2. Try upgrading the two packages that are causing the dependency error. Newer versions of this software might be able to share the same version of the conflicting package. This can be achieved manually, or with a package manager. I use conda to manage my dependencies and their versions.
  3. If nothing else works, try to find a package with the same functionality that doesn't use the older version of virtualenv, or try to split your project into multiple pieces.

Upvotes: 0

Related Questions