Kosmylo
Kosmylo

Reputation: 428

Install two versions of a certain package in anaconda

I have the following issue:

One package that I want to install through conda demands a certain version of another package. However, I want to install a newer version of the second package.

Specifically, the package energysim 2.1.5 demands the package fmpy 0.2.14 and when I am trying to install a newer version of fmpy I am getting error:

ERROR: energysim 2.1.5 has requirement fmpy==0.2.14, but you'll have fmpy 0.3.0 which is incompatible.

Is it possible something like that and how?

Upvotes: 0

Views: 83

Answers (3)

Matt Thompson
Matt Thompson

Reputation: 659

The package energysim is pinned [1] to use fmpy 0.2.14 and no other versions (older or newer). It looks like this was done intentionally [2]; the maintainer may have good reasons to enforce this pin. pip won't let you install 0.3 because of this pin.

I would reach out to them via a GitHub issue to ask if their package is compatible with newer versions. It looks like fmpy 0.2.14 is about a year and a half old, for what it's worth. It may work fine with 0.3.x, but IMHO it should be tested and released before using it.

  1. https://github.com/dgusain1/energysim/blob/07282257073058119664f9a5e8fd4300e138a64d/setup.py#L25-L29
  2. https://github.com/dgusain1/energysim/commit/f84dad3ab913b43eea3187da54c132319c23d1a7

Upvotes: 1

FlyingTeller
FlyingTeller

Reputation: 20472

In my answer, I am assuming the following case:

  • You want to install packageA, which requires packageB==v1
  • You also want to install packageB at version v2

Your goal: Install packageB with version v1 and v2 to make this possible

I don't know of any way this can be achieved. I also don't see a way that this would even technically work. Say you do import packageB in your code. Which version should be imported? How should python know that import packageB done by packageA should be v1, but import packageB done by you should be v2?

I see these options:

  1. not using packageA, so that you can have packageB at the version you need
  2. If possible, have one environment where you packageA and packageB and another with only packageB at the version you want
  3. Fork packageA and create your own custom version that works with your required version of packageB

Upvotes: 2

CutePoison
CutePoison

Reputation: 5355

Wouldn't you just be able to do:

conda install packageB==2.0.0
conda install packageA

Upvotes: 1

Related Questions