hsayama / pycx Goto Github PK
View Code? Open in Web Editor NEWPyCX is a Python-based sample code repository for complex systems research and education.
License: Other
PyCX is a Python-based sample code repository for complex systems research and education.
License: Other
The application screen freezes on Ubuntu 18.04.2 LTS OS when I run it (python 3.6.9)
But it smoothly runs on Windows OS, I haven' tested it on Mac OS.
I'm on a MacOS M1 machine and getting the following error when trying to run the simulator. It seems this is an issue related to PyQt5
and the Mac M1 chip
Before posting I've tried everything in these SO threads but nothing works for me yet.
Issue
pycx.GUI().start(func=[initialize, observe, update])
Here's the full error
Traceback (most recent call last):
File "/Users/christian/Projects/ssie-641-advanced-topics-network-science/notebooks/net-SIS-adaptive-HW3.py", line 202, in <module>
pycx.GUI().start(func=[initialize, observe, update])
File "/Users/christian/Projects/ssie-641-advanced-topics-network-science/notebooks/../packages/pycxsimulator.py", line 288, in start
self.drawModel()
File "/Users/christian/Projects/ssie-641-advanced-topics-network-science/notebooks/../packages/pycxsimulator.py", line 269, in drawModel
self.modelFigure = plt.figure() #SM 3/26/2020
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/_api/deprecation.py", line 454, in wrapper
return func(*args, **kwargs)
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/pyplot.py", line 783, in figure
manager = new_figure_manager(
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/pyplot.py", line 358, in new_figure_manager
_warn_if_gui_out_of_main_thread()
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/pyplot.py", line 336, in _warn_if_gui_out_of_main_thread
if _get_required_interactive_framework(_get_backend_mod()):
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/pyplot.py", line 207, in _get_backend_mod
switch_backend(dict.__getitem__(rcParams, "backend"))
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/pyplot.py", line 265, in switch_backend
backend_mod = importlib.import_module(
File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/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 "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/backends/backend_qt5agg.py", line 7, in <module>
from .backend_qtagg import ( # noqa: F401, E402 # pylint: disable=W0611
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/backends/backend_qtagg.py", line 9, in <module>
from .qt_compat import QT_API, _enum, _setDevicePixelRatio
File "/Users/christian/.env/ds-base/lib/python3.10/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
raise ImportError(
ImportError: Failed to import any of the following Qt binding modules: PyQt6, PySide6, PyQt5, PySide2
I've tried to reinstall the PyQt6
, PySide6
, PyQt5
, PySide2
modules
PyQt6
(ds-base) christian@Christians-MacBook-Pro notebooks % python3 -m pip install PyQt6
Requirement already satisfied: PyQt6 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (6.4.0)
Requirement already satisfied: PyQt6-Qt6>=6.4.0 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PyQt6) (6.4.1)
Requirement already satisfied: PyQt6-sip<14,>=13.4 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PyQt6) (13.4.0)
PySide6
(ds-base) christian@Christians-MacBook-Pro notebooks % python3 -m pip install PyQt6
Requirement already satisfied: PyQt6 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (6.4.0)
Requirement already satisfied: PyQt6-Qt6>=6.4.0 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PyQt6) (6.4.1)
Requirement already satisfied: PyQt6-sip<14,>=13.4 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PyQt6) (13.4.0)
(ds-base) christian@Christians-MacBook-Pro notebooks % python3 -m pip install PySide6
Requirement already satisfied: PySide6 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (6.4.1)
Requirement already satisfied: shiboken6==6.4.1 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PySide6) (6.4.1)
Requirement already satisfied: PySide6-Addons==6.4.1 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PySide6) (6.4.1)
Requirement already satisfied: PySide6-Essentials==6.4.1 in /Users/christian/.env/ds-base/lib/python3.10/site-packages (from PySide6) (6.4.1)
Hi Dr. Sayama,
I am trying to run pycxsimulator.py
for SIR model simulation using Spyder. However, I am receiving the following error:
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'qt5' is currently running
I also did this: "Note for Spyder users: Dynamic simulations may cause a conflict with Spyder's own graphics backend. In such a case, go to "Run" -> "Configuration per file" and select "Execute in an external system terminal"." But, I received the following error:
Traceback (most recent call last):
File "G:\My Drive\GitHub\Other-Research-Items\PyCX\net-voter.py", line 30, in <module>
pycxsimulator.GUI().start(func=[initialize, observe, update])
File "G:\My Drive\GitHub\Other-Research-Items\PyCX\pycxsimulator.py", line 276, in start
self.modelInitFunc()
File "G:\My Drive\GitHub\Other-Research-Items\PyCX\net-voter.py", line 13, in initialize
g.node[i]['state'] = choice(range(k))
AttributeError: 'Graph' object has no attribute 'node'
Could you please help me with this?
Regards,
Mehmet
As of v3.8.1 (or perhaps earlier), the following raises an error:
warnings.filterwarnings("ignore", category = matplotlib.cbook.MatplotlibDeprecationWarning)
AttributeError: module 'matplotlib.cbook' has no attribute 'MatplotlibDeprecationWarning'
The following adjustment may work for multiple versions of Matplotlib:
try: warnings.filterwarnings("ignore", category = matplotlib.cbook.MatplotlibDeprecationWarning) except: warnings.filterwarnings("ignore", category = matplotlib.MatplotlibDeprecationWarning)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.