Failed to create GLFW Window while trying to run Mujoco (UBUNTU) - reinforcement-learning

So, I am trying to install, and run Mujoco-py on my ubuntu. Everything went well but, I cant install the libglew1.5. I searche for it in the Ubuntu Package Archives, but no luck. Then I skipped that part, but when im trying to run the example its giving me this error.
(mujoco_py) user#user:~/.mujoco/mujoco-py/examples$ python3 setting_state.py
Creating window glfw
libEGL warning: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
GLFW error (code %d): %s 65542 b'EGL: Failed to initialize EGL: EGL is not or could not be initialized'
Traceback (most recent call last):
File "setting_state.py", line 32, in <module>
viewer = MjViewer(sim)
File "/home/sazzad14/.mujoco/mujoco-py/mujoco_py/mjviewer.py", line 137, in __init__
super().__init__(sim)
File "/home/sazzad14/.mujoco/mujoco-py/mujoco_py/mjviewer.py", line 28, in __init__
super().__init__(sim)
File "mjrendercontext.pyx", line 311, in mujoco_py.cymj.MjRenderContextWindow.__init__
File "mjrendercontext.pyx", line 46, in mujoco_py.cymj.MjRenderContext.__init__
File "mjrendercontext.pyx", line 102, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
File "opengl_context.pyx", line 48, in mujoco_py.cymj.GlfwContext.__init__
File "opengl_context.pyx", line 99, in mujoco_py.cymj.GlfwContext._create_window
mujoco_py.cymj.GlfwError: Failed to create GLFW window
I installed libglew2.2, but that does not help.

Related

i cant add text to my project i just need [duplicate]

The game is running fine from source code. When I used cx_Freeze to compile the binary file on the Linux I got into error on the second machine:
~/tmp/exe.linux-x86_64-2.7 $ ./rungame
/home/local/tmp/exe.linux-x86_64-2.7/library.zip/lib/MenuItem.py:13: RuntimeWarning: use font: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory
(ImportError: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory)
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
File "rungame.py", line 10, in <module>
File "/lib/gameloop.py", line 13, in <module>
File "/lib/settings.py", line 10, in <module>
File "/lib/menuitem.py", line 13, in <module>
File "/usr/lib64/python2.7/site-packages/pygame/__init__.py", line 74, in __getattr__
NotImplementedError: font module not available
(ImportError: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory)
On the machine where I compile the binary it runs fine. Could someone advice me.
Run this : sudo apt-get install libsdl-ttf2.0-0

Unable to start rst2html5slides after installation

