cgat-developers/cgat-core

cgat-0.7.2 fails to install in fresh env due to missing Numpy dependency

Closed this issue · 3 comments

Hi,

I've started work on a new project and the team uses cgat as a dependency which I've listed in my pyproject.toml.

I found on setting up a GitHub job that installing the Python packages failed with cgat because Numpy wasn't installed. I could reproduce this locally in a clean environment (I use mktmpenv from virtualenvwrapper.

mktmpenv 
pip install cgat
Collecting cgat
  Downloading cgat-0.7.2.tar.gz (421 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
  ╰─> [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/tmp-6aa5bc01f84437/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neil/.virtualenvs/tmp-6aa5bc01f84437/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/tmp-6aa5bc01f84437/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-_we0qsva/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-_we0qsva/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-_we0qsva/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 516, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-_we0qsva/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, 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.

If I first install numpy manually and then try installing cgat again I get the same error.

(tmp-6aa5bc01f84437) ❱ pip install numpy
Collecting numpy
  Using cached numpy-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached numpy-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.0 MB)
Installing collected packages: numpy
Successfully installed numpy-2.1.2


(tmp-6aa5bc01f84437) ❱ pip install cgat 
Collecting cgat
  Using cached cgat-0.7.2.tar.gz (421 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
  ╰─> [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/tmp-6aa5bc01f84437/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neil/.virtualenvs/tmp-6aa5bc01f84437/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/tmp-6aa5bc01f84437/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-9nmtkt_f/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-9nmtkt_f/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-9nmtkt_f/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 516, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-9nmtkt_f/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, 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.

The Homepage link from PyPI (http://www.cgat.org/cgat/Tools/) is broken as the domain is no longer registered. I couldn't see which repository builds the cgat package on PyPI though so have plumped for reporting it here, my apologies if that is wrong (which it probably is!).

Thanks for the issue, this is because cgat requires numpy to be present during its build phase, but it is failing to detect it properly, even after you have installed it manually. It seems like this may be an issue with you pyproject.toml, have you tried explicityly listing numpy dep? e.g.:

python = "^3.12"
numpy = "^2.1.2"
cgat = "^0.7.2"

Yes the PyPi link is broken, need to update this and a few other things too. When I get time I will update. Currently I manually upload the PyPI during a new build.

oh actually, just wondering if you mean cgat-apps? cgat repo is cgat-apps and cgat-core is the workflow engine

Please could you open an issue on cgat-apps please if still required. Thanks.