'GLXPlatform' object has no attribute 'WGL' - python

I'm a beginner in OpenGL/OpenCL.
I'm trying to execute code from this
example, but there is an error:
Traceback (most recent call last):
File "/home/anka-rybalko/workspace/bla/openGL.py", line 99, in initializeGL
self.initialize_buffers()
File "/home/anka-rybalko/workspace/bla/openGL.py", line 61, in initialize_buffers
self.ctx, self.queue = clinit()
File "/home/anka-rybalko/workspace/bla/openGL.py", line 37, in clinit
+ get_gl_sharing_context_properties())
File "/usr/lib64/python2.7/site-packages/pyopencl-2014.1-py2.7-linux-x86_64.egg/pyopencl/tools.py", line 422, in get_gl_sharing_context_properties
from OpenGL import platform as gl_platform, GLX, WGL
File "/usr/lib/python2.7/site-packages/OpenGL/WGL/__init__.py", line 1, in <module>
from OpenGL.raw.WGL.VERSION.WGL_1_0 import *
File "/usr/lib/python2.7/site-packages/OpenGL/raw/WGL/VERSION/WGL_1_0.py", line 48, in <module>
#_p.types(_cs.c_int,_cs.HDC,ctypes.POINTER(_cs.PIXELFORMATDESCRIPTOR))
File "/usr/lib/python2.7/site-packages/OpenGL/raw/WGL/VERSION/WGL_1_0.py", line 13, in _f
return _p.createFunction( function,_p.PLATFORM.WGL,'WGL_VERSION_WGL_1_0',error_checker=_errors._error_checker)
AttributeError: 'GLXPlatform' object has no attribute 'WGL'
As I understand, WGL is an API for Windows OS and not for Linux. Should I somehow specify my platform before? Or how can I fix this?
Thanks in advance!

The code you are using (PyOpenGL 2014.1) is importing two platform-specific modules (WGL and GLX). PyOpenGL should have raised that error as an ImportError (rather than the AttributeError), but it still would have failed.
PyOpenCL has, in the meantime, worked around the issue in their github repository. If you have git installed (and pip) then this should get you a new version (note: not set up for OpenCL development here, so can't actually test this):
pip install git+https://github.com/pyopencl/pyopencl#egg=pyopencl

Related

ModuleNotFoundError: No module named 'nvidia.dali.backend_impl' when running nvidia/deeplearningexamples reponstory

run rn50 scripts in NVIDIA/DeepLearningExamples, as
./rn50_partial.sh
get error like this:
Traceback (most recent call last):
File "/export/nfs/sunxue/DeepLearningExamples/PyTorch/Classification/ConvNets/mnasnet/training/FP32/../../../launch.py", line 7, in <module>
from main import main, add_parser_arguments, available_models
File "/export/nfs/sunxue/DeepLearningExamples/PyTorch/Classification/ConvNets/main.py", line 49, in <module>
from image_classification.dataloaders import *
File "/export/nfs/sunxue/DeepLearningExamples/PyTorch/Classification/ConvNets/image_classification/dataloaders.py", line 79, in <module>
class HybridTrainPipe(Pipeline):
NameError: name 'Pipeline' is not defined
ok, I've solved this, cause NVIDIA does not classify the specific installation, actually, it does not have to install from scratch, if you use pip install, just check which version NVIDIA docker use and download this specific version, pip install, and everything will be ok.

Why python software package does not run under WSL2?

I wanted to use WSL2 Ubuntu to run some scientific programs on my PC (Phenix package). It used to work previously on wsl but after recent update to wsl2 one of the programs written in Python has some problems:
Traceback (most recent call last):
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/build/../modules/phenix/wxGUI2/command_line/main.py", line 23, in <module>
run(sys.argv[1:])
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/build/../modules/phenix/wxGUI2/command_line/main.py", line 16, in run
from wxGUI2 import App
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/modules/phenix/wxGUI2/App.py", line 7, in <module>
from SimpleXMLRPCServer import SimpleXMLRPCServer
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/conda_base/lib/python2.7/SimpleXMLRPCServer.py", line 105, in <module>
import BaseHTTPServer
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/conda_base/lib/python2.7/BaseHTTPServer.py", line 102, in <module>
class HTTPServer(SocketServer.TCPServer):
AttributeError: 'module' object has no attribute 'TCPServer'
I have checked all the packages (BaseHTTPServer, SocketServer) and everything seems to be fine. Using python provided with the package and importing modules separately also works without errors. My previous computer also with WSL2 was running this software package without any issues. I believe that there is something missing on the wsl2 Ubuntu level but cannot guess what it is. Do you have any suggestions what I could try to do? Thanks!

Google cloud sdk not working when python points python3

I am currently trying to install google cloud sdk on my macbook. I am using scikit-learn and anaconda for machine learning so on my laptop python points to python3.5. However google cloud sdk requires python 2.7 for installation, and that's why I am facing the problem of not be able to install it.
when I ran the install.sh file the error occurred and I have no clue how to deal with it:
Adam | ~ $ git/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/AdamLiu/Git/google-cloud-sdk/lib/third_party/enum/__init__.py", line 364, in __getattr__
return cls._member_map_[name]
KeyError: '_convert'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/AdamLiu/git/google-cloud-sdk/bin/bootstrapping/install.py", line 8, in <module>
import bootstrapping
File "/Users/AdamLiu/Git/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 9, in <module>
import setup
File "/Users/AdamLiu/Git/google-cloud-sdk/bin/bootstrapping/setup.py", line 34, in <module>
from googlecloudsdk.core.util import platforms
File "/Users/AdamLiu/Git/google-cloud-sdk/lib/googlecloudsdk/core/util/platforms.py", line 18, in <module>
import platform
File "/Users/AdamLiu/anaconda/lib/python3.5/platform.py", line 117, in <module>
import sys, os, re, subprocess
File "/Users/AdamLiu/anaconda/lib/python3.5/subprocess.py", line 364, in <module>
import signal
File "/Users/AdamLiu/anaconda/lib/python3.5/signal.py", line 8, in <module>
_IntEnum._convert(
File "/Users/AdamLiu/Git/google-cloud-sdk/lib/third_party/enum/__init__.py", line 366, in __getattr__
raise AttributeError(name)
AttributeError: _convert
Super thanks in advance!
Set the CLOUDSDK_PYTHON environment variable to the location of your Python 2.x executable before running install.sh.
Or make sure that you have python2 in your path so that which python2 can find it.

Using python-zxcvbn in Python 3.4

I have been using the zxcvbn, which is a great piece of programming.
Especially, the port python-zxcvbn has been perfect for a small project I am doing.
Despite this, I am trying to invoke python-zxcvbn from Python 3.4 and I get errors like this:
Traceback (most recent call last):
File "entropy.py", line 7, in <module>
from zxcvbn import password_strength
File "/usr/lib/python3.4/site-packages/zxcvbn/__init__.py", line 1, in <module>
from zxcvbn import main
File "/usr/lib/python3.4/site-packages/zxcvbn/main.py", line 3, in <module>
from zxcvbn.matching import omnimatch
File "/usr/lib/python3.4/site-packages/zxcvbn/matching.py", line 89, in <module>
_load_frequency_lists()
File "/usr/lib/python3.4/site-packages/zxcvbn/matching.py", line 67, in _load_frequency_lists
dicts = json.loads(data)
File "/usr/lib/python3.4/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
I have tried both installing the library from github, and with pip, with the same result.
To avoid that, I am currently running python2 in the module that uses zxcvbn, but I'd like to have a cleaner version of my project which runs fully with Python 3.4.
Is anyone successfully using python-zxcvbn with Python 3.4?
As answered by unutbu, there is a fork on github by moreati that is compatible with Python 3.4. It worked flawlessly for me.
https://github.com/moreati/python-zxcvbn

How can I install 'sphinxext module' in IPython

I tried to install pygments-ipython-console.
In requirements it says:
This needs IPython 1.0+ for sphinxext module
How can I install this module?
I dont find anything in my packet manager (yum).
The following error indicates that the module is not installed:
An error occurred in an add-on.
Please post on the add-on forum:
https://anki.tenderapp.com/discussions/add-ons
Traceback (most recent call last):
File "/usr/share/anki/aqt/addons.py", line 39, in loadAddons
__import__(file.replace(".py", ""))
File "/home/cmueller/Anki/addons/Syntax Highlighting for Code.py", line 2, in <module>
import code_highlight_addon.code_highlight_addon
File "/home/cmueller/Anki/addons/code_highlight_addon/code_highlight_addon.py", line 211, in <module>
for lex in get_all_lexers():
File "/home/cmueller/Anki/addons/code_highlight_addon/pygments/lexers/__init__.py", line 45, in get_all_lexers
for lexer in find_plugin_lexers():
File "/usr/lib/python2.7/site-packages/pygments/plugin.py", line 53, in find_plugin_lexers
yield entrypoint.load()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "build/bdist.linux-x86_64/egg/lexer.py", line 4, in <module>
ImportError: No module named sphinxext.ipython_console_highlighting
Thanks to pokoli I realized that my version was not recent enough.
In the README of pygments-ipython-console it still says version 1.0+ is required, that's a mistake.
I have now updated to version 2.2 but still got an Error:
ImportError: cannot import name IPythonConsoleLexer.
That is because there was a renaming in IPython. There is a fork in the pygments-ipython-console repository where this is fixed. So I had to clone the forked repository instead of the initial one.
I reinstalled according to the readme and now everything works fine.

Categories

Resources