Skip to content

ModuleNotFoundError: No module named 'pkg_resources' when installing conda environment with make install #10

Description

@SamBryce-Smith

The provided conda environment does not ensure setuptools is installed, causing a module not found error. Adding setuptools<82.0.0 to environment.yml resolves the error on my end:

$ make install
...

Transaction finished


To activate this environment, use:

    mamba activate RiboNN

Or to execute a single command in this environment, use:

    mamba run -n RiboNN mycommand
$ make predict_human 
python3 -m src.main --predict human
Traceback (most recent call last):
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/lustre1/project/stg_00130/Projects/sbs_config/github_repos/Sanofi-Public/RiboNN/src/main.py", line 5, in <module>
    from src.train import train_model_nested_cv
  File "/lustre1/project/stg_00130/Projects/sbs_config/github_repos/Sanofi-Public/RiboNN/src/train.py", line 4, in <module>
    import pytorch_lightning as pl
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/pytorch_lightning/__init__.py", line 34, in <module>
    from lightning_lite.utilities.seed import seed_everything  # noqa: E402
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/lightning_lite/__init__.py", line 23, in <module>
    from lightning_lite.lite import LightningLite  # noqa: E402
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/lightning_lite/lite.py", line 23, in <module>
    from lightning_utilities.core.apply_func import apply_to_collection
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/lightning_utilities/__init__.py", line 6, in <module>
    from lightning_utilities.core.apply_func import apply_to_collection
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/lightning_utilities/core/__init__.py", line 4, in <module>
    from lightning_utilities.core.imports import compare_version, module_available
  File "/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/lightning_utilities/core/imports.py", line 14, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
make: *** [Makefile:21: predict_human] Error 1

After removing the installed environment, adding setuptools<82.0.0 to the environment.yml and rerunning make install, the error is resolved and I get a successful test run on my HPC:

$ make install
...
Transaction finished


To activate this environment, use:

    mamba activate RiboNN

Or to execute a single command in this environment, use:

    mamba run -n RiboNN mycommand
$ mamba activate RiboNN
$ make predict_human 
python3 -m src.main --predict human
/lustre1/project/stg_00130/Projects/sbs_config/miniforge/vsc37853/envs/RiboNN/lib/python3.10/site-packages/lightning_utilities/core/imports.py:14: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources
Making predictions using human models...
Transcripts with combined CDS and 3'UTR sizes more than 11937 in the input data are removed!
Predictions written to results/human/prediction_output.txt.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions