Comments (2)
@diegofz I believe this is due to a known issue when using python multiprocessing on Windows (e.g., see here).
gym-anm
uses multiprocessing to render the environment in your browser: a local server is started in the background and communicates with the main thread using websockets to update the visualization in real-time.
In order to get the rendering to work with your setup (you shouldn't have this problem if you remove the env.render()
statement), all you need to do is to guard the entry point of your code with an if __name__ == '__main__'
statement.
For example, you can rewrite the example given in the Quickstart section:
import gym
import time
env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()
for i in range(100):
a = env.action_space.sample()
o, r, done, info = env.step(a)
env.render()
time.sleep(0.5) # otherwise the rendering is too fast for the human eye.
env.close()
as follows:
import gym
import time
def run():
env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()
for i in range(100):
a = env.action_space.sample()
o, r, done, info = env.step(a)
env.render()
time.sleep(0.5) # otherwise the rendering is too fast for the human eye.
env.close()
if __name__ == '__main__':
run()
and that should do the trick. It worked for me on my Windows virtual machine.
Unfortunately I'm not sure there's a simple solution to get that to work in Jupyter Notebooks or in Collab. I would recommend you don't render the environment if you're using either of these tools.
Hope that helps!
from gym-anm.
I have been having rendering issues, where nothing shows up, just a blank screen.
Based on this closed issue, I switched from windows 10 to windows 11. Also switched from Jupyter notebook to pycharm. And I am running the code you shared. I am still getting a blank screen, How can I fix it? Both machines have decent processors and gpu capabilities.
from gym-anm.
Related Issues (10)
- ImportError while running tests HOT 2
- Deprication of np.complex HOT 1
- AttributeError: module 'numpy' has no attribute 'complex'. HOT 1
- Error closing the environment HOT 1
- Add possibility to model shunt elements in the power grid simulator HOT 1
- Running speed of large-scale nodes HOT 3
- The scalability of large-scale nodes system
- AttributeError: 'numpy.random._generator.Generator' object has no attribute 'randint' HOT 1
- Rendering Problem (Blank Screen) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gym-anm.