# Problem installing PyFR

**URL:** <https://pyfr.discourse.group/t/problem-installing-pyfr/837>\
**Category:** Errors\
**Created:** [12 June 2023 10:13 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837 "2023-06-12T10:13:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![syavash](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@syavash](https://pyfr.discourse.group/u/syavash)\
**Post date:** [12 June 2023 10:13 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/1 "2023-06-12T10:13:29Z")

</div>

Dear All,

I am new to PyFR. I tried to install it on a cluster from source code. I tried to install using the following command:  
`python setup.py install --user`

I get the following line then:

`running install /XXX/Core/python-build-bundle/2023a/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.`

Installing continues anyway and I have the following line at the end:

`Finished processing dependencies for pyfr==1.15.0`

I wonder if that means installation was successful. However, when trying to run the “2d-inc-cylinder” using the command provided in the user-guide, I get the following error:

```auto
Traceback (most recent call last):
  File "/home/syavash/.local/bin/pyfr", line 33, in <module>
    sys.exit(load_entry_point('pyfr==1.15.0', 'console_scripts', 'pyfr')())
  File "/home/syavash/.local/bin/pyfr", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Core/python/3.9.6/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/XXX/Core/python/3.9.6/lib/python3.9/importlib/ __init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/home/syavash/.local/lib/python3.9/site-packages/pyfr-1.15.0-py3.9.egg/pyfr/ __main__.py", line 14, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/home/syavash/.local/lib/python3.9/site-packages/pyfr-1.15.0-py3.9.egg/pyfr/plugins/ __init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 925, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1414, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1388, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1369, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 423, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 716, in spec_from_file_location
  File "<frozen zipimport>", line 191, in get_filename
  File "<frozen zipimport>", line 713, in _get_module_code
  File "<frozen zipimport>", line 647, in _compile_source
  File "/home/syavash/.local/lib/python3.9/site-packages/pyfr-1.15.0-py3.9.egg/pyfr/plugins/ascent.py", line 71
    match value:
          ^
SyntaxError: invalid syntax

```

Would anyone kindly provide some hint here? I have no clue about the source of problem.

Kind regards  
syavash

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [12 June 2023 11:33 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/2 "2023-06-12T11:33:32Z")

</div>

As per the user guide, PyFR requires Python 3.10 or later. You are using Python 3.9.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![syavash](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@syavash](https://pyfr.discourse.group/u/syavash)\
**Post date:** [12 June 2023 14:38 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/3 "2023-06-12T14:38:16Z")

</div>

Thanks Freddie,

I switched to python 3.10, but still getting an error:

```auto
Traceback (most recent call last):
  File "/home/syavash/.local/bin/pyfr", line 33, in <module>
    sys.exit(load_entry_point('pyfr==1.15.0', 'console_scripts', 'pyfr')())
  File "/home/syavash/.local/bin/pyfr", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/XXX/Core/python/3.10.2/lib/python3.10/importlib/metadata/ __init__.py", line 162, in load
    module = import_module(match.group('module'))
  File "/XXX/Core/python/3.10.2/lib/python3.10/importlib/ __init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/syavash/.local/lib/python3.10/site-packages/pyfr-1.15.0-py3.10.egg/pyfr/ __main__.py", line 14, in <module>
  File "/home/syavash/.local/lib/python3.10/site-packages/pyfr-1.15.0-py3.10.egg/pyfr/plugins/ __init__.py", line 10, in <module>
  File "/home/syavash/.local/lib/python3.10/site-packages/pyfr-1.15.0-py3.10.egg/pyfr/plugins/sampler.py", line 2, in <module>
  File "/home/syavash/.local/lib/python3.10/site-packages/Rtree-1.0.1-py3.10-linux-x86_64.egg/rtree/ __init__.py", line 9, in <module>
    from .index import Index, Rtree # noqa
  File "/home/syavash/.local/lib/python3.10/site-packages/Rtree-1.0.1-py3.10-linux-x86_64.egg/rtree/index.py", line 17, in <module>
    from . import core
  File "/home/syavash/.local/lib/python3.10/site-packages/Rtree-1.0.1-py3.10-linux-x86_64.egg/rtree/core.py", line 74, in <module>
    rt = finder.load()
  File "/home/syavash/.local/lib/python3.10/site-packages/Rtree-1.0.1-py3.10-linux-x86_64.egg/rtree/finder.py", line 118, in load
    raise OSError("Could not load libspatialindex_c library")
OSError: Could not load libspatialindex_c library

```

Unfortunately I can’t attach the install log file here. I appreciate your kind help.

Kind regards  
syavash

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [12 June 2023 14:55 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/4 "2023-06-12T14:55:25Z")

</div>

As per the (development head) user guide PyFR depends on the [rtree](https://rtree.readthedocs.io/en/latest/) module. You will need to have this installed and working before you can run PyFR. You can test it as:

```auto
import rtree

```

If you are having issues with the module, please follow up with their developers/open a bug report as appropriate.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![syavash](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@syavash](https://pyfr.discourse.group/u/syavash)\
**Post date:** [12 June 2023 19:38 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/5 "2023-06-12T19:38:56Z")

</div>

I tried your tip and I am getting the same error, meaning that rtree indeed is the source of problem.

I guess there is more to it. I tried different versions of python (3.10, 3.11) and downloaded [libspatialindex](https://libspatialindex.org/) but couldn’t manage to install rtree via easy\_install. Strangely, it’s fixed on python 3.7 and I wasn’t able to change it.  
I also tried to install it using pip. It was successful but I get a similar error once importing rtree:

`KeyError: 'EBROOTLIBSPATIALINDEX'`

I checked inside the “site-packages” directory and rtree is there!  
Just wanted to know, is this a common issue, to deal with rtree when installing PyFR?

Kind regards  
syavash

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [12 June 2023 20:00 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/6 "2023-06-12T20:00:50Z")

</div>

I have had no issues installing it via pip on either Linux or macOS. You may want to open an issue with the developers of rtree to see if they can provide any additional information.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![syavash](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@syavash](https://pyfr.discourse.group/u/syavash)\
**Post date:** [12 June 2023 20:26 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/7 "2023-06-12T20:26:12Z")

</div>

I see.  
Fortunately, libspatialindex was available as a module on the cluster and it saved me! Anyway, thanks for your help.  
I could fix the rtree error, now my question is how I can run 2d-inc-cylinder example in serial? My cluster is not providing GCC 12.0 so I won’t have OMP as backend.

Kind regards  
syavash

P.S: I tried cuda as backed but I am getting some error. I guess I would have to make a request for GPU core beforehand.

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [12 June 2023 20:28 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/8 "2023-06-12T20:28:48Z")

</div>

An OpenMP 5.0 capable compiler is required for the C/OpenMP backend. This is required even if you only want to run on a single core.

Ask your administrator to provide a more recent compiler.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![syavash](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@syavash](https://pyfr.discourse.group/u/syavash)\
**Post date:** [12 June 2023 20:31 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/9 "2023-06-12T20:31:25Z")

</div>

I wouldn’t think it could be a problem. The latest version is 11.3.0.  
But can I run in parallel (MPI) w/o OMP?

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [12 June 2023 20:43 UTC](https://pyfr.discourse.group/t/problem-installing-pyfr/837/10 "2023-06-12T20:43:11Z")

</div>

No. The compiler has no idea how many threads you are going to be running with and hence support is needed even if you only intend to run with a single OpenMP thread.

Regards, Freddie.
