franciscovillaescusa/Pylians3

Problem installing pylians on linux (Ubuntu 20.04)

cloud182 opened this issue · 18 comments

Hello,

I am trying to install Pylians on my machine, but I am getting an error. I have Ubuntu 20.04, and I am trying to install the package in a conda environment with Python 3.10 via python -m pip install Pylians, but I also tried older versions (python 3.8, python 3.9). I also tried to install the package on other machines with other Linux versions (CentOS 7) and I always got the same error:

Collecting Pylians
  Using cached Pylians-0.5.tar.gz (2.0 MB)
  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]
      Traceback (most recent call last):
        File "/home/econgiu/miniconda3/envs/py31/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/home/econgiu/miniconda3/envs/py31/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/econgiu/miniconda3/envs/py31/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-o5mrd48o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-o5mrd48o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-o5mrd48o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 99, in <module>
        File "/tmp/pip-build-env-o5mrd48o/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 970, in cythonize
          module_list, module_metadata = create_extension_list(
        File "/tmp/pip-build-env-o5mrd48o/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 816, in create_extension_list
          for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
        File "/tmp/pip-build-env-o5mrd48o/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 114, in nonempty
          raise ValueError(error_msg)
      ValueError: 'library/MAS_library/MAS_library.pyx' doesn't match any files
      [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.

Can you help me find the origin of this issue?
Thanks!

Can you try to install it outside the conda environment. I know that sometimes combining conda and pip can led to conflicts.

Can you try to install it outside the conda environment. I know that sometimes combining conda and pip can led to conflicts.

Hello,

I encontour the similar problem when I try to install.

And when I was trying to install the development version, the error message is more detailed, which reads

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(ky), <int>sqrt(kx*kx + kz*kz)
                      else:
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                                               ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1689:42: local variable 'MAS_corr1' referenced before assignment

And there are a lot of other similar error messages about the variables MAS_corr MAS_corr2.

The whole message is:

  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
  ╰─> [284 lines of output]
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
          # do a loop over all modes, computing their k,Pk. k's are in k_F units
          start2 = time.time();  prefact = np.pi/dims
          for kxx in range(dims):
              kx = (kxx-dims if (kxx>middle) else kxx)
              MAS_corr[0] = MAS_correction(prefact*kx,MAS_index)
             ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1387:8: local variable 'MAS_corr' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              kx = (kxx-dims if (kxx>middle) else kxx)
              MAS_corr[0] = MAS_correction(prefact*kx,MAS_index)
      
              for kyy in range(dims):
                  ky = (kyy-dims if (kyy>middle) else kyy)
                  MAS_corr[1] = MAS_correction(prefact*ky,MAS_index)
                 ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1391:12: local variable 'MAS_corr' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  ky = (kyy-dims if (kyy>middle) else kyy)
                  MAS_corr[1] = MAS_correction(prefact*ky,MAS_index)
      
                  for kzz in range(middle+1): #kzz=[0,1,..,middle] --> kz>0
                      kz = (kzz-dims if (kzz>middle) else kzz)
                      MAS_corr[2] = MAS_correction(prefact*kz,MAS_index)
                     ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1395:16: local variable 'MAS_corr' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # compute |k| of the mode and its integer part
                      kmod    = sqrt(kx*kx + ky*ky + kz*kz)
                      k_index = <int>kmod
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr[0]*MAS_corr[1]*MAS_corr[2]
                                  ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1408:29: local variable 'MAS_corr' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # compute |k| of the mode and its integer part
                      kmod    = sqrt(kx*kx + ky*ky + kz*kz)
                      k_index = <int>kmod
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr[0]*MAS_corr[1]*MAS_corr[2]
                                              ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1408:41: local variable 'MAS_corr' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # compute |k| of the mode and its integer part
                      kmod    = sqrt(kx*kx + ky*ky + kz*kz)
                      k_index = <int>kmod
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr[0]*MAS_corr[1]*MAS_corr[2]
                                                          ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1408:53: local variable 'MAS_corr' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
          # do a loop over all modes, computing their k,Pk. k's are in k_F units
          start2 = time.time();  prefact = np.pi/dims
          for kxx in range(dims):
              kx = (kxx-dims if (kxx>middle) else kxx)
              MAS_corr1[0] = MAS_correction(prefact*kx,MAS_index1)
             ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1661:8: local variable 'MAS_corr1' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          # do a loop over all modes, computing their k,Pk. k's are in k_F units
          start2 = time.time();  prefact = np.pi/dims
          for kxx in range(dims):
              kx = (kxx-dims if (kxx>middle) else kxx)
              MAS_corr1[0] = MAS_correction(prefact*kx,MAS_index1)
              MAS_corr2[0] = MAS_correction(prefact*kx,MAS_index2)
             ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1662:8: local variable 'MAS_corr2' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              MAS_corr1[0] = MAS_correction(prefact*kx,MAS_index1)
              MAS_corr2[0] = MAS_correction(prefact*kx,MAS_index2)
      
              for kyy in range(dims):
                  ky = (kyy-dims if (kyy>middle) else kyy)
                  MAS_corr1[1] = MAS_correction(prefact*ky,MAS_index1)
                 ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1666:12: local variable 'MAS_corr1' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              MAS_corr2[0] = MAS_correction(prefact*kx,MAS_index2)
      
              for kyy in range(dims):
                  ky = (kyy-dims if (kyy>middle) else kyy)
                  MAS_corr1[1] = MAS_correction(prefact*ky,MAS_index1)
                  MAS_corr2[1] = MAS_correction(prefact*ky,MAS_index2)
                 ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1667:12: local variable 'MAS_corr2' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  MAS_corr1[1] = MAS_correction(prefact*ky,MAS_index1)
                  MAS_corr2[1] = MAS_correction(prefact*ky,MAS_index2)
      
                  for kzz in range(middle+1): #kzz=[0,1,..,middle] --> kz>0
                      kz = (kzz-dims if (kzz>middle) else kzz)
                      MAS_corr1[2] = MAS_correction(prefact*kz,MAS_index1)
                     ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1671:16: local variable 'MAS_corr1' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  MAS_corr2[1] = MAS_correction(prefact*ky,MAS_index2)
      
                  for kzz in range(middle+1): #kzz=[0,1,..,middle] --> kz>0
                      kz = (kzz-dims if (kzz>middle) else kzz)
                      MAS_corr1[2] = MAS_correction(prefact*kz,MAS_index1)
                      MAS_corr2[2] = MAS_correction(prefact*kz,MAS_index2)
                     ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1672:16: local variable 'MAS_corr2' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(ky), <int>sqrt(kx*kx + kz*kz)
                      else:
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                                  ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1689:29: local variable 'MAS_corr1' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(ky), <int>sqrt(kx*kx + kz*kz)
                      else:
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                                               ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1689:42: local variable 'MAS_corr1' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(ky), <int>sqrt(kx*kx + kz*kz)
                      else:
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                                                            ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1689:55: local variable 'MAS_corr1' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                      delta_k1[kxx,kyy,kzz] = delta_k1[kxx,kyy,kzz]*MAS_factor
                      MAS_factor = MAS_corr2[0]*MAS_corr2[1]*MAS_corr2[2]
                                  ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1691:29: local variable 'MAS_corr2' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                      delta_k1[kxx,kyy,kzz] = delta_k1[kxx,kyy,kzz]*MAS_factor
                      MAS_factor = MAS_corr2[0]*MAS_corr2[1]*MAS_corr2[2]
                                               ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1691:42: local variable 'MAS_corr2' referenced before assignment
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          k_par, k_per = abs(kz), <int>sqrt(kx*kx + ky*ky)
      
                      # correct modes amplitude for MAS
                      MAS_factor = MAS_corr1[0]*MAS_corr1[1]*MAS_corr1[2]
                      delta_k1[kxx,kyy,kzz] = delta_k1[kxx,kyy,kzz]*MAS_factor
                      MAS_factor = MAS_corr2[0]*MAS_corr2[1]*MAS_corr2[2]
                                                            ^
      ------------------------------------------------------------
      
      library/Pk_library/Pk_library.pyx:1691:55: local variable 'MAS_corr2' referenced before assignment
      Compiling library/MAS_library/MAS_library.pyx because it depends on /tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/Cython/Includes/libc/string.pxd.
      Compiling library/Pk_library/Pk_library.pyx because it changed.
      Compiling library/Pk_library/bispectrum_library.pyx because it changed.
      Compiling library/MAS_library/field_properties.pyx because it depends on /tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/Cython/Includes/libc/string.pxd.
      Compiling library/redshift_space_library/redshift_space_library.pyx because it changed.
      Compiling library/smoothing_library/smoothing_library.pyx because it changed.
      Compiling library/void_library/void_library.pyx because it changed.
      Compiling library/integration_library/integration_library.pyx because it changed.
      Compiling library/density_field_library/density_field_library.pyx because it changed.
      Compiling library/sorting_library/sorting_library.pyx because it changed.
      Compiling library/HI_library/HI_library.pyx because it depends on /tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/Cython/Includes/libc/string.pxd.
      Compiling library/HI_clusters_library/HI_clusters_library.pyx because it depends on /tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/Cython/Includes/libc/string.pxd.
      [ 1/12] Cythonizing library/Pk_library/Pk_library.pyx
      Traceback (most recent call last):
        File "/home/zero/.conda/envs/myenv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/zero/.conda/envs/myenv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/zero/.conda/envs/myenv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 99, in <module>
        File "/tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1127, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-bfqccpns/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1250, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: library/Pk_library/Pk_library.pyx
      [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.
Note: you may need to restart the kernel to use updated packages.

Can you help to check what happens in the 'library.pyx'?

Thanks!

Hi @franciscovillaescusa, I tried to install it outside conda and I still get the same error message:

Collecting pylians
  Using cached Pylians-0.5.tar.gz (2.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /tmp/tmpetgn49fu get_requires_for_build_wheel /tmp/tmpgnm23i5b
       cwd: /tmp/pip-install-aubhvbs6/pylians
  Complete output (21 lines):
  Traceback (most recent call last):
    File "/tmp/tmpetgn49fu", line 280, in <module>
      main()
    File "/tmp/tmpetgn49fu", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpetgn49fu", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-nxcwrgpc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-nxcwrgpc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-nxcwrgpc/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
      exec(code, locals())
    File "<string>", line 99, in <module>
    File "/tmp/pip-build-env-nxcwrgpc/overlay/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 970, in cythonize
      module_list, module_metadata = create_extension_list(
    File "/tmp/pip-build-env-nxcwrgpc/overlay/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 816, in create_extension_list
      for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
    File "/tmp/pip-build-env-nxcwrgpc/overlay/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 114, in nonempty
      raise ValueError(error_msg)
  ValueError: 'library/MAS_library/MAS_library.pyx' doesn't match any files
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpetgn49fu get_requires_for_build_wheel /tmp/tmpgnm23i5b Check the logs for full command output.

I have the same issue. Ubuntu 20.04.4, Python 3.8.10, tried installing outside of conda

The releases (0.4 and 0.5) on PyPI are missing the file library/MAS_library/MAS_library.pyx

(12900) ~ $ tar --list -f Pylians-0.4.tar.gz | fgrep MAS_library.pyx
(12900) ~ $
(12900) ~ $ tar --list -f Pylians-0.5.tar.gz | fgrep MAS_library.pyx
(12900) ~ $ 

The issue library/Pk_library/Pk_library.pyx:1689:42: local variable 'MAS_corr1' referenced before assignment was introduced in 05c1b98.
The variable MAS_corr1 assignation was removed, hence the variable being used before its assignation.

One can install from git checkout HEAD^1 or with pip install git+https://github.com/franciscovillaescusa/Pylians3.git@8f902be81cc1b0de13703dc011318daedc8eac27

Not sure what bug this fixes. @franciscovillaescusa

Hi guys, sorry about this. I recently fixed a bug for one routine but then there were some variables that were not defined anymore so cython complained. I believe I have fixed it and I have tested that I can compile the code properly on a fresh machine. Can you try and let me know if it works now? Sorry again about this and thanks for your patience.

Hi @franciscovillaescusa,

I just tried to install the new version of the package and it was successful.

Thank you very much for your help!

Great thanks! and apologies once again for the misplace.

I believe this is now fixed so I'm closing this thread.

Hi, sorry to bug you on a closed thread, but I'm getting a possibly related error to the one here. I've tried to install on a Debian Linux machine using pip, inside and outside a conda environment, but I get the same issue. Seems to be a Cython compilation error, which I've appended below. Any suggestions? Thanks for your help!

> pip install Pylians                                                                                                                                                          (base) 
Collecting Pylians
  Using cached Pylians-0.7.tar.gz (3.2 MB)
  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
  ╰─> [123 lines of output]
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # RK4 example1 for debugging
      cpdef RK4_example(double[::1] yinit, double x1, double x2, long nstep):
      
          cdef double *result
          result =  CI.rkdumb(&yinit[0], yinit.shape[0], x1, x2, nstep,
                              NULL, NULL, 0, example)
                                             ^
      ------------------------------------------------------------
      
      library/integration_library/integration_library.pyx:87:39: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      cpdef RK4_example2(double[::1] yinit, double x1, double x2, long nstep,
                         double[::1] a, double[::1] b):
      
          cdef double *result
          result =  CI.rkdumb(&yinit[0], yinit.shape[0], x1, x2, nstep,
                              &a[0], &b[0], a.shape[0], example2)
                                                        ^
      ------------------------------------------------------------
      
      library/integration_library/integration_library.pyx:97:50: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
          cdef long nok, nbad
          nok = nbad = 0
      
          CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                    NULL, NULL, 0, example)
                                   ^
      ------------------------------------------------------------
      
      library/integration_library/integration_library.pyx:110:29: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
          cdef long nok, nbad
          nok = nbad = 0
      
          CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                    &a[0], &b[0], a.shape[0], example2)
                                              ^
      ------------------------------------------------------------
      
      library/integration_library/integration_library.pyx:128:40: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef long nok, nbad
          nok = nbad = 0
      
          if function=='log' or function=='sigma':
              CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                        &a[0], &b[0], b.shape[0], sigma)
                                                  ^
      ------------------------------------------------------------
      
      library/integration_library/integration_library.pyx:147:44: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                        &a[0], &b[0], b.shape[0], sigma)
      
          elif function=='linear':
              CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                        &a[0], &b[0], b.shape[0], linear)
                                                  ^
      ------------------------------------------------------------
      
      library/integration_library/integration_library.pyx:151:44: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
      Compiling library/MAS_library/MAS_library.pyx because it changed.
      Compiling library/Pk_library/Pk_library.pyx because it changed.
      Compiling library/Pk_library/bispectrum_library.pyx because it changed.
      Compiling library/MAS_library/field_properties.pyx because it changed.
      Compiling library/redshift_space_library/redshift_space_library.pyx because it changed.
      Compiling library/smoothing_library/smoothing_library.pyx because it changed.
      Compiling library/void_library/void_library.pyx because it changed.
      Compiling library/integration_library/integration_library.pyx because it changed.
      Compiling library/density_field_library/density_field_library.pyx because it changed.
      Compiling library/sorting_library/sorting_library.pyx because it changed.
      Compiling library/HI_library/HI_library.pyx because it changed.
      Compiling library/HI_clusters_library/HI_clusters_library.pyx because it changed.
      [ 1/12] Cythonizing library/HI_clusters_library/HI_clusters_library.pyx
      [ 2/12] Cythonizing library/HI_library/HI_library.pyx
      [ 3/12] Cythonizing library/MAS_library/MAS_library.pyx
      [ 4/12] Cythonizing library/MAS_library/field_properties.pyx
      [ 5/12] Cythonizing library/Pk_library/Pk_library.pyx
      [ 6/12] Cythonizing library/Pk_library/bispectrum_library.pyx
      [ 7/12] Cythonizing library/density_field_library/density_field_library.pyx
      [ 8/12] Cythonizing library/integration_library/integration_library.pyx
      Traceback (most recent call last):
        File "/home/john/miniconda3/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/john/miniconda3/lib/python3.10/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/john/miniconda3/lib/python3.10/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-apllxp7x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-apllxp7x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-apllxp7x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 99, in <module>
        File "/tmp/pip-build-env-apllxp7x/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-apllxp7x/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: library/integration_library/integration_library.pyx
      [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.

Have you seen this before?

Hi John,

I haven't seen this error before but it seems it failed at getting the dependencies needed by Pylians to compile (perhaps cython). Can you perhaps install those separately, i.e.:

python -m pip install Cython
python -m pip install setuptools
python -m pip install numpy
python -m pip install h5py
python -m pip install hdf5plugin

and then try to install Pylians again with

python -m pip install Pylians

Let me know

Hi Paco, thanks for the quick reply. I tried explicitly installing these (plus pyfftw and mpi4py) into a new environment, but I got the same error. I also tried installing on Google Colab, but I got the same error.

I've included the verbose error message here
python -m pip --verbose install Pylians                                                                                                                                        (painting-galaxies) 
Using pip 23.2 from /home/john/miniconda3/envs/painting-galaxies/lib/python3.10/site-packages/pip (python 3.10)
Collecting Pylians
  Using cached Pylians-0.7.tar.gz (3.2 MB)
  Running command pip subprocess to install build dependencies
  Collecting setuptools
    Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/c7/42/be1c7bbdd83e1bfb160c94b9cafd8e25efc7400346cf7ccdbdb452c467fa/setuptools-68.0.0-py3-none-any.whl.metadata
    Using cached setuptools-68.0.0-py3-none-any.whl.metadata (6.4 kB)
  Collecting Cython
    Obtaining dependency information for Cython from https://files.pythonhosted.org/packages/6f/8c/68139f464aeee699b04ec401b9de0d7e05fdd3a123c4c13429b887e16c8f/Cython-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
    Using cached Cython-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.1 kB)
  Collecting numpy
    Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/d0/55/559e6f455a066e12058330377259a106b7fefa41c15dbdb1b71070cec429/numpy-1.25.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
    Using cached numpy-1.25.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB)
  Collecting h5py
    Obtaining dependency information for h5py from https://files.pythonhosted.org/packages/0d/7a/e55589e4093cca1934db5e99644c1c2424a9b3aac104b7f6176605a5eeb7/h5py-3.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
    Using cached h5py-3.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.5 kB)
  Collecting hdf5plugin
    Obtaining dependency information for hdf5plugin from https://files.pythonhosted.org/packages/eb/68/3b62574100cc20aeaf302cc6cef866f1675163a5bf1d787b759cb700616b/hdf5plugin-4.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
    Using cached hdf5plugin-4.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.8 kB)
  Using cached setuptools-68.0.0-py3-none-any.whl (804 kB)
  Using cached Cython-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)
  Using cached numpy-1.25.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.6 MB)
  Using cached h5py-3.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB)
  Using cached hdf5plugin-4.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (40.9 MB)
  Installing collected packages: setuptools, numpy, Cython, h5py, hdf5plugin
  Successfully installed Cython-3.0.0 h5py-3.9.0 hdf5plugin-4.1.3 numpy-1.25.1 setuptools-68.0.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # RK4 example1 for debugging
  cpdef RK4_example(double[::1] yinit, double x1, double x2, long nstep):

      cdef double *result
      result =  CI.rkdumb(&yinit[0], yinit.shape[0], x1, x2, nstep,
                          NULL, NULL, 0, example)
                                         ^
  ------------------------------------------------------------

  library/integration_library/integration_library.pyx:87:39: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cpdef RK4_example2(double[::1] yinit, double x1, double x2, long nstep,
                     double[::1] a, double[::1] b):

      cdef double *result
      result =  CI.rkdumb(&yinit[0], yinit.shape[0], x1, x2, nstep,
                          &a[0], &b[0], a.shape[0], example2)
                                                    ^
  ------------------------------------------------------------

  library/integration_library/integration_library.pyx:97:50: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

      cdef long nok, nbad
      nok = nbad = 0

      CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                NULL, NULL, 0, example)
                               ^
  ------------------------------------------------------------

  library/integration_library/integration_library.pyx:110:29: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

      cdef long nok, nbad
      nok = nbad = 0

      CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                &a[0], &b[0], a.shape[0], example2)
                                          ^
  ------------------------------------------------------------

  library/integration_library/integration_library.pyx:128:40: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      cdef long nok, nbad
      nok = nbad = 0

      if function=='log' or function=='sigma':
          CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                    &a[0], &b[0], b.shape[0], sigma)
                                              ^
  ------------------------------------------------------------

  library/integration_library/integration_library.pyx:147:44: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                    &a[0], &b[0], b.shape[0], sigma)

      elif function=='linear':
          CI.odeint(&yinit[0], yinit.shape[0], x1, x2, eps, h1, hmin, &nok, &nbad,
                    &a[0], &b[0], b.shape[0], linear)
                                              ^
  ------------------------------------------------------------

  library/integration_library/integration_library.pyx:151:44: Cannot assign type 'void (double, double *, double *, double *, double *, long) except *' to 'void (*)(double, double *, double *, double *, double *, long) noexcept'
  Compiling library/MAS_library/MAS_library.pyx because it changed.
  Compiling library/Pk_library/Pk_library.pyx because it changed.
  Compiling library/Pk_library/bispectrum_library.pyx because it changed.
  Compiling library/MAS_library/field_properties.pyx because it changed.
  Compiling library/redshift_space_library/redshift_space_library.pyx because it changed.
  Compiling library/smoothing_library/smoothing_library.pyx because it changed.
  Compiling library/void_library/void_library.pyx because it changed.
  Compiling library/integration_library/integration_library.pyx because it changed.
  Compiling library/density_field_library/density_field_library.pyx because it changed.
  Compiling library/sorting_library/sorting_library.pyx because it changed.
  Compiling library/HI_library/HI_library.pyx because it changed.
  Compiling library/HI_clusters_library/HI_clusters_library.pyx because it changed.
  [ 1/12] Cythonizing library/HI_clusters_library/HI_clusters_library.pyx
  [ 2/12] Cythonizing library/HI_library/HI_library.pyx
  [ 3/12] Cythonizing library/MAS_library/MAS_library.pyx
  [ 4/12] Cythonizing library/MAS_library/field_properties.pyx
  [ 5/12] Cythonizing library/Pk_library/Pk_library.pyx
  [ 6/12] Cythonizing library/Pk_library/bispectrum_library.pyx
  [ 7/12] Cythonizing library/density_field_library/density_field_library.pyx
  [ 8/12] Cythonizing library/integration_library/integration_library.pyx
  Traceback (most recent call last):
    File "/home/john/miniconda3/envs/painting-galaxies/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/john/miniconda3/envs/painting-galaxies/lib/python3.10/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/john/miniconda3/envs/painting-galaxies/lib/python3.10/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-mezsjbx4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-mezsjbx4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-mezsjbx4/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 99, in <module>
    File "/tmp/pip-build-env-mezsjbx4/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
      cythonize_one(*args)
    File "/tmp/pip-build-env-mezsjbx4/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: library/integration_library/integration_library.pyx
  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.
  full command: /home/john/miniconda3/envs/painting-galaxies/bin/python /home/john/miniconda3/envs/painting-galaxies/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpwqakncp2
  cwd: /tmp/pip-install-bhukjp6q/pylians_88bb8be887814b3d964e4db78390e9f0
  Getting requirements to build wheel ... error
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 can successfully build Pylians with Cython==0.29.33, the issue seems to be coming from Cython 3.0.0

Using cached Cython-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)

@franciscovillaescusa Adding setup_requires = ['Cython<3.0.0'] would help to the setup.py.

Thanks @ccoulombe ! @jwuphysics can you try now? I have updated the configuration to use a cython version before 3.0. I'm still having problems installing it on google colab but it may be a different issue there. Let me know

Thank you! I'm at work using my non-linux machine but I'll get back to you in a few hours.

Splendid! Looks like it works 👍

Great! Thanks @jwuphysics for let us know about this issue with Cython that I was not aware of.