adriantich / DnoisE

Distance denoise by Entropy
GNU General Public License v3.0
13 stars 3 forks source link

ModuleNotFoundError during install with Conda #25

Closed kbseah closed 1 year ago

kbseah commented 1 year ago

Hello, I encountered the following error when running the command DnoisE after installing with Mamba:

Traceback (most recent call last):
  File "/mnt/data/test-dnoise/dnoise2_env/bin/DnoisE", line 10, in <module>
    from importlib.metadata import distribution
ModuleNotFoundError: No module named 'importlib.metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/data/test-dnoise/dnoise2_env/bin/DnoisE", line 13, in <module>
    from importlib_metadata import distribution
ModuleNotFoundError: No module named 'importlib_metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/data/test-dnoise/dnoise2_env/bin/DnoisE", line 15, in <module>
    from pkg_resources import load_entry_point
  File "/mnt/data/test-dnoise/dnoise2_env/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3266, in <module>
    @_call_aside
  File "/mnt/data/test-dnoise/dnoise2_env/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3241, in _call_aside
    f(*args, **kwargs)
  File "/mnt/data/test-dnoise/dnoise2_env/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3279, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/mnt/data/test-dnoise/dnoise2_env/lib/python3.7/site-packages/pkg_resources/__init__.py", line 573, in _build_master
    ws.require(__requires__)
  File "/mnt/data/test-dnoise/dnoise2_env/lib/python3.7/site-packages/pkg_resources/__init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/mnt/data/test-dnoise/dnoise2_env/lib/python3.7/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'write_output' distribution was not found and is required by DnoisE

I used Mamba (1.4.2, Conda 23.3.1) to install from an environment definition file dnoise.yml with the following contents:

name: dnoise
channels:
  - adriantich
  - conda-forge
  - bioconda
  - nodefaults
dependencies:
  - dnoise =1.2

import.metadata is only available from python >=3.8, but the Conda recipe for dnoise v1.2 is limited to python <=3.7.

I tried adding the importlib-metadata backport from pip to the environment definition, but I then get a different error:

Traceback (most recent call last):
  File "/mnt/data/test-dnoise/dnoise_env/bin/DnoisE", line 33, in <module>
    sys.exit(load_entry_point('DnoisE==1.2', 'console_scripts', 'DnoisE')())
TypeError: 'module' object is not callable

Running the script under the site-packages folder works, however, similar to what is described in #24

adriantich commented 1 year ago

Thank you so much for your comment. Right now I'm quite busy but I would like to update conda installation because It was done quite time ago. I'll try to do it next week. However if you follow the installation using the installation bash script within the conda environment it should work. Also take into account that the compilation is having some problems that I have not yet solved but the python scripts are working quite fast too. If you have any problem with that just tell me and I will try to work on it too.

I have already started a new post-doc position and I don't have all the time that I would like to update all these bugs.

Adri

kbseah commented 1 year ago

Hi Adri, thanks for your reply. I understand how it is with keeping software up to date, so no worries there.

I could get it to work by just calling the python script directly, but i'd like to get the Conda installation working if possible so that it can be incorporated into a pipeline.

Would you mind if I try to package DnoisE for Bioconda?

adriantich commented 1 year ago

I don't really now exactly how to do it for bioconda but if you want you can do it for sure.

adriantich commented 1 year ago

If you could explain me how you do it it would be nice to know it!

adriantich commented 1 year ago

Okay, I'm building the conda packages and I had to deled the specification for nuitka and pyathon-levenshtein packages because it rised an error. Also now DnoisE will be only available for python >=3.8 and not for 3.7 with conda install. I'll build the package for 3.8, 3.9 and 3.10.

kbseah commented 1 year ago

hi Adri, thanks for the update. I was able to build with conda mambabuild, which is a replacement for conda build from the boa package (https://boa-build.readthedocs.io/en/latest/index.html), but looking further into it there seem to be some issues with getting Nuitka working with Conda, so packaging only the Python version may be a good idea. It seems to be fast enough, as you say.

I'm putting together a recipe for Bioconda and am running some tests locally to make sure it works before making a pull request there. I'll tag you in the PR when I do so. In principle not much different from any other Conda recipe except for some additional requirements about the specifications, and the package is built and tested on their servers automatically when a recipe is added.

kbseah commented 1 year ago

hi Adria, the package should now be available on Bioconda: https://github.com/bioconda/bioconda-recipes/pull/43211