fbs
fbs copied to clipboard
Add Python 3.7 support
It's not supported yet: https://github.com/mherrmann/fbs-tutorial/issues/1#issuecomment-446540428
Would also like to see this, or at least 3.6.8 (last bug fix release). Has anyone had any luck with getting it to work with 3.7+ and if not what are the blocking issues? Everything I work with is now 3.6+, so having to have a separate workflow and editor setup (I use newest official vim windows release at work with needs 3.6) just for 3.5 is a big pain point.
@saltycraig fbs supports 3.5 & 3.6. So 3.6.8 should work. Doesn't it? 3.7 may work, but is untested.
Can confirm that Python 3.7 "works" if you patch this https://github.com/pyinstaller/pyinstaller/issues/3753 and perhaps some other minor issues. I've successfully bundled sklearn
, skimage
, matplotlib
and tensorflow
in a PyQt5 GUI.
On macOS with Python 3.7.3, I'm having no issues with a freeze and bundle for my project. So, we got the green light with Python 3.7 on macOS, I think!
@vinyldarkscratch are you using PyQt5 or PySide2? Which version?
I’m using PyQt5, version 5.12.1.
Okay, thanks!
I'm using PyQt5 version 5.13.0 on Windows 10 but it's not working here's the stack trace
Traceback (most recent call last):
File "C:\Users\enahm\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\enahm\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "E:\WorkSpace\temp\V3 Studio\venv\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 29, in <module>
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\building\api.py", line 424, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\building\api.py", line 196, in __init__
self.__postinit__()
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "e:\workspace\temp\v3 studio\venv\lib\site-packages\PyInstaller\building\api.py", line 273, in assemble
pylib_name = os.path.basename(bindepend.get_python_library_path())
File "C:\Users\enahm\AppData\Local\Programs\Python\Python37\lib\ntpath.py", line 214, in basename
return split(p)[1]
File "C:\Users\enahm\AppData\Local\Programs\Python\Python37\lib\ntpath.py", line 183, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Traceback (most recent call last):
File "E:\WorkSpace\temp\V3 Studio\venv\Scripts\fbs-script.py", line 11, in <module>
load_entry_point('fbs==0.8.3', 'console_scripts', 'fbs')()
File "E:\WorkSpace\temp\V3 Studio\venv\lib\site-packages\fbs\__main__.py", line 17, in _main
fbs.cmdline.main()
File "E:\WorkSpace\temp\V3 Studio\venv\lib\site-packages\fbs\cmdline.py", line 32, in main
fn(*args)
File "E:\WorkSpace\temp\V3 Studio\venv\lib\site-packages\fbs\builtin_commands\__init__.py", line 120, in freeze
freeze_windows(debug=debug)
File "E:\WorkSpace\temp\V3 Studio\venv\lib\site-packages\fbs\freeze\windows.py", line 18, in freeze_windows
run_pyinstaller(args, debug)
File "E:\WorkSpace\temp\V3 Studio\venv\lib\site-packages\fbs\freeze\__init__.py", line 48, in run_pyinstaller
run(args, check=True)
File "C:\Users\enahm\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pyinstaller', '--name', 'V3 Studio', '--noupx', '--log-level', 'ERROR', '--noconfirm', '--windowed', '--icon', 'E:\\WorkSpace\\temp\\V3 Studio\\src\\main\\icons\\Icon.ico', '--distpath', 'E:\\WorkSpace\\temp\\V3 Studio\\target', '--specpath', 'E:\\WorkSpace\\temp\\V3 Studio\\target\\PyInstaller', '--workpath', 'E:\\WorkSpace\\temp\\V3 Studio\\target\\PyInstaller', '--additional-hooks-dir', 'E:\\WorkSpace\\temp\\V3 Studio\\venv\\lib\\site-packages\\fbs\\freeze\\hooks', '--runtime-hook', 'C:\\Users\\enahm\\AppData\\Local\\Temp\\tmp4m0yykya\\fbs_pyinstaller_hook.py', 'E:\\WorkSpace\\temp\\V3 Studio\\src\\main\\python\\main.py']' returned non-zero exit status 1.
Everything is working as expected but the freeze
command.
what to do if this happens
Python 3.7.4 on MacOS 10.14.6 with PySide2==5.12.3 seems to be working so far!
Works for Windows 10 with python 3.7.4, PySide2==5.13, and numpy==1.16.2, it failed for 1.17+
There is an issue w/ pyinstaller and numpy for . numpy 1.17.0; it was resolved for 1.17.1
3.7 may work, but is untested.
@mherrmann What needs to be done to consider it tested/supported? I assume the current unit tests are not enough. Do you need more tests, or do you need more success stories from real-world projects using fbs?
I started playing around with fbs and I can report that the basic starter project (fbs startproject
) is created/frozen/installed/running correctly using Python 3.7.4 with the following libraries on Windows 10 and Ubuntu 18.04:
fbs==0.8.4
PyInstaller==3.5
PySide2==5.13.1
This works on Windows 10 with the official Python 3.7.4 installer. I created the virtual environment with the standard venv
module (py -mvenv venv
).
On Linux (Ubuntu 18.04) I used pyenv
to install Python 3.7.4. I also used venv
for the virtual environment. I had one issue running fbs freeze
:
TypeError: expected str, bytes or os.PathLike object, not NoneType
(Note: I am not logging it as a bug here, just mentioning it.) It seems like an upstream issue somewhere between PyInstaller and Python 3.7 venv
(example: https://github.com/pyinstaller/pyinstaller/issues/3942 and https://github.com/pyinstaller/pyinstaller/issues/4200), I got around that by adding pyenv's libraries directory before freeze
ing:
LD_LIBRARY_PATH=~/.pyenv/versions/3.7.4/lib fbs freeze
Other than that, it seems to work fine. However, I haven't tested anything with a bigger or real-world project.
What needs to be done to consider it [Python 3.7] tested/supported?
One strength of fbs comes from the fact that I use it for fman, which is installed on thousands of machines. Freezing (=turning Python code into standalone executables) is highly sensitive to the Python and PyInstaller versions. I once updated fman's Python version from 3.5 to 3.6, thinking "what could go wrong?". Plenty, in fact, and I had to roll back the release. For this reason I only support the versions I use (or have used), and have thus abundantly tested in the real world. At the moment, this is Python 3.5 & 3.6, PyQt 5.9.2 and PyInstaller 3.4.
Are there any plans to include more supported versions?
The project I'm working on has a hard requirement for Python 3.7+ (asyncio incompatibilities/bugs with Python 3.5 and 3.6 unfortunately). I may just end up patching around the fbs issues (as they should be much easier than the asyncio ones).
No immediate plans I'm afraid.
I have been using fbs with Python 3.7.6 for my package for a while on Win 10. I have used various PyQt5 versions, including the latest 5.15.
It works fine, but I did have to manually fix an issue with PyInstaller 3.4 as described here when using Python 3.7 with venv. This issue would be resolved if fbs also supported PyInstaller 3.6.
I would advocate for a reconsidering supporting Python 3.7 due to NEP-29 (NEPs are numpy's versions of PEPs). NEP-29 provides a suggested timeline for deprecating python minor version support (along with numpy version support). On June 23rd of this year, NEP-29 recommends dropping support for python 3.6. The short summary is it recommends dropping support for minor versions of python after they've been released for 42 months.
Given the widespread adoption of NEP-29 among the scientific python community (numpy, scipy, scikit-learn, scikit-image, Jupiter, python, yt, matplotlib just to name a few), fbs not supporting the oldest recommended supported versions of NEP-29 will put package developers in a bit of a bind.
EDIT: I'm also a maintainer of pyqtgraph and we will be adopting NEP-29 for our next non-patch release.
I'm afraid I don't currently have time to support Python 3.7+. But I do hope to get to it at some point in the coming months.
I just successfully managed to build a software project on Windows 10 using the following dependencies.
Python==3.7
PyInstaller==3.6
PySide2==5.15.0
The only issue I ran into is that PyInstaller 3.6 now seems to have its own hook for PySide2 so that I manually had to remove the one by fbs (simply by deleting it from the fbs directory where it was installed in the virtual env — a bit of a hack but it worked). The one thing I struggled to do is to build this with Python 3.7 on the docker vm because no matter what version you install in the virtual environment, the vm always works on Python 3.6.
@mherrmann: I think it's totally fine if you don't want to actively support Python 3.7+ and PyInstaller >=3.6 but perhaps do you want to make it easier for people to try? At the moment it's a bit of a struggle with pipenv to install PyInstaller 3.6 or build with Python 3.7. If more people could try this out in an easy way, than that would mean others can test it, and point out bugs just like I did.