Installing PySPH Error: Failed building wheel for cyarray

633 views
Skip to first unread message

Chaitanya Kesanapalli

unread,
Oct 19, 2023, 12:24:09 PM10/19/23
to pysph-users
Hi Guys, 

I am pysph in my local Windows and Linux system and it is work without any issues. 

But I am trying to install Pysph using the following commands in a remote Windows system. 

conda create -n pysph python=3.11 -y
conda install -c conda-forge numpy setuptools cython pytest h5py mock pytools beaker -y

But I am getting an error saying 
"        cyarray\carray.pyx:2474:27: Assignment to a read-only property
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 34, in <module>
          File "C:\Users\ckesanapalli\AppData\Local\Temp\pip-install-001bd4wd\cyarray_0e7e4371f5da47dbb46b704b0213a9ac\setup.py", line 160, in <module>
            setup_package()
          File "C:\Users\ckesanapalli\AppData\Local\Temp\pip-install-001bd4wd\cyarray_0e7e4371f5da47dbb46b704b0213a9ac\setup.py", line 105, in setup_package
            ext_modules = cythonize(
                          ^^^^^^^^^^
          File "C:\Users\ckesanapalli\AppData\Roaming\Python\Python311\site-packages\Cython\Build\Dependencies.py", line 1134, in cythonize
            cythonize_one(*args)
          File "C:\Users\ckesanapalli\AppData\Roaming\Python\Python311\site-packages\Cython\Build\Dependencies.py", line 1301, in cythonize_one
            raise CompileError(None, pyx_file)
        Cython.Compiler.Errors.CompileError: cyarray/carray.pyx
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cyarray
        Running setup.py clean for cyarray
      Failed to build cyarray
      ERROR: Could not build wheels for cyarray, which is required to install pyproject.toml-based projects
      [end of output]

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

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
"
(I have attached the complete error in a text file).

Can you tell me how to resolve this issue? Thanks
pysph_install_error.txt

Chaitanya Kesanapalli

unread,
Oct 20, 2023, 10:31:10 AM10/20/23
to pysph-users
Hi Guys, 
I resolve this issue. 

The error is due to the cython version. For now, PySPH is working for version 0.29 but not 3.0. 

To install use the following commands

conda create -n pysph -c conda-forge python numpy h5py cython==0.29 -y
conda activate pysph
pip install https://github.com/pypr/cyarray/zipball/master
pip install https://github.com/pypr/compyle/zipball/master
git clone https://github.com/pypr/pysph.git
cd pysph
pip install -r requirements.txt -r requirements-test.txt
python setup.py develop

ckesan...@gmail.com

unread,
Oct 30, 2023, 6:42:24 PM10/30/23
to pysph-users
Hi Guys, 

I am having issues with CPU parallelization with pysph using OpenMP. With OpenMP it takes longer to simulate even the test case

When I run the test command without OpenMP
pysph run elliptical_drop 
----------------------------------------------------------------------
No of particles:
  fluid: 5025
----------------------------------------------------------------------
Setup took: 0.29691 secs
100%|████████████████████| 1.1kit | 7.6e-03s [01:8.6<00:0.0 | 0.061s/it]]
Run took: 68.60419 secs
At tf=0.0076
Semi-major axis length (exact, computed) = 1.9445172415576217, 1.9244290435650304

And with OpenMP
pysph run elliptical_drop --openmp
----------------------------------------------------------------------
No of particles:
  fluid: 5025
----------------------------------------------------------------------
Setup took: 0.23633 secs
100%|████████████████████| 1.1kit | 7.6e-03s [01:41.5<00:0.0 | 0.090s/it]]
Run took: 101.54839 secs
At tf=0.0076
Semi-major axis length (exact, computed) = 1.9445172415576217, 1.9244290435650304

System Details:
Processor Intel(R) Xeon(R) CPU @ 2.20GHz, 2200 Mhz, 8 Core(s), 16 Logical Processor(s)
Installed RAM 16.0 GB
System type 64-bit operating system, x64-based processor

Installation Commands: 
conda create -n pysph -c conda-forge python numpy h5py cython==0.29.36 -y

conda activate pysph
pip install https://github.com/pypr/cyarray/zipball/master
pip install https://github.com/pypr/compyle/zipball/master
git clone https://github.com/pypr/pysph.git
cd pysph
pip install -r requirements.txt -r requirements-test.txt
python setup.py develop

Can you provide alternative installation instructions for CPU-parallelized PySPH? 

Thanks a lot. 

Prabhu Ramachandran

