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

ZeroDivisionError: float division by zero #220

Open
Simran-Sodhi opened this issue Oct 20, 2022 · 14 comments
Open

ZeroDivisionError: float division by zero #220

Simran-Sodhi opened this issue Oct 20, 2022 · 14 comments

Comments

@Simran-Sodhi
Copy link

Hi,

I have been getting this error: ZeroDivisionError: float division by zero
when trying to run the following code:
de.test.wald( data=adata_human, gene_names=adata_human.var_names, formula_loc="~ 1 + palantir_pseudotime_int", factor_loc_totest="palantir_pseudotime_int", as_numeric=["palantir_pseudotime_int"] )
Here is the complete error log: zero_division_error.pdf
I am getting the same error even when I use a discrete variable instead of a continuous one and when I use sample single-cell data from the Scanpy datasets (scanpy.datasets.ebi_expression_atlas(accession = "E-GEOD-98816"))
`
Current Versions:

  • numpy==1.21.6
  • anndata==0.8.0
  • pandas==1.4.3
  • scanpy==1.9.1
  • diffxpy.api==v0.7.4+21.g12f1286

Could you please look into this? Thanks for your help

@mhgh146
Copy link

mhgh146 commented Oct 31, 2022

I've run into the same error when running de.test.versus_rest. Iterations near end and then generates the same above error.

@guangjunyin
Copy link

The same error, hoping an answer.

@victorsanchezarevalo
Copy link

The same error, any clue?

@guangjunyin
Copy link

The same error, any clue?

Snipaste_2022-11-04_15-35-53

@guangjunyin
Copy link

The same error, any clue?
Here is the detailed information.

@victorsanchezarevalo
Copy link

I had exactly the same.

@theGreen-Coder
Copy link

Same here.

@theGreen-Coder
Copy link

It's weird because the same code works on Collab but not on my computer. Collab: https://colab.research.google.com/drive/1FUZXHNCXtqWlip0jQN1Z9QBJ7JBO5qIR?usp=sharing
When I try to run a wald test:

test = de.test.wald(
    data=data,
    formula_loc="~ 1 + condition",
    factor_loc_totest="condition",
)

# Error Terminates the program here on my Mac

summaryTest = test.summary().iloc[:10,:]

It works on Google Collab, but not on my MacOS. When I run it on Google Collab, it also gives me an error (below), but that doesn't stop the execution of my code. And therefore, test is defined, as well as summaryTest.
However, when I run this exact same code on my Mac machine, this happens (below). An exception is thrown and the whole program stops (leaving test undefined, thus leaving also summaryTest undefined).

Error on Google Collab (last line)

Screenshot 2022-11-11 at 09 27 17

Error on my Mac

Screenshot 2022-11-11 at 09 28 07

The only way this works on my Mac is if I ran this line of code before the wald test:

sc.pp.highly_variable_genes(data, n_top_genes=255, subset = True, flavor = "seurat_v3", batch_key="sample")

@Alixbonard
Copy link

Hi,

I have been facing the same problem. Did someone find a solution ?

@pdrofelipe
Copy link

Hello,

same problem here as well.
It would be nice an answer trying to shed a light here

@Alixbonard
Copy link

Alixbonard commented May 29, 2023

Hello,
I found the solution.
The problem is related to the dask package. I downgraded it to dask==2021.4.0.
Normally with this version the error becomes a warning.
N.B. I use Diffxpy==0.7.4 and batchglm==0.7.4.

@DieTANG
Copy link

DieTANG commented Jun 7, 2023

Hi, I have the same error, any solution so far?

anndata 0.9.1
diffxpy v0.7.4
matplotlib 3.7.1
numpy 1.24.3
pandas 2.0.2
scanpy 1.9.3
scvi 1.0.0
seaborn 0.12.2
session_info 1.0.0
IPython 8.14.0
jupyter_client 8.2.0
jupyter_core 5.3.0
notebook 6.5.4
Python 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:39:03) [GCC 11.3.0]
Linux-6.2.12-arch1-1-x86_64-with-glibc2.37

@Alixbonard
Copy link

Hi @DieTANG,

Did you try to downgrade dask ? dask==2021.4.0 worked for me.

@Marwansha
Copy link

Marwansha commented Feb 28, 2024

i have the same issue here, near convergence it give this error, anyone managed?
i already have dask==2021.4.0

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

9 participants