polca / premise

Coupling Integrated Assessment Models output with Life Cycle Assessment.
BSD 3-Clause "New" or "Revised" License
101 stars 45 forks source link

Forced downgrade of bw2io upon installing premise 1.6.9 #118

Closed mkvdhulst closed 9 months ago

mkvdhulst commented 10 months ago

I created a new environment and installed bw2 through conda create -n [name] brightway2 jupyterlab, which installs brighway2 2.4.3 with bw2io 0.8.8.

When I subsequently install premise through conda install premise, I get premise-2023.04.25.

Forcing the install of the latest version through conda install premise=1.6.9 results in a downgrade from bw2io 0.8.8 to bw2io 0.8.7.

When I try to upgrade back to bw2io 0.8.8 through conda install -c conda-forge bw2io=0.8.8 it fails to solve the environment.

Perhaps setting the requirement of premise more flexible for bw2io would resolve my problem. Is there a way this can be done?

Stew-McD commented 9 months ago

Probably best to have a separate environment for premise.

Otherwise, if you want to live dangerously, you could remove the pinned requirement and see what happens. (may break everything, who knows...)

I did it with the 'python_requires=">=3.9,<3.11"' because I was too lazy to install a different python version and it works fine, but changes in bw2io are most likely much more critical.

The way to do it with conda is a bit convoluted I think, so this is how it would go with pip (should work in your existing conda env)

That should reinstall it with a different pinned dependency. (may not work anymore though...)

Stew-McD commented 9 months ago

Oh. probably you could also just change this directly in the environment meta file. I only use conda for activity browser, but here is an example of where it might be changed. Just find the 'premise."something".json' in your conda environment and do the same edit as before.

image

maybe it will then allow you to upgrade bw2io, maybe not...

romainsacchi commented 9 months ago

Indeed, premise did require bw2io 0.8.7 before, because 0.8.8 struggles with reading CSVs. However, I since removed the version requirements in premise 1.6.9 and 1.7.0, because bw2io 0.8.10 has been released. So, in summary, you should be able to upgrade bw2io to 0.8.10 and premise to 1.7.0.

mkvdhulst commented 9 months ago

I tried @Stew-McD suggestions, but this did not resolve the issue for me. Next, I tried the approach proposed by @romainsacchi. I was not able to create an environment containing both premise 1.7.0 and bw2io 0.8.10 through conda install. Whether I would first install bw2io or premise did not make a difference. There are incompatible packages which conda has a great difficulty in handling. I ended up setting up a new environment with conda create -n [name] bw2io=0.8.10 and subsequently installed premise through pip install premise==1.7.0. However, this again downgraded bw2io to 0.8.7, despite the dependencies being more loosely defined for premise 1.7.0. So I also installed bw2io with pip via pip install bw2io==0.8.10. This worked, but I did get a warning for dependency conflicts:

pypardiso 0.4.2 requires mkl, which is not installed. premise 1.7.0 requires bw2io==0.8.7, but you have bw2io 0.8.10 which is incompatible.

Nonetheless, I was able to get premise 1.7.0 running this way and apply it to ecoinvent 3.9.1 (the main reason I need bw2io >0.8.7). I did run into a memory error at some point, but I think that problem is on my side. I will report on it, should it persist.

romainsacchi commented 9 months ago

Now premise (1.7.2, in the release pipeline) requires bw2io>=0.8.10. So that should solve the issue. bw2io==0.8.10 allows installing all ecoinvent versions. Please re-open this issue if it's not the case.