skinniderlab / CLM

MIT License
0 stars 0 forks source link

Incorrect version of CLM reported on pip install #242

Closed vineetbansal closed 2 weeks ago

vineetbansal commented 1 month ago

This issue is to investigate why @skinnider is seeing the CLM version reported as vsrc even after having pip installed the package.

To start with - are you seeing vsrc as the reported version when you do a clm --version on the same environment/terminal as the one you'd use to run snakemake?

skinnider commented 2 weeks ago

Yes:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Genomics/skinniderlab/ms0270/conda/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Genomics/skinniderlab/ms0270/conda/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Genomics/skinniderlab/ms0270/conda/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Genomics/skinniderlab/ms0270/conda/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

conda activate /Genomics/skinniderlab/PED-generation/env-clm

cd ~/git/CLM
$ clm --version
reading NP model ...
model in
src

I get the same output regardless of what directory I run clm --version from.

vineetbansal commented 2 weeks ago

Could it be that pip is not available in the activated conda environment? In my setup:

(clm) vineetb@t15p:~$ echo $CONDA_PREFIX
/home/vineetb/.conda/envs/clm
(clm) vineetb@t15p:~$ which pip
/home/vineetb/.conda/envs/clm/bin/pip
(clm) vineetb@t15p:~$ 

So pip is coming from within the activated conda environment.

If that's not the case in your setup, maybe we can try doing a conda install pip, and then the suggested pip install -e ".[dev]". The latter command can be run in any case, even if it has been run before, so we're starting at an expected place.

A pip install will automatically create a _version.py in the src/clm folder (a file that is git ignored), which in my case looks like:

09:38 $ cat src/clm/_version.py 
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
    from typing import Tuple, Union
    VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
    VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.0.2.dev236+g2e13c85'
__version_tuple__ = version_tuple = (0, 0, 2, 'dev236', 'g2e13c85')
skinnider commented 2 weeks ago

pip is coming from conda:

(/Genomics/skinniderlab/PED-generation/env-clm) [ms0270@argo-beta ~]$ which pip
/Genomics/skinniderlab/PED-generation/env-clm/bin/pip

However, there is no file at src/clm/_version.py.

I reran pip install -e ".[dev]":

Successfully built skinniderlab-clm
Installing collected packages: skinniderlab-clm
  Attempting uninstall: skinniderlab-clm
    Found existing installation: skinniderlab-clm 0.0.2.dev201+gc557697
    Uninstalling skinniderlab-clm-0.0.2.dev201+gc557697:
      Successfully uninstalled skinniderlab-clm-0.0.2.dev201+gc557697
Successfully installed skinniderlab-clm-0.0.2.dev236+g60464be

... and I'm now getting the version number:

(/Genomics/skinniderlab/PED-generation/env-clm) [ms0270@argo-beta CLM]$ clm --version
reading NP model ...
model in
0.0.2.dev236+g60464be

and the _version.py file exists. I wonder if I ran pip install prior to conda install pip somehow the first time around? In any case, this seems to be solved now, so I'll close the issue.