estebanpw / chromeister

A dotplot generator for large chromosomes
GNU General Public License v3.0
39 stars 4 forks source link

Bad Install due opencv-python #30

Open cfarkas opened 1 year ago

cfarkas commented 1 year ago

Hi There,

I followed the install instructions and I encountered the following error on Ubuntu 22.04.1 LTS:

After this:

cd chromeister && make all -C src/ && python3 -m venv chromeisterenv && source chromeisterenv/bin/activate && pip install -r src/requirements.txt

I have the following error:

  /tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:242:9: error: 'PyTuple_GET_SIZE' was not declared in this scope
       if (PyTuple_GET_SIZE(value) != 3) {
           ^~~~~~~~~~~~~~~~
  /tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:242:9: note: suggested alternative: 'PyTuple_GetSlice'
       if (PyTuple_GET_SIZE(value) != 3) {
           ^~~~~~~~~~~~~~~~
           PyTuple_GetSlice
  /tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:245:13: error: 'PyTuple_GET_ITEM' was not declared in this scope
       title = PyTuple_GET_ITEM(value, 2);
               ^~~~~~~~~~~~~~~~
  /tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:245:13: note: suggested alternative: 'PyArray_GETITEM'
       title = PyTuple_GET_ITEM(value, 2);
               ^~~~~~~~~~~~~~~~
               PyArray_GETITEM
  gmake[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:76: modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
  gmake[1]: *** [CMakeFiles/Makefile2:2077: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
  gmake: *** [Makefile:166: all] Error 2
  Traceback (most recent call last):
    File "/tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 640, in setup
      cmkr.make(make_args, install_target=cmake_install_target, env=env)
    File "/tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 672, in make
      self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
    File "/tmp/pip-build-env-uj14l2ll/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 704, in make_impl
      "An error occurred while building with CMake.\n"

  An error occurred while building with CMake.
    Command:
      cmake --build . --target install --config Release --
    Install target:
      install
    Source directory:
      /tmp/pip-install-pjy3pvde/opencv-python
    Working directory:
      /tmp/pip-install-pjy3pvde/opencv-python/_skbuild/linux-x86_64-3.7/cmake-build
  Please check the install target is valid and see CMake's output for more information.
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python
  Running setup.py clean for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

I checked the requirements for the program and I workaround the following conda recipe for Ubuntu 22.04:

cd --
git clone https://github.com/estebanpw/chromeister.git
cd chromeister
make all -C src/

conda create --name chromeister python=3.6.13         # create environment
conda activate chromeister                            # load environment

# Install packages
conda install -c bioconda -y scikit-build
conda install -c anaconda -y cycler
conda install -c anaconda -y kiwisolver
conda install -c bioconda -y numpy
pip install opencv-python
conda install -c bioconda -y Pillow
conda install -c bioconda -y pyparsing
conda install -c bioconda -y python-dateutil
conda install -c bioconda -y six

In this manner, as an example, I can call chromeister as follows:

conda activate chromeister
/home/carlos/chromeister/bin/CHROMEISTER -query GRCm39.genome.fa -db Mus_musculus.GRCm39.dna.toplevel.fa -out dotplot.mat && Rscript /home/carlos/chromeister/bin/compute_score.R dotplot.mat 1000

and the program is working as follows:

[INFO] Generating a 1000x1000 matrix
[INFO] Loading database
99%...[INFO] Database loaded and of length 2728222451.
[INFO] Ratios: Q [2.728222e+06] D [2.728222e+06]. Lenghts: Q [2728222451] D [2728222451]
[INFO] Pixel size: Q [3.665390e-07] D [3.665390e-07].
[INFO] Computing absolute hit numbers.
19%...
79%...
99%...Scanning hits table.
99%...
[INFO] Query length 2728222451.
[INFO] Writing matrix.
[INFO] Found 2234272 unique hits for z = 4.
0

My question is, can I just use the program in this way, or I do need to work on the python-opencv error?

Cheers,

Carlos

estebanpw commented 1 year ago

Hello Carlos!

You can use the program like that; only the event detection will not work as this one requires open cv to work. The dotplots and the scores will be fine.

Did your workaround manage to install opencv? If so, you could also use the detect events script. Otherwise, maybe this can help

Let me know!

Bests, Esteban