p5py / p5

p5 is a Python package based on the core ideas of Processing.
https://p5.readthedocs.io
GNU General Public License v3.0
724 stars 120 forks source link

RuntimeError: Could not import backend "Glfw" on MacOS #314

Open ivankeller opened 3 years ago

ivankeller commented 3 years ago

Describe the bug I followed the instruction for installing p5 on MacOS. I used brew to install glfw. When importing p5 I got this error:

(p5py38) ivankeller@ivans-mbp ~ $ python
Python 3.8.10 (default, May 19 2021, 11:01:55)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import p5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ivankeller/opt/anaconda3/envs/p5py38/lib/python3.8/site-packages/p5/__init__.py", line 19, in <module>
    from .sketch import *
  File "/Users/ivankeller/opt/anaconda3/envs/p5py38/lib/python3.8/site-packages/p5/sketch/__init__.py", line 19, in <module>
    vispy.use('glfw')
  File "/Users/ivankeller/opt/anaconda3/envs/p5py38/lib/python3.8/site-packages/vispy/util/wrappers.py", line 98, in use
    use_app(app)
  File "/Users/ivankeller/opt/anaconda3/envs/p5py38/lib/python3.8/site-packages/vispy/app/_default_app.py", line 47, in use_app
    default_app = Application(backend_name)
  File "/Users/ivankeller/opt/anaconda3/envs/p5py38/lib/python3.8/site-packages/vispy/app/application.py", line 47, in __init__
    self._use(backend_name)
  File "/Users/ivankeller/opt/anaconda3/envs/p5py38/lib/python3.8/site-packages/vispy/app/application.py", line 235, in _use
    raise RuntimeError(msg)
RuntimeError: Could not import backend "Glfw":
dlopen(glfw3.framework/glfw3, 6): image not found

It seems vispy could not find glfw.

System information:

I also tried this suggestion https://github.com/p5py/p5/issues/76#issuecomment-773964526 but it did not solve the issue

github-actions[bot] commented 3 years ago

Thank you for submitting your first issue to p5py

ziyaointl commented 3 years ago

I think pip install glfw may help, but I'm not too sure.

vermi commented 3 years ago

Same issue as above, Python 3.8.7, MacOS 11.5.

Relevant output from pip freeze:

glfw==2.1.0
numpy==1.21.2
p5==0.7.1
vispy==0.8.0

I have tried both brew install glfw and brew install glfw3, and neither have resolved the error.

Package info from Homebrew:

❯ brew info glfw3
glfw: stable 3.3.4 (bottled), HEAD
Multi-platform library for OpenGL applications
https://www.glfw.org/
/usr/local/Cellar/glfw/3.3.4 (14 files, 520.9KB) *
  Poured from bottle on 2021-08-22 at 17:55:47
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/glfw.rb
tushar5526 commented 3 years ago

Maybe you can try searching in vispy forums or installation docs. Behind the hood, p5 uses vispy.

jaredmoore commented 2 years ago

This solved it for me. Adding link for context: https://github.com/vispy/vispy/issues/2213