question-mark
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.

ValueError: a must be scalar or 1 dimensional, use .ravel to flatten

See original GitHub issue

I have encountered ERROE: “ValueError: a must be scalar or 1 dimensional, use .ravel to flatten” cellphonedb 3.0 Here the error ‘’’ [ ][APP][14/02/22-18:50:05][WARNING] Latest local available version is v2.0.0, using it [ ][APP][14/02/22-18:50:05][WARNING] User selected downloaded database v2.0.0 is available, using it [ ][CORE][14/02/22-18:50:05][INFO] Initializing SqlAlchemy CellPhoneDB Core [ ][CORE][14/02/22-18:50:05][INFO] Using custom database at /public1/home/scfa1516/.cpdb/releases/v2.0.0/cellphone.db [ ][APP][14/02/22-18:50:05][INFO] Launching Method cpdb_statistical_analysis_local_method_launcher [ ][APP][14/02/22-18:50:05][INFO] Launching Method _set_paths [ ][APP][14/02/22-18:50:05][INFO] Launching Method _load_meta_counts [ ][APP][14/02/22-18:58:03][INFO] Launching Method _check_counts_data [ ][CORE][14/02/22-18:58:03][INFO] Launching Method cpdb_statistical_analysis_launcher [ ][CORE][14/02/22-18:58:03][INFO] Launching Method _counts_validations [ ][CORE][14/02/22-18:58:04][INFO] Launching Method get_interactions_genes_complex [ ][CORE][14/02/22-18:58:05][INFO] [Cluster Statistical Analysis] Threshold:0.1 Iterations:1000 Debug-seed:-1 Threads:40 Precision:3 [ ][APP][14/02/22-18:58:07][ERROR] Unexpected error Traceback (most recent call last): File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/api_endpoints/terminal_api/method_terminal_api_endpoints/method_terminal_commands.py”, line 131, in statistical_analysis LocalMethodLauncher(cpdb_app.create_app(verbose, database)).
File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py”, line 62, in cpdb_statistical_analysis_local_method_launcher self.cellphonedb_app.method.cpdb_statistical_analysis_launcher( File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/core/methods/method_launcher.py”, line 95, in cpdb_statistical_analysis_launcher cpdb_statistical_analysis_method.call(meta, File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_method.py”, line 27, in call cpdb_statistical_analysis_complex_method.call(meta.copy(), File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_complex_method.py”, line 61, in call clusters = cpdb_statistical_analysis_helper.build_clusters(meta, counts_filtered, complex_composition_filtered, skip_percent=False) File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py”, line 141, in build_clusters npg.aggregate(meta[CELL_TYPE].cat.codes, counts.values, func=‘mean’, axis=1), File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/numpy_groupies/aggregate_numpy.py”, line 249, in aggregate return _aggregate_base(group_idx, a, size=size, fill_value=fill_value, File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/numpy_groupies/aggregate_numpy.py”, line 219, in _aggregate_base group_idx, a, flat_size, ndim_idx, size = input_validation(group_idx, a, File “/public1/home/scfa1516/miniconda3/envs/cpdb/lib/python3.8/site-packages/numpy_groupies/utils.py”, line 341, in input_validation raise ValueError(“a must be scalar or 1 dimensional, use .ravel to” ValueError: a must be scalar or 1 dimensional, use .ravel to flatten ‘’’ Here the input files image image

package list Package Version


aniso8601 9.0.1 anndata 0.7.8 annoy 1.17.0 attrs 21.4.0 backports.zoneinfo 0.2.1 bbknn 1.5.1 boto3 1.20.47 botocore 1.23.47 CellPhoneDB 3.0.0 certifi 2021.10.8 cffi 1.15.0 charset-normalizer 2.0.11 click 7.1.1 conda-pack 0.6.0 cycler 0.11.0 Cython 0.29.27 fbpca 1.0 Flask 1.1.4 Flask-RESTful 0.3.9 Flask-Testing 0.8.1 fonttools 4.28.2 geosketch 0.3 h5py 2.10.0 idna 3.3 igraph 0.9.9 iniconfig 1.1.1 itsdangerous 1.1.0 Jinja2 2.11.2 jmespath 0.10.0 joblib 1.1.0 kiwisolver 1.3.2 leidenalg 0.8.8 llvmlite 0.37.0 MarkupSafe 2.0.1 matplotlib 3.5.0 natsort 8.0.0 networkx 2.6.3 nose 1.3.7 numba 0.54.1 numexpr 2.7.3 numpy 1.18.0 numpy-groupies 0.9.1 packaging 21.3 pandas 1.1.4 patsy 0.5.2 pika 1.2.0 Pillow 8.4.0 pip 21.2.4 pluggy 1.0.0 py 1.11.0 pycparser 2.21 pynndescent 0.5.5 pyparsing 3.0.6 pytest 6.2.5 pytest-runner 5.3.1 python-dateutil 2.8.2 python-igraph 0.9.9 pytz 2021.3 pytz-deprecation-shim 0.1.0.post0 PyYAML 5.4.1 request2 0.2 requests 2.27.1 rpy2 3.4.1 s3transfer 0.5.1 scanpy 1.8.2 scikit-learn 0.22 scipy 1.7.2 seaborn 0.11.2 setuptools 58.0.4 setuptools-scm 6.3.2 sinfo 0.3.4 six 1.16.0 SQLAlchemy 1.3.9 statsmodels 0.13.1 stdlib-list 0.8.0 tables 3.6.1 texttable 1.6.4 threadpoolctl 3.0.0 toml 0.10.2 tomli 1.2.2 tqdm 4.62.3 tzdata 2021.5 tzlocal 4.1 umap-learn 0.5.2 urllib3 1.26.8 Werkzeug 1.0.1 wheel 0.37.0 xlrd 1.2.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
defendant602commented, Mar 7, 2022

I reinstalled cellphoneDB v3.0 using conda environment and it solved my problem. Thanks !

0reactions
FanZhang9commented, Mar 30, 2022

indeed, problem in my installation, it’s solved,Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flattening a list of NumPy arrays? - Stack Overflow
I came across this same issue and found a solution that combines 1-D numpy arrays of variable length: np.column_stack(input_list).ravel().
Read more >
Flatten a NumPy array with ravel() and flatten() - nkmk note
You can flatten a NumPy array ndarray with the numpy.label() function, or the ravel() and flatten() methods of numpy.ndarray .
Read more >
scipy/_compressed.py at main - GitHub
raise ValueError('data, indices, and indptr should be 1-D'). # check index pointer ... warn("Comparing a sparse matrix with a nonzero scalar using !="....
Read more >
Numpy Ravel, Explained - Sharp Sight
The Numpy Ravel function returns a 1-dimensional, flattened array that has the same elements as the input (ordered according to the order ...
Read more >
the absolute basics for beginners — NumPy v1.25.dev0 Manual
To install NumPy, we strongly recommend using a scientific Python distribution. ... This section covers 1D array , 2D array , ndarray ,...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found