You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm trying to use scalene to profile my existing code. The code works without scalene. The scalene execution always fails at the mujoco - glfw import, error message is "NameError: name 'ctypes' is not defined", despite the import ctypes line works in my conda environment. I traced the error all the way to site-packages - glfw - library.py - line 104. And it appears that sys.executable in args now becomes "/tmp/scalenehc723hj6/python". Is there anyway to designate executable when starting scalene?
`
def _glfw_get_version(filename):
"""
Queries and returns the library version tuple or None by using a
subprocess.
"""
version_checker_source = '''
import sys
import ctypes
def get_version(library_handle):
"""
Queries and returns the library version tuple or None.
"""
major_value = ctypes.c_int(0)
major = ctypes.pointer(major_value)
minor_value = ctypes.c_int(0)
minor = ctypes.pointer(minor_value)
rev_value = ctypes.c_int(0)
rev = ctypes.pointer(rev_value)
if hasattr(library_handle, 'glfwGetVersion'):
library_handle.glfwGetVersion(major, minor, rev)
version = (major_value.value,
minor_value.value,
rev_value.value)
return version
else:
return None
if sys.version_info[0] == 2:
input_func = raw_input
else:
input_func = input
filename = input_func().strip()
try:
library_handle = ctypes.CDLL(filename)
except OSError:
pass
else:
version = get_version(library_handle)
print(version)
'''
args = [sys.executable, '-c', textwrap.dedent(version_checker_source)]
process = subprocess.Popen(args, universal_newlines=True,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out = process.communicate(filename)[0]
out = out.strip()
if out:
return eval(out)
else:
return None
`
To Reproduce
Steps to reproduce the behavior:
pip install mujoco
create script.py: "import mujoco"
scalene script.py
Expected behavior
Import complete without error
Screenshots
Desktop (please complete the following information):
OS: ubuntu 22.04
If you have not yet tried with the repository version (python3 -m pip install git+https://github.com/plasma-umass/scalene), please try that before reporting.
Issue still exists in repo version
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm trying to use scalene to profile my existing code. The code works without scalene. The scalene execution always fails at the mujoco - glfw import, error message is "NameError: name 'ctypes' is not defined", despite the import ctypes line works in my conda environment. I traced the error all the way to site-packages - glfw - library.py - line 104. And it appears that sys.executable in args now becomes "/tmp/scalenehc723hj6/python". Is there anyway to designate executable when starting scalene?
`
def _glfw_get_version(filename):
"""
Queries and returns the library version tuple or None by using a
subprocess.
"""
version_checker_source = '''
import sys
import ctypes
`
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Import complete without error
Screenshots
Desktop (please complete the following information):
If you have not yet tried with the repository version (
python3 -m pip install git+https://github.com/plasma-umass/scalene
), please try that before reporting.Issue still exists in repo version
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: