Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update in tabulate leads to error when running pangolin #489

Closed
abel-betraoui opened this issue Oct 10, 2022 · 10 comments
Closed

update in tabulate leads to error when running pangolin #489

abel-betraoui opened this issue Oct 10, 2022 · 10 comments

Comments

@abel-betraoui
Copy link

Hi all,

Snakemake is encountering this issue snakemake/snakemake#1899 which leads to this error when running pangolin:

Traceback (most recent call last):
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/snakemake/__init__.py", line 699, in snakemake
    success = workflow.execute(
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/snakemake/workflow.py", line 1043, in execute
    logger.run_info("\n".join(dag.stats()))
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/snakemake/dag.py", line 2176, in stats
    yield tabulate(rows, headers="keys")
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/tabulate/__init__.py", line 2048, in tabulate
    list_of_lists, headers = _normalize_tabular_data(
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/tabulate/__init__.py", line 1471, in _normalize_tabular_data
    rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows))
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/tabulate/__init__.py", line 1471, in <lambda>
    rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows))
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/tabulate/__init__.py", line 107, in _is_separating_line
    (len(row) >= 1 and row[0] == SEPARATING_LINE)
  File "/opt/conda/envs/pangolin/lib/python3.10/site-packages/snakemake/rules.py", line 1127, in __eq__
    return self.name == other.name and self.output == other.output
AttributeError: 'str' object has no attribute 'name'

Snakemake released version 7.15.2 which fixes the issue, however due to #313, snakemake version was set to <=6.8.0.

Note that falling back to tabular==0.8.10 fixes the problem but it might be better to catch up to snakemake's latest version.
Thanks

@aineniamh
Copy link
Member

We pinned to snakemake<=6.8.0 because of the path handling issue. I wonder if that has been resolved in recent snakemake versions (this snakemake issue remains open: snakemake/snakemake#1212).

@xqinbcm
Copy link

xqinbcm commented Oct 10, 2022

We had the same error with our system Snakemake 6.12.3. Rolling back to tabulate==0.8.10 fixed the problem.
pip install tabulate==0.8.10

@aineniamh
Copy link
Member

Should be fixed in latest patch now- will try to keep an eye on when snakemake resolve their issue #1212

@wm75
Copy link
Contributor

wm75 commented Oct 11, 2022

@aineniamh independent of the status of the snakemake issue you seem to have removed the offending os.path.join attempts with workflow.current_basedir from pangolearn.smk as part of ff0a7e9.
So chances are that pinning snakemake is no longer required.

@aineniamh
Copy link
Member

Ah right, was that the part causing snakemake to error out? I'll look at changing to latest so

@xqinbcm
Copy link

xqinbcm commented Oct 11, 2022

This version of pangolin also seems to change user's .bashrc to setup default conda to be conda3/envs/pangolin/bin/conda, which can cause other default conda-installed programs not to be able to found.

@aineniamh
Copy link
Member

I don't belive pangolin modifies the users bashrc, could you provide an example of what you mean?

@xqinbcm
Copy link

xqinbcm commented Oct 12, 2022

After running:
conda activate pangolin
conda update pangolin

Got this appended to the .bashrc to reset default conda, but not sure what caused it:

>>> conda initialize >>>

!! Contents within this block are managed by 'conda init' !!

__conda_setup="$('/stornext/snfs130/covid-seq/xqin/covid19/bin/share/conda3/envs/pangolin/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/stornext/snfs130/covid-seq/xqin/covid19/bin/share/conda3/envs/pangolin/etc/profile.d/conda.sh" ]; then
. "/stornext/snfs130/covid-seq/xqin/covid19/bin/share/conda3/envs/pangolin/etc/profile.d/conda.sh"
else
export PATH="/stornext/snfs130/covid-seq/xqin/covid19/bin/share/conda3/envs/pangolin/bin:$PATH"
fi
fi
unset __conda_setup

@aineniamh
Copy link
Member

Both of those are conda commands, so it looks like conda is modifying its own configuration, perhaps with the update command?

@sbridgett
Copy link

sbridgett commented Oct 20, 2022

Thank you for explain how to fix this. I was getting the same error as in first post above about "AttributeError: 'str' object has no attribute 'name'". Upgrading to latest snakemake-minimal (snakemake-minimal-7.16.0 from the bioconda channel) fixed this problem. It has also removed a previous warning message about "Falling back to greedy scheduler because no default solver is found for pulp (you have to install either coincbc or glpk)", even though coin-or-cbc (2.10.7), coincbc (2.10.7) and glpk (5.0) were already installed in the same conda environment. Thank you.

Regarding that conda initialise, before reading about this issue about snakemake, I had thought that maybe updating to latest conda would fix the error, but after updating to latest conda 22.9.0, I lost the normal bash prompt, so found this issue: conda 22.9.0 breaks bash command prompt, explaining that "conda init bash" fixed this.

christinehc added a commit to PNNL-CompBio/Snekmer that referenced this issue Nov 5, 2022
There is a known issue with newer versions of tabulate that result in `AttributeError: 'str' object has no attribute 'name'` (see cov-lineages/pangolin#489). To resolve this error, environment specs have been modified to specify tabulate==0.8.10.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants