Skip to content

cgat-0.7.4 pip install : FileNotFoundError: [Errno 2] No such file or directory: 'requires.txt' #134

@ns-rse

Description

@ns-rse

Further to cgat-core #177 I'm still having trouble installing cgat on my system.

NB I've read the install instructions and have seen the preferred approach is to use Conda environments but would prefer to use plain virtual environments because of the recent furore and potential licensing issues associated with Conda.

In #177 I attempted to abstract out the problem from the pyproject.toml I mentioned and manually install packages and dependencies. I continue with that approach here.

❱ pip install cgat     
Collecting cgat
  Downloading cgat-0.7.4.tar.gz (408 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      <string>:52: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      WARNING: depency check for UCSC tools(wigToBigWig) failed, error 127
      WARNING: depency check for bedtools(bedtools) failed, error 127
      Traceback (most recent call last):
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-8nf_pluf/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-8nf_pluf/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-8nf_pluf/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 319, in run_setup
          exec(code, locals())
        File "<string>", line 143, in <module>
      FileNotFoundError: [Errno 2] No such file or directory: 'requires.txt'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

Downloading the source, extracting and attempting to install...

https://files.pythonhosted.org/packages/6c/b3/ab52100e736cad58ebebbf67b04322345f2139d36ee8d0637737eb4b8a6f/cgat-0.7.4.tar.gz
tar xzvf cgat-0.7.4.tar.gz
cd cgat
pip install .
Processing /home/neil/work/git/hub/cgat-developers/cgat-0.7.4
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      <string>:52: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      WARNING: depency check for UCSC tools(wigToBigWig) failed, error 127
      WARNING: depency check for bedtools(bedtools) failed, error 127
      Traceback (most recent call last):
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-s18pqlf2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-s18pqlf2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-s18pqlf2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 319, in run_setup
          exec(code, locals())
        File "<string>", line 143, in <module>
      FileNotFoundError: [Errno 2] No such file or directory: 'requires.txt'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

requires.txt

Looking for requires.txt in the package files.

grep -R "requires\.txt" -B5 -A5
setup.py-138-    r'^-e (?P<link>.*).+#(?P<package>.+)-(?P<version>\d(?:\.\d)*)$')
setup.py-139-install_requires = []
setup.py-140-dependency_links = []
setup.py-141-
setup.py-142-for requirement in (
setup.py:143:        l.strip() for l in open('requires.txt') if not l.startswith("#")):
setup.py-144-    match = REPO_REQUIREMENT.match(requirement)
setup.py-145-    if match:
setup.py-146-        assert which(match.group('vcs')) is not None, \
setup.py-147-            ("VCS '%(vcs)s' must be installed in order to "
setup.py-148-             "install %(link)s" % match.groupdict())

Searching for requires.txt

find . -name "requires.txt"

The file doesn't exist.

Checking cgat-0.7.2

cd ..
wget https://files.pythonhosted.org/packages/ef/c4/51ff925472539041ad23edf0ebf3b5f3fa496c716f13f22f85f88254c7ee/cgat-0.7.2.tar.gz
tar xzvf cgat-0.7.2.tar.gz
find . -name "requires.txt"
./requires.txt

The file is present in the previous release, but its an empty file...

ls -l requires.txt 
.rw-r--r-- neil neil 0 B Fri Apr  5 11:17:00 2024  requires.txt
 11:43:26 am GMT  percentage:  neil  ~/work/git/hub/cgat-developers/cgat-0.7.2  
cat requires.txt

Workaround

Add an empty file to cgat-0.7.4 and its possible to pip install ., but it fails further along

cd ../cgat-0.7.4
touch requires.txt
pip install .
Processing /home/neil/work/git/hub/cgat-developers/cgat-0.7.4
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: cgat
  Building wheel for cgat (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for cgat (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [335 lines of output]
      <string>:52: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      /tmp/pip-build-env-9uh7wu05/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
        warnings.warn(msg)
      WARNING: depency check for UCSC tools(wigToBigWig) failed, error 127
      WARNING: depency check for bedtools(bedtools) failed, error 127
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Masker.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/__init__.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/AString.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/SetTools.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Blat.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Motifs.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/RLE.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/MEME.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Histogram2D.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Glam2Scan.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Iterators.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/IndexedGenome.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Genomics.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/makeGeneset.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Tree.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/TreeTools.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/dictzip.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/SequenceProperties.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Variants.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Fastq.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Stats.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Bed.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/AGP.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/GTF.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/FastaIterator.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Histogram.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/version.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/GFF3.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/MatrixTools.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Intervals.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/VCF.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/IndexedFasta.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/cgat.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/RateEstimation.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Glam2.py -> build/lib.linux-x86_64-cpython-312/cgat
      copying cgat/Sra.py -> build/lib.linux-x86_64-cpython-312/cgat
      creating build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2bam.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastq2tsv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/__init__.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam_compare_alignments.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2psl.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/diff_chains.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/vcf_vs_vcf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastq2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/split_file.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2bam_split_reads.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/data2histogram.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff32gtf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2variants.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/vcf_stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/diff_gtf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/genome_bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/cgat_script_template.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gtf2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastq2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gtf2gff.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed2bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/table2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2wiggle.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/beds2counts.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed2graph.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2histogram.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bams2bam.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2fastq.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/vcf2tsv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/index2bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastq2tpm.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam_vs_bam.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/diff_fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2gff.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/csvs2csv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/vcf2vcf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/table2stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/cgat_get_options.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/vcf_compare_phase.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gtf2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bcl2fastq.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastqs2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/diff_bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2vcf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/split_fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastas2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/tables2table.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/beds2beds.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastq2summary.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/diff_bam.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gtf2gtf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/split_gff.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed2stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/vcfstats2db.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/extract_stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam_vs_gtf.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastq2fastq.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2window_stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed_vs_bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2stats.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastqs2fastq.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2depth.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bed2gff.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam_vs_bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/csv2csv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fastqs2fastqs.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2fastq.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/cgat_rebuild_extensions.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/fasta2kmercontent.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gtfs2tsv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gtf2tsv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/wig2bed.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/gff2coverage.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/index_fasta.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam_pileup2tsv.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      copying cgat/tools/bam2geneprofile.py -> build/lib.linux-x86_64-cpython-312/cgat/tools
      creating build/lib.linux-x86_64-cpython-312/cgat/NCL
      copying cgat/NCL/__init__.py -> build/lib.linux-x86_64-cpython-312/cgat/NCL
      running egg_info
      writing cgat.egg-info/PKG-INFO
      writing dependency_links to cgat.egg-info/dependency_links.txt
      writing entry points to cgat.egg-info/entry_points.txt
      writing top-level names to cgat.egg-info/top_level.txt
      reading manifest file 'cgat.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files matching '*' found under directory 'tests'
      adding license file 'LICENSE'
      writing manifest file 'cgat.egg-info/SOURCES.txt'
      /tmp/pip-build-env-9uh7wu05/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:220: _Warning: Package 'cgat.BamTools' is absent from the `packages` configuration.
      !!
      
              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'cgat.BamTools' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.
      
              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'cgat.BamTools' is explicitly added
              to the `packages` configuration field.
      
              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).
      
              You can read more about "package discovery" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
      
              If you don't want 'cgat.BamTools' to be distributed and are
              already explicitly excluding 'cgat.BamTools' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.
      
              You can read more about "package data files" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
      
      
              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      
      !!
        check.warn(importable)
      /tmp/pip-build-env-9uh7wu05/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:220: _Warning: Package 'cgat.Components' is absent from the `packages` configuration.
      !!
      
              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'cgat.Components' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.
      
              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'cgat.Components' is explicitly added
              to the `packages` configuration field.
      
              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).
      
              You can read more about "package discovery" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
      
              If you don't want 'cgat.Components' to be distributed and are
              already explicitly excluding 'cgat.Components' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.
      
              You can read more about "package data files" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
      
      
              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      
      !!
        check.warn(importable)
      /tmp/pip-build-env-9uh7wu05/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:220: _Warning: Package 'cgat.FastqTools' is absent from the `packages` configuration.
      !!
      
              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'cgat.FastqTools' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.
      
              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'cgat.FastqTools' is explicitly added
              to the `packages` configuration field.
      
              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).
      
              You can read more about "package discovery" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
      
              If you don't want 'cgat.FastqTools' to be distributed and are
              already explicitly excluding 'cgat.FastqTools' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.
      
              You can read more about "package data files" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
      
      
              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      
      !!
        check.warn(importable)
      /tmp/pip-build-env-9uh7wu05/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:220: _Warning: Package 'cgat.VCFTools' is absent from the `packages` configuration.
      !!
      
              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'cgat.VCFTools' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.
      
              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'cgat.VCFTools' is explicitly added
              to the `packages` configuration field.
      
              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).
      
              You can read more about "package discovery" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
      
              If you don't want 'cgat.VCFTools' to be distributed and are
              already explicitly excluding 'cgat.VCFTools' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.
      
              You can read more about "package data files" on setuptools documentation page:
      
              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
      
      
              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      
      !!
        check.warn(importable)
      copying cgat/GeneModelAnalysis.pyx -> build/lib.linux-x86_64-cpython-312/cgat
      creating build/lib.linux-x86_64-cpython-312/cgat/BamTools
      copying cgat/BamTools/bamtools.pyx -> build/lib.linux-x86_64-cpython-312/cgat/BamTools
      copying cgat/BamTools/geneprofile.pyx -> build/lib.linux-x86_64-cpython-312/cgat/BamTools
      copying cgat/BamTools/peakshape.pyx -> build/lib.linux-x86_64-cpython-312/cgat/BamTools
      creating build/lib.linux-x86_64-cpython-312/cgat/Components
      copying cgat/Components/Components.pyx -> build/lib.linux-x86_64-cpython-312/cgat/Components
      copying cgat/Components/connected_components.cpp -> build/lib.linux-x86_64-cpython-312/cgat/Components
      creating build/lib.linux-x86_64-cpython-312/cgat/FastqTools
      copying cgat/FastqTools/fastqtools.pyx -> build/lib.linux-x86_64-cpython-312/cgat/FastqTools
      creating build/lib.linux-x86_64-cpython-312/cgat/VCFTools
      copying cgat/VCFTools/vcftools.pyx -> build/lib.linux-x86_64-cpython-312/cgat/VCFTools
      copying cgat/NCL/cnestedlist.pyx -> build/lib.linux-x86_64-cpython-312/cgat/NCL
      copying cgat/NCL/intervaldb.c -> build/lib.linux-x86_64-cpython-312/cgat/NCL
      running build_ext
      Compiling cgat/Components/Components.pyx because it changed.
      [1/1] Cythonizing cgat/Components/Components.pyx
      building 'cgat.Components' extension
      creating build/temp.linux-x86_64-cpython-312/cgat/Components
      g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -fPIC -I/home/neil/.virtualenvs/isoslam/include -I/usr/include/python3.12 -c cgat/Components/Components.cpp -o build/temp.linux-x86_64-cpython-312/cgat/Components/Components.o
      cgat/Components/Components.cpp:1249:10: fatal error: connected_components.h: No such file or directory
       1249 | #include "connected_components.h"
            |          ^~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/g++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cgat
Failed to build cgat
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cgat)

There are some warnings about the cgat.VCFTools / cgat.BamTools / cgat.Components / cgat.FastqTools not being correctly configured for setuptools but the install proceeds.

Compilation of the C++ code fails because there is a missing header file connected_components.h.

Trying to install cgat-0.7.2

Dropping back a version I encounter again the Numpy issue described in #177 as the very first thing setup.py does is check that numpy can be imported. It should be importable because I have explicitly installed it...

pip show numpy | head -n8
Name: numpy
Version: 2.1.2
Summary: Fundamental package for array computing in Python
Home-page: https://numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: Copyright (c) 2005-2024, NumPy Developers.
All rights reserved.

However this is not detected correctly...

pip install .
Processing /home/neil/work/git/hub/cgat-developers/cgat-0.7.2
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "<string>", line 15, in <module>
      ModuleNotFoundError: No module named 'numpy'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-gygxww3j/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-gygxww3j/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-gygxww3j/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 521, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-gygxww3j/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 319, in run_setup
          exec(code, locals())
        File "<string>", line 17, in <module>
      ImportError: the CGAT code collection requires numpy to be installed before running setup.py (pip install numpy)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I decided to try using the Setuptools method of Declaring required dependency using setup.cfg (although the current ecosystem is standardising on the pyproject.toml format as per PEP621).

setup.cfg

[project]
install_requires =
    "Cython",
    "numpy",
    "pysam"


[egg_info]
tag_build =
tag_date = 0

setup.py

Disable the checks for these packages at the start1

import sysconfig
import sys
import os
import subprocess
import re

########################################################################
#######################################################################
# Check for dependencies
#
# Is there a way to do this more elegantly?
#     1. Run "pip install numpy"
#     2. Wrap inside functions (works for numpy/pysam, but not cython)
# try:
#     import numpy
# except ImportError:
#     raise ImportError(
#         "the CGAT code collection requires numpy to be installed "
#         "before running setup.py (pip install numpy)")

# try:
#     import Cython
# except ImportError:
#     raise ImportError(
#         "the CGAT code collection requires cython to "
#         "be installed before running setup.py (pip install cython)")

# try:
#     import pysam
# except ImportError:
#     raise ImportError(
#         "the CGAT code collection requires pysam to "
#         "be installed before running setup.py (pip install pysam)")
...

Try installing but it now doesn't install because an attempt is made to import from Cython, which I have explicitly manually installed along with pysam, fails.

pip show Cython pysam      
Name: Cython
Version: 3.0.11
Summary: The Cython compiler for writing C extensions in the Python language.
Home-page: https://cython.org/
Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.
Author-email: cython-devel@python.org
License: Apache-2.0
Location: /home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages
Requires: 
Required-by: 
---
Name: pysam
Version: 0.22.1
Summary: Package for reading, manipulating, and writing genomic data
Home-page: https://github.com/pysam-developers/pysam
Author: Andreas Heger
Author-email: Andreas Heger <andreas.heger@gmail.com>
License: MIT License
Location: /home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages
Requires: 
Required-by: isoslam
❱ pip install .
Processing /home/neil/work/git/hub/cgat-developers/cgat-0.7.2
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      <string>:52: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      Traceback (most recent call last):
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/neil/.virtualenvs/isoslam/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-lmjixk24/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-lmjixk24/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-lmjixk24/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 521, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-lmjixk24/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 319, in run_setup
          exec(code, locals())
        File "<string>", line 57, in <module>
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Possible solutions?

  • Adding the missing header file connected_components.h seems like it would be needed to build and install the package (after adding back in an empty requires.txt.
  • Longer term rehashing the package metadata and standardising on pyproject.toml would perhaps help with some of these problems as setup.py tries to import and use some of the packages it depends on before they have been pulled in and installed as dependencies.

Footnotes

  1. I note the comments in setup.py about Is there a way to do this more elegantly?. The traditional method of specifying dependencies in setup.py is within the call to setup() see setup.py tab here but as mentioned the preferred configuration is now via pyproject.toml and I think the reason this inelegant solution exists is because the packages are imported and used before they have been installed as dependencies.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions