ipfs-shipyard / py-ipfs-http-client

A python client library for the IPFS API
MIT License
678 stars 199 forks source link

`VersionMismatch: Unsupported daemon version '0.17.0' (not in range: 0.4.22 ≤ … < 0.7.0)` #319

Closed hemangjoshi37a closed 1 year ago

hemangjoshi37a commented 1 year ago

code I ran :

import ipfshttpclient
client = ipfshttpclient.connect()  # Connects to: /dns/localhost/tcp/5001/http
res = client.add('test.txt')
res

Error I got :

VersionMismatch                           Traceback (most recent call last)
/tmp/ipykernel_14756/1556597859.py in <module>
      1 import ipfshttpclient
----> 2 client = ipfshttpclient.connect()  # Connects to: /dns/localhost/tcp/5001/http
      3 res = client.add('test.txt')
      4 res
      5 # {'Hash': 'QmWxS5aNTFEc9XbMX1ASvLET1zrqEaTssqt33rVZQCQb22', 'Name': 'test.txt'}

~/anaconda3/lib/python3.8/site-packages/ipfshttpclient/client/__init__.py in connect(addr, base, chunk_size, offline, session, auth, cookies, headers, timeout, username, password)
    117 
    118         # Query version number from daemon and validate it
--> 119         assert_version(client.apply_workarounds()["Version"])
    120 
    121         return client

~/anaconda3/lib/python3.8/site-packages/ipfshttpclient/client/__init__.py in assert_version(version, minimum, maximum, blacklist)
     67 
     68         if minimum > version or version >= maximum:
---> 69                 raise exceptions.VersionMismatch(version, minimum, maximum)
     70 
     71         for blacklisted in blacklist:

VersionMismatch: Unsupported daemon version '0.17.0' (not in range: 0.4.22 ≤ … < 0.7.0)
glenvollmer commented 1 year ago

any update on this issue?

JustinGirard commented 1 year ago

I had to fork the repo and remove the version check :(

hemangjoshi37a commented 1 year ago

@glenvollmer not yet but trying

@JustinGirard can you share link to your working repo if possible?

kasteph commented 1 year ago

This actually looks like a duplicate of #313 and it seems to be an ongoing problem whenever kubo upgrades. For any ongoing discussions/issues for this topic, I'd like to defer to the other issue so that it's easier to have the info in one place and focus.

Thanks.

hemangjoshi37a commented 1 year ago

@kasteph, thanks for pointing out the duplication. I agree that it would be easier to continue the discussion in one place.

As @JustinGirard mentioned, a temporary workaround might be to fork the repo and remove the version check. However, this isn't ideal as it may lead to unforeseen issues due to incompatible daemon versions.

I'm curious if there are any plans to update the supported daemon versions in the official py-ipfs-http-client repository? This seems to be a recurring issue whenever the IPFS daemon version is updated.

Alternatively, would it be possible to incorporate a more flexible version checking mechanism, that either provides a clear warning message instead of failing, or has an easier way to update the supported versions when new daemon updates are rolled out?

Looking forward to your thoughts.

Best, @hemangjoshi37a

kasteph commented 1 year ago

@hemangjoshi37a thank you so much for the detailed comment!

As @JustinGirard mentioned, a temporary workaround might be to fork the repo and remove the version check. However, this isn't ideal as it may lead to unforeseen issues due to incompatible daemon versions.

I agree, we should address this as soon as possible as this pretty much makes this library unusable.

I'm curious if there are any plans to update the supported daemon versions in the official py-ipfs-http-client repository? This seems to be a recurring issue whenever the IPFS daemon version is updated.

Yes, that's the plan.

Alternatively, would it be possible to incorporate a more flexible version checking mechanism, that either provides a clear warning message instead of failing, or has an easier way to update the supported versions when new daemon updates are rolled out?

IIRC, the Java HTTP client of IPFS only checks for the minimum supported version. I believe we should be doing the same as that keeps it more flexible and also makes it rather simple to maintain. We would thus set the expectations that the user can expect parity between the Kubo implementation and the Python client.

I do also see the value in allowing users to update the supported versions of the IPFS daemon (perhaps as a config). However, this would mean a lot of backporting work since there have been so many changes since then.

hemangjoshi37a commented 1 year ago

@kasteph, thank you for your quick response and insight into this issue. I appreciate the plan to update the supported daemon versions in the official py-ipfs-http-client repository. As you rightly pointed out, the current version check mechanism can cause unnecessary disruptions for users, particularly when new IPFS daemon versions are rolled out.

The Java HTTP client's approach to only checking for the minimum supported version indeed seems like a more flexible solution, and adopting a similar method for this Python client could help alleviate this issue. However, I also understand the challenges of backporting with the number of changes that have occurred.

Perhaps it would be worth considering a transition phase where both the old and new version check methods are available, with clear communication to users about the upcoming change. This way, users can adjust to the new system gradually, reducing potential disruption.

I'm looking forward to seeing how this issue evolves, and I appreciate the hard work and dedication the team puts into maintaining this crucial tool. Thank you once again for your attention to this issue.

Best, @hemangjoshi37a