unread,
Oct 31, 2023, 9:03:40 AM10/31/23
to ckesan...@gmail.com, pysph-users
Hi all,

Yes, there have been upstream changes in cython that are causing these. I need to make some time to set this right in the various repositories and push new releases to ease the installation process. Python 3.12 is also going to be a bit of a problem I imagine.

In the meanwhile, make sure that you do `pip install <xyz> --no-build-isolation`, otherwise what happens is that pip will pull the latest cython when it builds the package.

cheers,
Prabhu
--
You received this message because you are subscribed to the Google Groups "pysph-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pysph-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pysph-users/8a060207-76bf-4c64-8c93-a7ef17b15cfdn%40googlegroups.com.

ckesan...@gmail.com

unread,
Oct 31, 2023, 12:23:19 PM10/31/23
to pysph-users
Thanks a lot, Prabhu, 
Finally, I was able to resolve it. 

Here are the installation commands (Currently VTK requires Python <= 3.11)

conda create -n pysph -c conda-forge python=3.11 cython=0.29.36 numpy setuptools mako pytools pytest beaker mock h5py matplotlib mpi4py -y
conda activate pysph
pip install vtk
pip install https://github.com/pypr/cyarray/zipball/master --no-build-isolation
pip install https://github.com/pypr/compyle/zipball/master --no-build-isolation
pip install https://github.com/pypr/pysph/zipball/master --no-build-isolation

Test case: 
System Information
Processor AMD Ryzen Threadripper PRO 5955WX 16-Cores, 4001 Mhz, 16 Core(s), 32 Logical Processor(s)

When I run the test command without OpenMP
pysph run elliptical_drop 
----------------------------------------------------------------------
No of particles:
  fluid: 5025
----------------------------------------------------------------------
Setup took: 4.35327 secs

100%|████████████████████| 1.1kit | 7.6e-03s [01:8.6<00:0.0 | 0.061s/it]]
Run took: 27.58093 secs

At tf=0.0076
Semi-major axis length (exact, computed) = 1.9445172415576217, 1.9244290435650304

And with OpenMP
pysph run elliptical_drop --openmp
----------------------------------------------------------------------
No of particles:
  fluid: 5025
----------------------------------------------------------------------
Setup took: 0.09302 secs

100%|████████████████████| 1.1kit | 7.6e-03s [01:41.5<00:0.0 | 0.090s/it]]
Run took: 2.71744 secs

At tf=0.0076
Semi-major axis length (exact, computed) = 1.9445172415576217, 1.9244290435650304

ckesan...@gmail.com

unread,
Oct 31, 2023, 1:05:56 PM10/31/23
to pysph-users
Also, I would like to mention that 

If you install PySPH with python 3.12, you will probably get error saying 
ModuleNotFoundError: No module named 'imp'

This is because pyximport module of cython=0.29.x uses the imp module which is deprecated in Python 3.12. So, we need to use Python <=3.11 for PySPH until it is updated to Cython=3.0.x.

Luca Maggioni

unread,
Jul 23, 2024, 4:30:49 AM (4 days ago) Jul 23
to pysph-users
Hi guys,

I tried to follow your procedure, but it does not work. I get the following error when I try to install pysph:

###############################################################################################################

[12/20] Cythonizing pysph/base/point.pyx

      Traceback (most recent call last):
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/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/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/setuptools/build_meta.py", line 368, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/setuptools/build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 782, in <module>
        File "<string>", line 723, in setup_package
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1115, in cythonize
          cythonize_one(*args)
        File "/home/luca/miniconda3/envs/pysph/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1238, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: pysph/base/point.pyx

      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

#################################################################################################################

I also thought that the error was due to the fact that I have not installed pyzoltan. However, if I try to install it using:

pip install https://github.com/pypr/pyzoltan/zipball/master --no-build-isolation

I get this error:

######################################################################

error: subprocess-exited-with-error
 
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      ********************************************************************************
      Zoltan Environment variable not set, not using ZOLTAN!
      ********************************************************************************

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-v9vx_ge_/setup.py", line 423, in <module>
          setup_package()
        File "/tmp/pip-req-build-v9vx_ge_/setup.py", line 369, in setup_package
          raise RuntimeError(
      RuntimeError: There are no extension modules, Nothing to do!

      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for PyZoltan
  Running setup.py clean for PyZoltan
Failed to build PyZoltan
ERROR: Could not build wheels for PyZoltan, which is required to install pyproject.toml-based projects

#########################################################################

Can you tell me how to solve this issue?
Thanks a lot!
Luca
Reply all
Reply to author
Forward
0 new messages