dr-joe-wirth / primerForge

software to identify primers that can distinguish genomes
Apache License 2.0
20 stars 4 forks source link

python 3.12 pip install error #26

Closed mbhall88 closed 2 months ago

mbhall88 commented 3 months ago

In relation to https://github.com/openjournals/joss-reviews/issues/6850

When I try and pip install the latest (v1.2.5) version with python 3.12 I get the following error

python -m pip install primerforge
Collecting primerforge
  Downloading primerforge-1.2.5-py3-none-any.whl.metadata (6.6 kB)
Collecting biopython==1.81 (from primerforge)
  Downloading biopython-1.81-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (13 kB)
Collecting khmer>=2.1 (from primerforge)
  Downloading khmer-2.1.1.tar.gz (8.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.5/8.5 MB 3.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      /tmp/pip-install-00inzozi/khmer_9aa20b283bf746d0849a8cfb44703c4d/versioneer.py:421: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-00inzozi/khmer_9aa20b283bf746d0849a8cfb44703c4d/setup.py", line 168, in <module>
          "define_macros": [("VERSION", versioneer.get_version()), ],
                                        ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-00inzozi/khmer_9aa20b283bf746d0849a8cfb44703c4d/versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-install-00inzozi/khmer_9aa20b283bf746d0849a8cfb44703c4d/versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-00inzozi/khmer_9aa20b283bf746d0849a8cfb44703c4d/versioneer.py", line 342, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I have no such problems with python 3.11

dr-joe-wirth commented 3 months ago

thanks for bringing this to my attention. i think this is because python3.12 removed SafeConfigParser and replaced it with ConfigParser. khmer is a fantastic tool, but i am finding that it is not a good neighbor when it comes to installation. i am going to see if i can replace khmer with something friendlier.

dr-joe-wirth commented 2 months ago

using python 3.12 and above is not supported by khmer. this will not change unless khmer releases a new version.

mbhall88 commented 2 months ago

Okay. Might be worth mentioning this in the installation instructions then.

mbhall88 commented 2 months ago

Also, given the base environment for the most recent release of miniconda is now python 3.12, it is important to note in the install instructions that 3.12 is not support.

dr-joe-wirth commented 2 months ago

Yeah it is such a shame that khmer is no longer supported and the conda installation is incompatible outside of Python 3.6 and 3.7. Currently conda install won't work until I can some how fix khmer's installer. The Countgraph functionality is golden and nothing else (that I'm aware of) provides a way to count the number of times a kmer appears without iterating across the sequence. I'd use a different tool if it could keep the runtime and memory footprint as low as khmer does.

I have set up the pip installer so it will fail if an incompatible Python version is being used and to report that in the error message. The environment file for manual install will use an appropriate version of Python. I will double check the readme tomorrow to make sure it explicitly states which versions of Python are compatible.

mbhall88 commented 2 months ago

Ah what a shame! I assume you can't use Sourmash (which seems to be where khmer evolved to) as you don't want minhash kmers?

dr-joe-wirth commented 2 months ago

yeah we tried using sourmash. the problem that we encountered was that counting the number of times a given kmer appeared in a sequence required that we iterated across the sequence, which makes the time complexity go up by a lot.