moleculekit icon indicating copy to clipboard operation
moleculekit copied to clipboard

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

Open tonigi opened this issue 2 years ago • 4 comments

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

tonigi avatar Apr 27 '22 21:04 tonigi

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

 [metadata]
 name = moleculekit
 version = 1.1.1

duerrsimon avatar Jun 02 '22 15:06 duerrsimon

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.

stefdoerr avatar Jun 06 '22 07:06 stefdoerr

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

tonigi avatar Jun 06 '22 07:06 tonigi

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 avatar Jun 06 '22 07:06 stefdoerr

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.

stefdoerr avatar Oct 20 '22 06:10 stefdoerr