pnnl / deimos

BSD 3-Clause "New" or "Revised" License
31 stars 6 forks source link

ImportError: cannot import name 'snakemake' from 'snakemake' #16

Closed jessieolough closed 7 months ago

jessieolough commented 8 months ago

Hello,

I have recently installed DEIMoS on my Windows 10 PC. However, when I use the deimos -h command I get the following error message:

Traceback (most recent call last):
  File "\\?\C:\Users\jessieolough\AppData\Local\anaconda3\envs\deimos\Scripts\deimos-script.py", line 33, in <module>
    sys.exit(load_entry_point('deimos', 'console_scripts', 'deimos')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\\?\C:\Users\jessieolough\AppData\Local\anaconda3\envs\deimos\Scripts\deimos-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jessieolough\AppData\Local\anaconda3\envs\deimos\Lib\importlib\metadata\__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jessieolough\AppData\Local\anaconda3\envs\deimos\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "c:\users\jessieolough\deimos\deimos\cli.py", line 5, in <module>
    from snakemake import snakemake
ImportError: cannot import name 'snakemake' from 'snakemake' (C:\Users\jessieolough\AppData\Local\anaconda3\envs\deimos\Lib\site-packages\snakemake\__init__.py)

From the pip freeze output from the deimos conda environment (below), it looks as though snakemake is already present. The environment is using Python 3.12.2.

aiohttp @ file:///D:/bld/aiohttp_1707669940890/work
aiosignal @ file:///home/conda/feedstock_root/build_artifacts/aiosignal_1667935791922/work
amply @ file:///home/conda/feedstock_root/build_artifacts/amply_1687675480808/work
appdirs @ file:///home/conda/feedstock_root/build_artifacts/appdirs_1603108395799/work
argparse-dataclass @ file:///home/conda/feedstock_root/build_artifacts/argparse-dataclass_1691002636450/work
attmap @ file:///home/conda/feedstock_root/build_artifacts/attmap_1636190286002/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1704011227531/work
bokeh @ file:///home/conda/feedstock_root/build_artifacts/bokeh_1706215790147/work
boto==2.49.0
boto3 @ file:///home/conda/feedstock_root/build_artifacts/boto3_1708674636624/work
botocore @ file:///home/conda/feedstock_root/build_artifacts/botocore_1708644581391/work
Brotli @ file:///D:/bld/brotli-split_1695989908365/work
bz2file==0.98
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
cachetools @ file:///home/conda/feedstock_root/build_artifacts/cachetools_1698197297464/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1707022139797/work/certifi
cffi @ file:///D:/bld/cffi_1696001932509/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1698833585322/work
click @ file:///D:/bld/click_1692312014553/work
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1697464713350/work
colorama @ file:///home/conda/feedstock_root/build_artifacts/colorama_1666700638685/work
conda-inject @ file:///home/conda/feedstock_root/build_artifacts/conda-inject_1703111191911/work
ConfigArgParse @ file:///home/conda/feedstock_root/build_artifacts/configargparse_1690138037986/work
connection-pool @ file:///home/conda/feedstock_root/build_artifacts/connection_pool_1608581887050/work
contourpy @ file:///D:/bld/contourpy_1699041545746/work
cryptography @ file:///D:/bld/cryptography-split_1708507193260/work
cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1696677705766/work
Cython==3.0.8
cytoolz @ file:///D:/bld/cytoolz_1706897211529/work
dask @ file:///home/conda/feedstock_root/build_artifacts/dask-core_1707520842560/work
datrie @ file:///D:/bld/datrie_1696000691449/work
-e git+https://github.com/pnnl/deimos.git@fdaffeeac03afa0bf697c70627ed8a9a1c4f7b48#egg=deimos
Deprecated==1.2.14
distributed @ file:///home/conda/feedstock_root/build_artifacts/distributed_1707526253618/work
docutils @ file:///D:/bld/docutils_1701882770548/work
dpath @ file:///home/conda/feedstock_root/build_artifacts/dpath_1684714143796/work
eido @ file:///home/conda/feedstock_root/build_artifacts/eido_1700190800789/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1704921103267/work
fastjsonschema @ file:///home/conda/feedstock_root/build_artifacts/python-fastjsonschema_1703780968325/work/dist
fonttools @ file:///D:/bld/fonttools_1708049256130/work
frozenlist @ file:///D:/bld/frozenlist_1702645631040/work
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1707102468451/work
gitdb @ file:///home/conda/feedstock_root/build_artifacts/gitdb_1697791558612/work
GitPython @ file:///home/conda/feedstock_root/build_artifacts/gitpython_1708069240306/work
google-api-core @ file:///home/conda/feedstock_root/build_artifacts/google-api-core-split_1707998218025/work
google-auth @ file:///home/conda/feedstock_root/build_artifacts/google-auth_1708547955313/work
google-cloud-core @ file:///home/conda/feedstock_root/build_artifacts/google-cloud-core_1702002980770/work
google-cloud-storage @ file:///home/conda/feedstock_root/build_artifacts/google-cloud-storage_1702437105048/work
google-crc32c @ file:///D:/bld/google-crc32c_1695545498840/work
google-resumable-media @ file:///home/conda/feedstock_root/build_artifacts/google-resumable-media_1702437055406/work
googleapis-common-protos @ file:///home/conda/feedstock_root/build_artifacts/googleapis-common-protos-feedstock_1702001866871/work
grpcio @ file:///D:/bld/grpc-split_1707805231921/work
h5py @ file:///D:/bld/h5py_1702472580893/work
hdf5plugin @ file:///D:/bld/hdf5plugin_1707465737593/work
hopcroftkarp==1.2.5
humanfriendly @ file:///D:/bld/humanfriendly_1696713187752/work
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1701026962277/work
immutables @ file:///D:/bld/immutables_1695646959270/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1703269254275/work
importlib-resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1699364556997/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1673103042956/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1704966972576/work
jmespath @ file:///home/conda/feedstock_root/build_artifacts/jmespath_1655568249366/work
joblib @ file:///home/conda/feedstock_root/build_artifacts/joblib_1691577114857/work
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema-meta_1705707496704/work
jsonschema-specifications @ file:///tmp/tmpkv1z7p57/src
jupyter_core @ file:///D:/bld/jupyter_core_1704727200100/work
kiwisolver @ file:///D:/bld/kiwisolver_1695380118873/work
locket @ file:///home/conda/feedstock_root/build_artifacts/locket_1650660393415/work
logmuse @ file:///home/conda/feedstock_root/build_artifacts/logmuse_1594742469765/work
lz4 @ file:///D:/bld/lz4_1704831298935/work
markdown-it-py @ file:///home/conda/feedstock_root/build_artifacts/markdown-it-py_1686175045316/work
MarkupSafe @ file:///D:/bld/markupsafe_1706900055959/work
matplotlib @ file:///D:/bld/matplotlib-suite_1708026591981/work
mdurl @ file:///home/conda/feedstock_root/build_artifacts/mdurl_1704317613764/work
msgpack @ file:///D:/bld/msgpack-python_1700926696064/work
multidict @ file:///D:/bld/multidict_1707040885223/work
munkres==1.1.4
nbformat @ file:///home/conda/feedstock_root/build_artifacts/nbformat_1690814868471/work
numexpr @ file:///D:/bld/numexpr_1707139873800/work
numpy @ file:///D:/bld/numpy_1707225519803/work/dist/numpy-1.26.4-cp312-cp312-win_amd64.whl#sha256=ffaa9485afb654c70a658c3ad4b7d2e60c60d8450d3779408d3a496564dc1d43
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1696202382185/work
pandas @ file:///D:/bld/pandas_1705728585485/work
partd @ file:///home/conda/feedstock_root/build_artifacts/partd_1695667515973/work
patsy @ file:///home/conda/feedstock_root/build_artifacts/patsy_1704469236901/work
peppy @ file:///home/conda/feedstock_root/build_artifacts/peppy_1705623952084/work
persim==0.3.3
pillow @ file:///D:/bld/pillow_1704252246701/work
pkgutil_resolve_name @ file:///home/conda/feedstock_root/build_artifacts/pkgutil-resolve-name_1694617248815/work
plac @ file:///home/conda/feedstock_root/build_artifacts/plac_1708635080780/work
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/platformdirs_1706713388748/work
plotly @ file:///home/conda/feedstock_root/build_artifacts/plotly_1708020413888/work
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1706116770704/work
ply==3.11
protobuf==4.25.2
psutil @ file:///D:/bld/psutil_1705722515136/work
PuLP @ file:///D:/bld/pulp_1705064832645/work
py-cpuinfo @ file:///home/conda/feedstock_root/build_artifacts/py-cpuinfo_1666774466606/work
pyarrow==15.0.0
pyarrow-hotfix @ file:///home/conda/feedstock_root/build_artifacts/pyarrow-hotfix_1700596371886/work
pyasn1 @ file:///home/conda/feedstock_root/build_artifacts/pyasn1_1701287008248/work
pyasn1-modules @ file:///home/conda/feedstock_root/build_artifacts/pyasn1-modules_1695107857548/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1700607939962/work
pymzml @ file:///opt/conda/conda-bld/pymzml_1707729967941/work
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1706660063483/work
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1690737849915/work
PyQt5==5.15.9
PyQt5-sip @ file:///D:/bld/pyqt-split_1695418044683/work/pyqt_sip
pyreadline3 @ file:///D:/bld/pyreadline3_1696532025125/work
PySocks @ file:///D:/bld/pysocks_1661604991356/work
pytest @ file:///home/conda/feedstock_root/build_artifacts/pytest_1708432879235/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1706886791323/work
pyu2f @ file:///home/conda/feedstock_root/build_artifacts/pyu2f_1604248910016/work
pywin32==306
PyYAML @ file:///D:/bld/pyyaml_1695373772678/work
referencing @ file:///home/conda/feedstock_root/build_artifacts/referencing_1706711412823/work
regex @ file:///D:/bld/regex_1703393604368/work
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1684774241324/work
reretry @ file:///home/conda/feedstock_root/build_artifacts/reretry_1671379180978/work
rich @ file:///home/conda/feedstock_root/build_artifacts/rich-split_1700160075651/work/dist
ripser==0.6.4
rpds-py @ file:///D:/bld/rpds-py_1707922869224/work
rsa @ file:///home/conda/feedstock_root/build_artifacts/rsa_1658328885051/work
s3transfer @ file:///home/conda/feedstock_root/build_artifacts/s3transfer_1703197439685/work
scikit-learn @ file:///D:/bld/scikit-learn_1708073997094/work
scipy @ file:///C:/bld/scipy-split_1706041678996/work/dist/scipy-1.12.0-cp312-cp312-win_amd64.whl#sha256=e136b72ace592fb8707ad6296618b9189589349bffbc91b5b6917a8b86f014e7
setuptools==69.1.0
sip @ file:///D:/bld/sip_1697300573642/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
slack_sdk @ file:///home/conda/feedstock_root/build_artifacts/slack-sdk_1707808282102/work
smart-open @ file:///home/conda/feedstock_root/build_artifacts/smart_open_1602159551590/work
smmap @ file:///home/conda/feedstock_root/build_artifacts/smmap_1634310307496/work
snakemake @ file:///opt/conda/conda-bld/snakemake_1708446214537/work
snakemake-interface-common @ file:///opt/conda/conda-bld/snakemake-interface-common_1708514902559/work
snakemake-interface-executor-plugins @ file:///opt/conda/conda-bld/snakemake-interface-executor-plugins_1705404200654/work
snakemake-interface-storage-plugins @ file:///opt/conda/conda-bld/snakemake-interface-storage-plugins_1708341698179/work
sortedcontainers @ file:///home/conda/feedstock_root/build_artifacts/sortedcontainers_1621217038088/work
statsmodels @ file:///D:/bld/statsmodels_1702575522737/work
stopit==1.1.2
tables==3.9.2
tabulate @ file:///home/conda/feedstock_root/build_artifacts/tabulate_1665138452165/work
tblib @ file:///home/conda/feedstock_root/build_artifacts/tblib_1702066284995/work
tenacity @ file:///home/conda/feedstock_root/build_artifacts/tenacity_1692026804430/work
threadpoolctl @ file:///home/conda/feedstock_root/build_artifacts/threadpoolctl_1707930541534/work
throttler @ file:///home/conda/feedstock_root/build_artifacts/throttler_1691135466785/work
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1604308577558/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1706112571092/work
toposort @ file:///home/conda/feedstock_root/build_artifacts/toposort_1677526287284/work
tornado @ file:///D:/bld/tornado_1708363233297/work
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1704212992681/work
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1702176139754/work
tzdata @ file:///home/conda/feedstock_root/build_artifacts/python-tzdata_1707747584337/work
ubiquerg @ file:///home/conda/feedstock_root/build_artifacts/ubiquerg_1706829562839/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1697720414277/work
veracitools==0.1.3
wheel==0.42.0
win-inet-pton @ file:///D:/bld/win_inet_pton_1667051142467/work
wrapt @ file:///D:/bld/wrapt_1699532972983/work
xyzservices @ file:///home/conda/feedstock_root/build_artifacts/xyzservices_1698325309404/work
yarl @ file:///D:/bld/yarl_1705508472656/work
yte @ file:///home/conda/feedstock_root/build_artifacts/yte_1702295091829/work
zict @ file:///home/conda/feedstock_root/build_artifacts/zict_1681770155528/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1695255097490/work

I am unsure how else to deal with this issue and any help with this issue would be much appreciated.

Many thanks, jessieolough

smcolby commented 7 months ago

Hi Jessie,

After investigating this further, it appears snakemake has made significant changes with version 8.*. I'll keep this issue open as a reminder to update deimos to reflect the version 8 API changes, but for now please install version 7.*.

mamba/conda install -c bioconda snakemake=7

jessieolough commented 7 months ago

Hi smcolby,

Thanks for your response. When I used conda install -c bioconda snakemake=7 I got the following error:

Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

I alternatively tried just using pip install snakemake==7, but I then got this error message instead:

Collecting snakemake==7
  Downloading snakemake-7.0.0.tar.gz (286 kB)
     ---------------------------------------- 286.1/286.1 kB 8.9 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]
      C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-gklk51zb\snakemake_88c530f12ed54f40868ba452555c0d46\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 "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-gklk51zb\snakemake_88c530f12ed54f40868ba452555c0d46\setup.py", line 28, in <module>
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-gklk51zb\snakemake_88c530f12ed54f40868ba452555c0d46\versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-gklk51zb\snakemake_88c530f12ed54f40868ba452555c0d46\versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-gklk51zb\snakemake_88c530f12ed54f40868ba452555c0d46\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 followed advice with a modified pip install snakemake==7 --use-deprecated=legacy-resolver command, which resulted in this error:

Collecting snakemake==7
  Using cached snakemake-7.0.0.tar.gz (286 kB)
  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]
      C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-tq4ola64\snakemake\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 "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-tq4ola64\snakemake\setup.py", line 28, in <module>
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-tq4ola64\snakemake\versioneer.py", line 1480, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-tq4ola64\snakemake\versioneer.py", line 1412, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jessieolough\AppData\Local\Temp\2\pip-install-tq4ola64\snakemake\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.
╰─> snakemake

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

Other sources suggest to do it again in a new environment, though this environment is already quite new and I am unsure whether this will work.

Any further suggestions would be much appreciated.

Many thanks, Jess

smcolby commented 7 months ago

What a headache! I just pushed a branch that specifies snakemake version less than 8. It's running through tests now. If it passes against Windows, I'll merge and you should then be able to install a fresh environment from environment.yml.

smcolby commented 7 months ago

Okay, pull request passed tests on all platforms. Please give a fresh environment install a shot and let me know how it goes!

jessieolough commented 7 months ago

Success! I reinstalled the deimos environment again and I now get the expected output using deimos -h in the command line.

Thanks so much for all your help!

smcolby commented 7 months ago

Excellent!