abyzovlab / CNVpytor

a python extension of CNVnator -- a tool for CNV analysis from depth-of-coverage by mapped reads
MIT License
178 stars 26 forks source link

Bug: cnvpytor v1.3.1 is not compatible with python 3.12.4 #236

Closed LawrenceLiu023 closed 1 month ago

LawrenceLiu023 commented 1 month ago

Environment:

cnvpytor is installed by following commands:

git clone https://github.com/abyzovlab/CNVpytor.git
cd CNVpytor
pip install .

Command:

cnvpytor -download

Output:

2024-08-01 17:34:57,612 - cnvpytor.genome - INFO - Updating reference genome resource files...
Traceback (most recent call last):
  File "/data/methylation/tools/miniconda3/bin/cnvpytor", line 33, in <module>
    sys.exit(load_entry_point('CNVpytor==1.3.2', 'console_scripts', 'cnvpytor')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/methylation/tools/miniconda3/lib/python3.12/site-packages/CNVpytor-1.3.2-py3.12.egg/cnvpytor/__main__.py", line 184, in main
  File "/data/methylation/tools/miniconda3/lib/python3.12/site-packages/CNVpytor-1.3.2-py3.12.egg/cnvpytor/genome.py", line 184, in download_resources
  File "<frozen genericpath>", line 19, in exists
TypeError: stat: path should be string, bytes, os.PathLike or integer, not Path

This issue may be related to the change in python3.12. The same command can be successfully executed in a python 3.11.9 environment.

suvakov commented 1 month ago

Thank you for reporting this issue. We will address it soon.

When installing from GitHub, the cnvpytor -download step is unnecessary. This step is only required when cnvpytor is installed from PyPI, as resource files are not included in the PyPI repository due to size limitations.

LawrenceLiu023 commented 1 month ago

Thank you for your response. I encountered the error when running the command cnvpytor -root file.pytor -rd file.bam. Later, I found that the command cnvpytor -download also produced the same error. So I listed the latter command because it is easier to reproduce the same error.

suvakov commented 1 month ago

cnvpytor -root file.pytor -rd file.bam should work with python 3.12 after last few updates. Please try again to clone repository and install cnvpytor and let us know if there is still error. Thanks.

arpanda commented 1 month ago

I tried to reproduce the error for Python 3.12.4 on multiple systems, including Ubuntu 22.04.. However, I was unable to replicate the issue. It might be a network problem on your end.

LawrenceLiu023 commented 1 month ago

I tried downloading the release v1.3.1 source code zip file and installing it with pip install .. None of the above errors occurred in either the Python 3.12.4 or 3.11.9 environment. Then I noticed that the /cnvpytor/version.py file contains different version information. The version.py file obtained by running git clone https://github.com/abyzovlab/CNVpytor.git contains __version__='1.3.2', but the same file in the release v1.3.1 source code zip file contains __version__='1.3.1'. The genome.py file which the above error log mentioned is also different. Maybe the difference between the repository content and the release source code caused this issue.