Acellera / moleculekit

MoleculeKit: Your favorite molecule manipulation kit
Other
198 stars 37 forks source link

PIP incompatibility: filename has '1.2.0', but metadata has '0' #106

Closed tonigi closed 1 year ago

tonigi commented 2 years ago

The current pip doesn't like the package's metadata:

 pip install moleculekit

results in

 [...] has inconsistent version: filename has '1.2.0', but metadata has '0'

The explanation may be in the new dependency resolver. In fact, this workaround seems to work:

 pip install --use-deprecated=legacy-resolver moleculekit
duerrsimon commented 2 years ago

To fix this the following section should be added in setup.cfg

 [metadata]
 name = moleculekit
 version = 1.1.1
stefdoerr commented 2 years ago

As @duerrsimon's answer implied, I think the issue is that we use the old setup.py way of using setuptools. They moved now to toml and cfg files instead. The issues is that we determine the package version dynamically in the setup.py

try:
    version = (
        subprocess.check_output(["git", "describe", "--abbrev=0", "--tags"])
        .strip()
        .decode("utf-8")
    )
except Exception as e:
    print("Could not get version tag. Defaulting to version 0")
    version = "0"

which is great for not bothering to update the version at every release but when you install it via pypi it will try to run setup.py, there are no tags defined (since it's not a git repo), default to version=0 and throw the error. I'll need to eventually take a look at the new setuptools methodology but pip installation of moleculekit is not officially supported anyway so I'm not in a big hurry.

tonigi commented 2 years ago

Perhaps the version change can be done with bump2version and a post commit hook?

stefdoerr commented 2 years ago

I don't like hooks because they need to be set up on every machine I develop on. But I don't believe it's necessary either with bump2version. The other issue why I have not bothered with it because I don't want to keep duplicate dependency lists. I currently use a single file which contains the deps to build both pypi and conda packages. I will probably have to do some refactoring there. But it's probably for the good since the current pipeline is a bit messy

stefdoerr commented 1 year ago

Finally got around to fixing pip installation of moleculekit and updating the whole building pipeline. Versions >=1.4.6 should be fixed. Thanks for reporting this.