Closed khaeru closed 1 year ago
Thanks @khaeru for the detailed analysis.
I think that the easiest solution is to make Postgres an optional dependency of ixmp4 - because indeed, many users will only require it to read from an IIASA database, but not ever have a local database I stance.
What do you think @meksor?
I think it's our only option, besides leaving it as is. Depending on the package optionally will be a lot of work for ixmp4 though. I already see edgecases like:
So, while adding all these guards we will probably miss some, fair warning.
That being said I agree completely that this should probably happen or at least be better documented.
I was hoping that by the point we ran into this issue the psycopg maintainers have either finished psycopg3 or removed the pg_config dependency from v2. But alas this didn't happen and the thread about this whole issue is one of the most hostile I have ever read on this platform: https://github.com/psycopg/psycopg2/issues/1077
Actually, a correction on this: psycopg3 IS out, its just not called psycopg3 but reintegrated into the original package. Furthermore, binary installation is no longer discouraged: https://www.psycopg.org/psycopg3/docs/basic/install.html#binary-installation There is also a pure-python implementation to fall back to but it still requires postgres system dependencies...
ixmp4 v0.5.0 is live on pypi and conda, this uses the binary pyscopg 3 and should resolve the issue
Great —I can confirm that the jobs that were failing the other day are now installing:
All three from PyPI wheels (that is, not from source).
Thanks for the quick response!
With pyam-iamc 2.0.0, we see CI failures like this:
psycopg2
you shouldn’t usepsycopg2-binary
as a module dependency. For production use you are advised to use the source distribution.” —so the ixmp4 requirement is in line with that advice.pg_config
. This is an issue in that the vast majority of users of message_ix (where pyam-iamc is an optional dependency via the "report" set) will (a) not havepg_config
and (b) not know how to install it.psycopg2-binary
manually, installing pyam-iamc will still force install ofpsycopg2
.Some fixes I can imagine, not mutually exclusive:
pg_config
appropriate to their system.psycopg2
. For instance, a user could givepyam-iamc[something]
and getixmp4
withpsycopg2-binary
.cc @glatterf42