We are using Powerpoint and Restructured Text together with Python-Sphinx. I was asking myself, if it is possible to create slides using ReST.
I found the interesting Tool rst2html5slides on
https://rst2html5slides.readthedocs.io/en/latest/index.html.
I installed the tool with:
pip install rst2html5slides
This worked without problems.
Now, I was unable to use the tool. Typing rst2html5slides on my console gives:
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\rst2html5slides.exe\__main__.py", line 5, in <module>
File "c:\python27\lib\site-packages\rst2html5slides.py", line 16, in <module>
from rst2html5 import HTML5Translator, HTML5Writer
ImportError: No module named rst2html5
Typing pip list issues:
rst2html5 1.9.4
rst2html5slides 1.0
After inspecting my c:\python27\lib\site-packages\ directory I found out, that there is an rst2html5slides_.py, but no rst2html5slides.py. So I tried to just rename this file.
No it was possible for me to start rst2html5slides --traceback presentation.txt simple_deck.html, but I just have another problem.
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\rst2html5slides.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\rst2html5slides.py", line 484, in main
publish_cmdline(writer=SlideWriter(), description=description)
File "c:\python27\lib\site-packages\docutils\core.py", line 352, in publish_cmdline
config_section=config_section, enable_exit_status=enable_exit_status)
File "c:\python27\lib\site-packages\docutils\core.py", line 219, in publish
output = self.writer.write(self.document, self.destination)
File "c:\python27\lib\site-packages\docutils\writers\__init__.py", line 80, in write
self.translate()
File "c:\python27\lib\site-packages\rst2html5slides.py", line 200, in translate
HTML5Writer.translate(self)
File "c:\python27\lib\site-packages\rst2html5.py", line 227, in translate
self.document.walkabout(visitor)
File "c:\python27\lib\site-packages\docutils\nodes.py", line 187, in walkabout
visitor.dispatch_departure(self)
File "c:\python27\lib\site-packages\docutils\nodes.py", line 1895, in dispatch_departure
return method(node)
File "c:\python27\lib\site-packages\rst2html5slides.py", line 294, in depart_document
self._ordered_tag_attributes(deck,
AttributeError: SlideTranslator instance has no attribute '_ordered_tag_attributes'
AttributeError: SlideTranslator instance has no attribute '_ordered_tag_attributes'
Exiting due to error. Use "--traceback" to diagnose.
Please report errors to <docutils-users#lists.sf.net>.
Include "--traceback" output, Docutils version (0.12 [release]),
Python version (2.7.10), your OS type & version, and the
command line used.
What I'm doing wrong here?
rst2html5slides' author here. I've updated the package a while ago. Please, update it and it should run.

Python unable to detect file, throws an error

I run a cocos2dx to generate an APK file, but it throws out this error
BUILD SUCCESSFUL in 7m 49s
54 actionable tasks: 3 executed, 51 up-to-date
Traceback (most recent call last):
File "/cocos2dx/tools/cocos2d-console/bin/cocos.py", line 1072, in <module>
run_plugin(command, argv, plugins)
File "/cocos2dx/tools/cocos2d-console/bin/cocos.py", line 961, in run_plugin
plugin.run(argv, dependencies_objects)
File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 1646, in run
self.build_android()
File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 581, in build_android
self.apk_path = builder.do_build_apk(build_mode, self._no_apk, output_dir, self._custom_step_args, self._ap, self)
File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/build_android.py", line 669, in do_build_apk
shutil.copy(gen_apk_path, output_dir)
File "/usr/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk
Any idea what could be the issue?
You should use Android Studio (instead of run the python function to call ANT) to build the project to apk. It's far easier use, trace error and debug.
about your question:
/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk
this path is belong to project Android Studio. In my experience, when using the cocos console command, it use proj.android instead of proj.android-studio

selenium.common.exceptions.WebDriverException: Message: Service

I had a trouble when i use selenium to control my Chrome.
Here is my code:
from selenium import webdriver
driver = webdriver.Chrome()
When i tried to operate it ,it runs successfully at first,the Chrome pop on the screen. However, it shut down at the few seconds.
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\chrome.exe')
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
self.assert_process_still_running()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\chrome.exe unexpectedly exited. Status code was: 0
You need to provide the path of chromedriver...download from http://chromedriver.storage.googleapis.com/index.html?path=2.24/...unzip it and provide path to it in... webdriver.chrome ("path to chromedriver")
I explain the things here:
from selenium import webdriver
driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
This is the error if i run the above code:
C:\Python27\python.exe C:/Users/Gaurav.Gaurav-PC/PycharmProjects/Learning/StackOverflow/SeleniumQuestion/test123.py
Traceback (most recent call last):
File "C:/Users/Gaurav.Gaurav-PC/PycharmProjects/Learning/StackOverflow/SeleniumQuestion/test123.py", line 4, in <module>
driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
self.assert_process_still_running()
File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google
\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
Which is same as mentioned by #Weiziyoung in original problem.
The solution is as I mentioned you need to provide the path to chromedriver in place of chrome browser like
driver = webdriver.Chrome("E:\Jars\chromedriver.exe")
It will resolve the problem
Download the appropriate driver:http://chromedriver.storage.googleapis.com/index.html
turn up E:\Python37\Scripts <--Paste the chromedriver.exe file in
i faced the same error (behave.step_registry.AmbiguousStep: #given('Lunch chrome Browser') has already been defined in existing step #given('Lunch chrome Browser') at features/steps/OrangeHRMlogin.py:4). i think it takes previous program where it mentioned "Lunch chrome browser". so i did some changes like in 2nd program i cahnged at (U'chrome browser').change the browser name or the Phase and it runs successfully.
the original chrome browser is opened instead of chrome driver that's the reason of that error download chrome driver and give it's path

Pyramid, Python3, SQLAlchemy and MySQL

I want Pyramid, Python3, SQLAlchemy and MySQL to play nice on a single machine. This question has been asked before, but it was a long enough time ago that I'm hoping the answer has changed...
Questions:
What driver works for getting a Python 3 Pyramid app to talk nicely to MySQL via SQLAalchemy? Is this even possible?
I've gotten quite far in this project thinking it would be a simple thing to switch out databases, now I'm a bit stuck and downgrading to Python 2.7 is not something I want to have to go through. So my second question is:
If there is no way to talk to MySQL nicely without downgrading, is there a database that Python 3 is ready for (besides SQLite)?
Or lastly, how would I overcome any of the problems mentioned in the 'Stuff I've Tried' section below?
Stuff I've Tried:
PyMySQL
I have PyMySQL installed and I even got it to complain about incorrect passwords and a missing database so it's getting something right. But when I tried to initialize my database (using initialize_foo_db) everything went sour:
2013-02-06 17:18:31,282 INFO [sqlalchemy.engine.base.Engine][MainThread] b'SELECT DATABASE()'
2013-02-06 17:18:31,282 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
Traceback (most recent call last):
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/pool.py", line 719, in _do_get
return self._pool.get(wait, self._timeout)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/util/queue.py", line 137, in get
raise Empty
sqlalchemy.util.queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "../bin/initialize_mega_db", line 9, in <module>
load_entry_point('mega==0.0', 'console_scripts', 'initialize_mega_db')()
File "/home/sheena/MegaCatalogue/env/mega/mega/scripts/initializedb.py", line 46, in main
Base.metadata.create_all(engine)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/schema.py", line 2567, in create_all
tables=tables)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/base.py", line 2301, in _run_visitor
conn = self.contextual_connect(close_with_result=False)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/base.py", line 2492, in contextual_connect
self.pool.connect(),
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/pool.py", line 224, in connect
return _ConnectionFairy(self).checkout()
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/pool.py", line 387, in __init__
rec = self._connection_record = pool._do_get()
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/pool.py", line 741, in _do_get
con = self._create_connection()
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/pool.py", line 188, in _create_connection
return _ConnectionRecord(self)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/pool.py", line 273, in __init__
pool.dispatch.first_connect.exec_once(self.connection, self)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/event.py", line 279, in exec_once
self(*args, **kw)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/event.py", line 288, in __call__
fn(*args, **kw)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/strategies.py", line 168, in first_connect
dialect.initialize(c)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/dialects/mysql/base.py", line 1999, in initialize
default.DefaultDialect.initialize(self, connection)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/default.py", line 177, in initialize
self._get_default_schema_name(connection)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/dialects/mysql/base.py", line 1964, in _get_default_schema_name
return connection.execute('SELECT DATABASE()').scalar()
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/base.py", line 1449, in execute
params)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/base.py", line 1628, in _execute_text
statement, parameters
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/base.py", line 1691, in _execute_context
context)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/SQLAlchemy-0.7.8-py3.2.egg/sqlalchemy/engine/default.py", line 333, in do_execute
cursor.execute(statement, parameters)
File "/home/sheena/MegaCatalogue/env/local/lib/python3.2/site-packages/PyMySQL3-0.5-py3.2.egg/pymysql/cursors.py", line 108, in execute
query = query % escaped_args
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'
oursql
I tried installing oursql using pip install -r file
where file contains:
#oursql==0.9.3 but need special Python 3 build https://bugs.launchpad.net/oursql/+bug/1051512
https://launchpad.net/oursql/py3k/py3k-0.9.3/+download/oursql-0.9.3.zip
pyramid==1.3.4
And I got:
oursqlx/compat.h:13:19: fatal error: mysql.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
myconnpy
This installs without error but I can't seem to find out what I should tell SQLAlchemy to look for. In the appropriate settings.ini file I have tried:
sqlalchemy.url = mysql+myconnpy://...
as well as a bunch of other things. Google is failing me on this one...
UPDATE - a semblance of progress
I've managed to install oursql build dependencies:
sudo aptitude install python-pip libmysqlclient-dev
I then downloaded oursql0.9.3 and ran:
setup.py install
The output was this:
cython not found, using previously-cython'd .c file.
running install
running build
running build_ext
running install_lib
copying build/lib.linux-x86_64-3.2/oursql.cpython-32mu.so -> /home/sheena/MegaCatalogue/env/lib/python3.2/site-packages
running install_egg_info
Writing /path/to/virtualenv/foo/lib/python3.2/site-packages/oursql-0.9.3.egg-info
I opened a shell and apparently the module doesn't exist - it can't be imported anyway. But for some reason it is listed if I say help() then modules