Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem importing cell2location after setting THEANO_FLAGS

See original GitHub issue

Hi, I’m trying to run cell2location from the singularity image (cell2location-v0.05-alpha.sif) but I’m getting the following error:

ImportError: cannot open shared object file: No such file or directory

This is what I’m trying to do:

import os
os.environ["THEANO_FLAGS"] = 'device=cuda0,floatX=float32,force_device=True'
import cell2location

If I change the above to:

import os
os.environ["THEANO_FLAGS"] = 'device=cpu,floatX=float32,openmp=True,force_device=True'
import cell2location

cell2location is successfully imported but I would like to take advantage of GPU acceleration.

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

galanislcommented, Mar 10, 2021

Hi @vitkl

Thanks for the prompt reply. These are the series of steps I’m trying in SLURM:

# Allocate resources for the cell2location pipeline
srun --partition=gpu --x11 --gres=gpu:GTX-1080:2 --mem=60000M --time=10:00:00 --pty bash

# Launch Jupyter from within the Singularity image
singularity exec \
   --no-home  \
   --nv \
   -B /working_dir:/cell2loc \
   /path/to/image/cell2location-v0.05-alpha.sif \
   /bin/bash -c "cd /cell2loc && HOME=$(mktemp -d) jupyter notebook \
      --notebook-dir=/cell2loc --NotebookApp.token='cell2loc' \
      --ip= --port=1237 --no-browser --allow-root"

Also, for your interest, I get the same error I mentioned above even if I try to call cell2location.run_cell2location in CPU mode, i.e. if I use the following THEANO_FLAGS:

os.environ["THEANO_FLAGS"] = 'device=cpu,floatX=float32,openmp=True,force_device=True'
vitklcommented, Mar 11, 2021

Thanks for clarifying the details. I can try to test the container in the Slurm environment next week but I did not use Slurm for a while and not sure if I still have access. Is contacting your local IT an option? This error might be specific to Slurm in some way because we do not see it when using Singularity on LSF cluster and when using Docker image locally and on the cloud.

Martin @prete helped us build the image - I am wondering if this error rings a bell to you?

@Chuang1118 when analysing sample-by sample 40GB of RAM should suffice - in case this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common errors — cell2location documentation - Read the Docs
If you see these error when importing cell2location it means that you have incorrectly installed theano and it's dependencies (fix depends on the...
Read more >
problems in importing theano - python
1 Answer 1 ... This isn't a problem, it's a WARNING as it very clearly says. It just means that you don't have...
Read more >
import theano problem
This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'....
Read more >
Workshop "Spatial transcriptomics data analysis in Python"
Speakers in this part of the workshop: Vitalii Kleshchevnikov (Wellcome Sanger Institute, UK), Johanna Klughammer (LMU, Germany) and Fabian ...
Read more >
Cannot import cell2location #141 - Github Lab
I am running the following code: import os os.environ["THEANO_FLAGS"] = 'device=cuda,floatX=float32,force_device=True import cell2location.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found