bioforensics / pytaxonkit

Python bindings for the TaxonKit library
Other
30 stars 2 forks source link

Installation without conda #34

Open jenniferlu717 opened 6 months ago

jenniferlu717 commented 6 months ago

Hello, I am trying to see if I can install this software without using conda as I'm trying to develop a toolset that has the option of installing with/without conda.

I can install taxonkit using pip but it doesnt seem that pip install works with this

standage commented 6 months ago

Hi @jenniferlu717! :wave:

pytaxonkit should be fairly straightforward to install without Conda. It's all contained in a single module (file) that can either be placed in the environment (lib/python3.x/site-packages/) or bundled with your software.

I can install taxonkit using pip

Really? taxonkit is implemented in Go, not Python, so I'd be surprised if it can be installed with pip.

Let me know if I can answer any specific questions with installation or integration.

jenniferlu717 commented 5 months ago

Thanks for the quick response I am trying to include pytaxonkit in my software but it seems to have an issue here:

import pytaxonkit
  File "/home/ec2-user/MYPACKAGE/src/pytaxonkit.py", line 55, in <module>
    from _version import get_versions
ImportError: cannot import name 'get_versions' from '_version' (/usr/lib/python3.9/site-packages/_version.py)
standage commented 5 months ago

Accept my apologies, it looks like my comments above weren't accurate.

Out of the box, pytaxonkit uses versioneer for managing software version numbers with git. So using pytaxonkit will require either making a small change to pytaxonkit.py or including the _version.py script alongside pytaxonkit.py.

Option 1

You should be able to make a simple edit to pytaxonkit.py to hard-code the version number and eliminate the dependency on versioneer.

@@ -52,10 +52,7 @@
 from tempfile import NamedTemporaryFile
 from warnings import warn

-from _version import get_versions
-
-__version__ = get_versions()["version"]
-del get_versions
+__version__ = 0.9

 class TaxonKitCLIError(RuntimeError):

Option 2

You can download the latest version tarball from github and run pip install pytaxonkit-0.9.tar.gz. Alternatively, you should be able to streamline that into a single step with

pip install git+https://github.com/bioforensics/pytaxonkit.git@0.9

This latter option installs pytaxonkit.py and _version.py to your Python environment. Because PyTaxonKit is a single module and not a fully-fledged package, I should probably rename _version.py to something like pytaxonkit_version.py. But that shouldn't be a concern for you.