tlocke / pg8000

A Pure-Python PostgreSQL Driver
BSD 3-Clause "New" or "Revised" License
515 stars 46 forks source link

Conda version reported as 0.0.0 #113

Closed robert-schmidtke closed 2 years ago

robert-schmidtke commented 2 years ago

Disclaimer: I posted this issue on the conda feedstock already, as I thought it would be related to conda, as pip works just fine: https://github.com/conda-forge/pg8000-feedstock/issues/49

Issue

Not sure when this was introduced, but when installing the conda package, the pg8000 version is reported as 0.0.0. pip is fine.

>>> import pg8000
>>> pg8000.__version__
'0.0.0'
>>> from importlib.metadata import version
>>> version("pg8000")
'0.0.0'

I noticed there was something related to the package version fixed earlier this year in pip, so maybe this is related?

Installed packages

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
asn1crypto                1.5.1              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2022.6.15            ha878542_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libzlib                   1.2.12               h166bdaf_2    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
openssl                   3.0.5                h166bdaf_0    conda-forge
pg8000                    1.29.1             pyhd8ed1ab_0    conda-forge
pip                       22.1.2             pyhd8ed1ab_0    conda-forge
python                    3.9.13          h2660328_0_cpython    conda-forge
python_abi                3.9                      2_cp39    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
scramp                    1.4.1              pyhd8ed1ab_0    conda-forge
setuptools                63.2.0           py39hf3d152e_0    conda-forge
sqlite                    3.39.1               h4ff8645_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
tzdata                    2022a                h191b570_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.12               h166bdaf_2    conda-forge

Environment info

active environment : pg8000-test
    active env location : /home/rschmidtke/miniconda3/envs/pg8000-test
            shell level : 1
       user config file : /home/rschmidtke/.condarc
 populated config files : /home/rschmidtke/.condarc
          conda version : 4.13.0
    conda-build version : 3.21.9
         python version : 3.8.13.final.0
       virtual packages : __linux=5.10.102.1=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/rschmidtke/miniconda3  (writable)
      conda av data dir : /home/rschmidtke/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/rschmidtke/miniconda3/pkgs
                          /home/rschmidtke/.conda/pkgs
       envs directories : /home/rschmidtke/miniconda3/envs
                          /home/rschmidtke/.conda/envs
               platform : linux-64
             user-agent : conda/4.13.0 requests/2.28.1 CPython/3.8.13 Linux/5.10.102.1-microsoft-standard-WSL2 ubuntu/20.04.1 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
tlocke commented 2 years ago

Hi @robert-schmidtke, since version 1.28.2. pg8000 queries its own metadata to find pg8000.version, so it does something very like the code you wrote above:

from importlib.metadata import version
version("pg8000")

If you unzip the Wheel file for pg8000 you'll see a /pg8000-1.29.1.dist-info/ directory and within it a METADATA file where the version is contained.

I'm not too sure how conda works, but as I understand it, it has its own package format, which includes a version. I guess one question is: is the version in the conda package correct? If it isn't correct then that would need to be corrected, if it is correct then it seems that it's done in a way that the python metadata library doesn't understand. Either way, hopefully my answer helps a bit :-)

BastianZim commented 2 years ago

This was due to a misconfigured conda-forge build setup and is fixed in https://github.com/conda-forge/pg8000-feedstock/pull/50. The issue here can be closed.

tlocke commented 2 years ago

Looks like this has been fixed now so I'll close the bug, but feel free to reopen if it's still a problem.