New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python:3.12.0 name not defined error #7992
Comments
Hmm, this definitely looks like a bug, although I will need to dig further to see if it is ours or python's (or some weird combination of both). |
The behavior is definitely bizarre, as demonstrated by following minimal program: import sys
if len(sys.argv) != 2:
print(f"usage: test <dir|locals|globals>")
sys.exit(1)
mode = sys.argv[1]
# The comprehension must use same variable name as the code that attempts `del`.
_allvalues = ''.join([myobj for myobj in ['a', 'b', 'c']])
myobj = None # for del below
if mode == 'dir':
print("DIR():", dir())
elif mode == 'locals':
print("LOCALS():", locals())
elif mode == 'globals':
print("GLOBALS():", globals())
del myobj The codepaths that call either So far, all evidence points towards |
https://docs.python.org/3.12/whatsnew/3.12.html#pep-709-comprehension-inlining maybe python3.12 pep709 affect it?
|
Looks like a bug in python's |
although it's not pyinstaller's bug, but should pyinstaller treat python 3.12.0 as a not full compability py version. |
We can add a sentence saying as much in the readme but that's all we can do. It's impossible to withdraw support for a Python version once we've marked one release as supporting it. I'll pin the issue for now – that tends to keep people from raising duplicate issues. |
SciPy is currently broken under python 3.12 and PyInstaller, due to pyinstaller#7992.
SciPy is currently broken under python 3.12 and PyInstaller, due to #7992.
FYI, Running into this one as well. Only see it in Pyinstaller too, only in 3.12. Will revert Python versions. |
Good day everyone! I am reaching out to determine if anyone has found a work around for this issue. I am attempting create an executable using auto-py-to-exe and unfortunately it is failing due to 'obj' not defined. Additionally, I believe that this same issue is happening with the module statsmodels.api as well. Any information you provide would be greatly appreciated. |
The obvious work-around would be not to use python 3.12 until they fix Other than that, you could also:
|
Rokm, I appreciate your response. I used an older version of python and was able to create the executable. Thank you for pointing me in the correct direction. |
Good News, A bug fix have been merged to python:main and python:3.12 branch 9 hours ago, maybe 3.12.1 will sove this problem! python/cpython#111866 . |
由于当前 PyInstaller [不支持 Python 3.12](pyinstaller/pyinstaller#7992 3.12 的支持
python 3.12.1 released , this bug has been fixed ,pls upgrade your python version to avoid this issue. Actually pyinstaller not work well only with python=3.12.0 |
根据 <pyinstaller/pyinstaller#7992 (comment)> ,在 Python 3.12.1中已经可以使用 PyInstaller,故将本项目也恢复对 Python 3.12 的支持;
scipy stats module report name 'obj' not defined
Context information (for bug reports)
Output of
pyinstaller --version
:6.0.0
Version of Python: 3.12.0
Platform: Windows (zh-CN)
How you installed Python: conda
Did you also try this on another platform? Does it work there?: have tried ubuntu22.04, the same error reported
--noupx
or setupx=False
in your .spec-file--debug
topyi-makespec
orpyinstaller
or useEXE(..., debug=1, ...)
in your .spec file.A minimal example program which shows the error
Stacktrace / full error message
I read the source code in scipy, the 'obj' located at scipy.stats._distn_infrastructure.py line 360. 'obj' is not defined before but only in some comprehensive list.
It totally ok when python vesion=3.11, but when i change to python 3.12, it report error. I was wondering if its a python 3.12 import system problem. Seems pyinstaller + python 3.11 won't import this 'del obj', but pyinstaller + python 3.12 will do.
The text was updated successfully, but these errors were encountered: