I'm trying to make lesson18.py from the pyOpenGL examples into an exe but when compiled it gives this error:
Traceback (most recent call last):
File "<string>", line 46, in <module>
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.GL", line 3, in <m
odule>
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.GL.VERSION.GL_1_1"
, line 10, in <module>
File "C:\pyinstaller-1.5.1\iu.py", line 477, in importHook
mod = self.doimport(nm, ctx, ctx+'.'+nm)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays", line 22,
in <module>
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.formathandl
er", line 28, in loadAll
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.formathandl
er", line 35, in loadPlugin
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.plugins", line 14,
in load
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.plugins", line 28,
in importByName
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.vbo", line
430, in <module>
AttributeError: 'module' object has no attribute 'GL_READ_WRITE'
Press any key to continue . . .
This happens with all programs(including my own) that use pyOpenGL, the error is the same.
Are there any additional tricks(imports, etc.) to make a working executable with pyInstaller(I know there are with py2exe, but I prefer pyInstaller)?
My python version is 2.7
pyOpenGL ver.: 3.0.2a5
pyinstaller ver.: 1.5.1
I found out a solution to this particular issue!
It is about the PyOpenGL version. Pyinstaller works fine with PyOpenGL version 3.0.1b1
You can download it here:
http://sourceforge.net/projects/pyopengl/files/PyOpenGL/ and compile it yourself. Dont forget to remove your old PyOpenGL version from site-packages folder! You can check for active version of PyOpenGL on your system executing following:
>>>import pkg_resources
>>>pkg_resources.get_distribution("PyOpenGL").version
>>>'3.0.1b1'
Related
Hello I am Creating A New Jupyter Note Book For The First Time Following This Documentation
I typed
jupyter notebook
and this is the error that i got
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py", line 27, in <module>
import resource
ModuleNotFoundError: No module named 'resource'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\josti\AppData\Local\Programs\Python\Python38-32\Scripts\jupyter-notebook.EXE\__main__.py", line 7, in <module>
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1368, in initialize
self.init_webapp()
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1156, in init_webapp
self.web_app = NotebookWebApplication(
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 151, in __init__
settings = self.init_settings(
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 263, in init_settings
nbextensions_path=jupyter_app.nbextensions_path,
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 874, in nbextensions_path
from IPython.paths import get_ipython_dir
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\terminal\ipapp.py", line 30, in <module>
from IPython.core.magics import ScriptMagics
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\core\magics\__init__.py", line 21, in <module>
from .execution import ExecutionMagics
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\core\magics\execution.py", line 46, in <module>
from IPython.utils.timing import clock, clock2
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py", line 64, in <module>
clocku = clocks = clock = time.clock
AttributeError: module 'time' has no attribute 'clock'
I tried to
pip3 install --upgrade pip
Even tho i have the latest version of PIP
install resource
pip install resource
and it did not work
module 'time' has no attribute 'clock'
Are you using Python 3.8? This appears to be an issue with Python 3.8. I would suggest reverting to a older version of Python (3.7 works fine) until the libraries are resolved.
Reference:
AttributeError: module 'time' has no attribute 'clock' in Python 3.8
https://github.com/jupyter/notebook/issues/5272
I'm working on a Rally reporting tool for my team in Python, and I'm trying to package it using cx-freeze. I'm getting a ModuleNotFound error, and I'm wondering if it's because pygal isn't supported by cx-freeze (really hoping this isn't the case because I'd have to rewrite a lot of things)
celinaperalta$ /Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyGUI ; exit;
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
module.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
exec(code, {'__name__': '__main__'})
File "RallyGUI.py", line 8, in <module>
File "/Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyReportTool.py", line 7, in <module>
import pygal
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygal/__init__.py", line 28, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 959, in <module>
class Environment:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 963, in Environment
self, search_path=None, platform=get_supported_platform(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 190, in get_supported_platform
plat = get_build_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 395, in get_build_platform
plat = get_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 675, in get_platform
get_config_vars(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 551, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 422, in _init_posix
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_darwin_darwin'
cx_freeze does not include all the packages automatically. When you find ModuleNotFoundError, you need to inlcude the module explicitly in your setup like -
build_exe_options = {'packages': ['_sysconfigdata_m_darwin_darwin']}
I'm working with ubuntu, and it gives following error
Traceback (most recent call last):
File "SMAPylModules/SMAPylDriverPy.m/src/licensing.py", line 559, in <module>
File "SMAPylModules/SMAPylDriverPy.m/src/application.py", line 151, in run
File "SMAPylModules/SMAPylDriverPy.m/src/licensing.py", line 155, in execute
File "SMAPylModules/SMAPylDriverPy.m/src/licensing.py", line 228, in runCurrentUsageApp
File "SMAPyrModules/SMAPyrUtiPy.m/src/uti.py", line 37, in spawnAndWait
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawn.py", line 93, in spawnAndWait
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawnImpl.py", line 643, in spawnAndWait
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawnImpl.py", line 477, in __init__
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawnImpl.py", line 438, in popenWrap
I cannot find the SMAPyModules directory as well as modules such as licensing.py, utiSpawn.py etc.
Could you give me some solution or advice?
In the console:
sudo apt install lsb
I used coda for a long time, with limited problems.
However, I recently installed Miniconda2 (Miniconda2-latest-Linux-x86_64.sh) on a HPC node.
Everything works fine, but I can not install multiple packages.
What happens, is that I install one package, and after that, I get the following error when I try to install a new one:
Traceback (most recent call last):
File "/hpc-home/ro/miniconda2/bin/conda", line 13, in <module>
sys.exit(main())
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/cli/main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1335, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1046, in __call__
return self.handle_exception(exc_val, exc_tb)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1090, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1101, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1171, in print_unexpected_error_report
from .cli.main_info import get_env_vars_str, get_main_info_str
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/core/package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda_package_handling/api.py", line 3, in <module>
from libarchive.exception import ArchiveError as _LibarchiveArchiveError
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/libarchive/__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/libarchive/entry.py", line 6, in <module>
from . import ffi
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/libarchive/ffi.py", line 27, in <module>
libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
File "/hpc-home/ro/miniconda2/lib/python2.7/ctypes/__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
File "/hpc-home/ro/miniconda2/lib/python2.7/ctypes/__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /lib64/liblzma.so.5: version `XZ_5.2' not found (required by /hpc-home/ro/miniconda2/lib/libarchive.so.13)
The problem is temporally fixed when I re-install conda:
bash Miniconda2-latest-Linux-x86_64.sh -u
I am not sure what I am missing here. Would someone point me towards a potential solution not involving using sudo, as I have no rights?
I am trying to generate exe file from a script that uses openCV and Vpython however I am having problems with it. I tried using pyinstaller with a simple print script it worked fine. when I try it with openCV only script it did not work and the same with Vpython only script, and both. the error I am getting is this:
Traceback (most recent call last):
File "C:\Python27\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 46, in run_
build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
212, in __init__
self.__postinit__()
File "c:\python27\lib\site-packages\PyInstaller\building\datastruct.py", line
161, in __postinit__
self.assemble()
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
535, in assemble
redirects=self.binding_redirects))
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 227
, in Dependencies
for lib, npth in selectImports(pth, xtrapath):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 510
, in selectImports
npth = getfullnameof(lib, xtrapath)
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 82,
in getfullnameof
if os.path.exists(npth) and matchDLLArch(npth):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 194
, in matchDLLArch
pe = pefile.PE(filename, fast_load=True)
File "c:\python27\lib\site-packages\PyInstaller\lib\pefile.py", line 1720, in
__init__
self.__parse__(name, data, fast_load)
File "c:\python27\lib\site-packages\PyInstaller\lib\pefile.py", line 1799, in
__parse__
raise PEFormatError('DOS Header magic not found.')
PyInstaller.lib.pefile.PEFormatError: 'DOS Header magic not found.'
I have:
PyInstaller: 3.2.1
Python: 2.7.13 x64
Platform: Windows-8.1 x64
what to do?
A better place to pose VPython questions is in the VPython forum at
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users
There you might find VPython users who have experience with PyInstaller (I don't).