-
Notifications
You must be signed in to change notification settings - Fork 1
How to setup Printrun with Visual Studio 2019 2022
This instruction is for building a Windows 10 version of Printrun.
Please download/update to actual Python release. Please choose latest Python 3.10.x (64bit).
This instruction is based on file buildinstructions.txt and differ only on parts that need to be changed for VS2019 (at least for me). Leave me a comment if you have suggestions for better ways doing this.
-
Open a new project in Visual Studio and clone the project from https://github.com/kliment/Printrun
-
Mark pronterface.py as start element for the project and open it once in editor. Visual Studio will now recognize the file requirments.txt and ask for creating a virtual environment. Confirm with Yes and follow step 3.
-
Create a new virtual environment with name v3 for actual Python 3.10 (64bit) as actual environment. This will take some time.
Please update after installation all modules to its actual versions. There is one module that should not updated to the last version: use pyglet version 1.5.7 instead of version 2.x(not compatible). Here you can find a listing of module versions that I use for building an executable Windows 10 file.
Note: Please check that you select the new environment (v3) as actual Python environment
-
In addition you need to install simplejson, cython, wheel, pyinstaller +[pypiwin32, polygon3, ] see remark *1
-
Now open VS 2019 Developer command line window:
-
Activate your virtual environment:
v3\Scripts\activate
-
Note: pyinstaller version 3.6 will not create a working executable file. You need to change it to actual developer version. This is valid as long as there is no official new release available. Please find a discussion about pyinstaller error for more information here: https://github.com/pyinstaller/pyinstaller/issues/2137Run in virtual environment (v3):pip uninstall pyinstaller
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
Solved, use the latest pyinstaller
-
Building Pronterface.exe
python setup.py build_ext --inplace
pyi-makespec -F --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py
pyinstaller --clean pronterface.spec -y
Once you get the message INFO: Building EXE from EXE-00.toc completed successfully
you will find two additional directories called \build and \dist in your source directory. The executable Pronterface.exe is located in \dist
Remarks
*1 Errors/missing modules
- ModuleNotFoundError: No module named 'win32com' --> add pypiwin32
- missing module Polygon3: -->add Polygon3
- Runtime error with numpy v1.19.4 --> install numpy v1.19.5 (see below for further information)
-
3D view of build plate is missing:
How to solve: You forgot to run the first instruction of 8. before building the executable file:
python setup.py build_ext --inplace
-
Projector crash with code error
Up to now this can be solved only by running Pronterface from code.
In addition you need to install an additional Windows runtime environment library called GTK3. You can find an actual version here: https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases. Choose the actual GTK3 runtime.
Alternatively adding library pycairo seems to work too.
-
Error after python setup.py build_ext --inplace:
LINK : fatal error LNK1104: Can't open file "C:\ ... \Printrun\printrun\gcoder_line.cp37-win_amd64.pyd". error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe' failed with exit status 1104
How to solve: Delete file gcoder_line.cp37-win_amd64.pyd. It will be generate new with python setup.py build_ext --inplace.
-
Runtime error compiling Windows 10 x64 executable with numpy 1.19.4:
numpy v1.19.4 create a python RuntimeError. The current numpy installation fails to pass a sanity check due to a bug in the windows runtime. Please find a discussion about this issue for more information:https://tinyurl.com/y3dm3h86Temporary workaround is to install 1.19.3 instead.pip uninstall numpy
pip install numpy==1.19.3
--> ToDo: Need to be checked in 2021 January again--> Solved. Install new version numpy 1.19.5 instead.
-
Failed to execute script pronterface (Release Candidate 2.00RC7, 2.00RC7 and 2.00RC8)
This error was first noticed with Windows version of Printrun 2.00 RC7/8 and the change to wxPython 4.1.x.Further information can be found here: https://discuss.wxpython.org/t/wxpython4-1-1-python3-8-locale-wxassertionerror/35168.The work around is using the latest development version of wxPython. This is implemented in release_windows.bat (branch Test).Users running Python >=3.9 should change the statement for minimal wxPython version to >=4.1.0 in requirements.txt too, so thatrelease_windows.bat is able to install and update all dependencies correctly. Tested successful with wxPython-4.1.2a1.dev5165+64e5d863.Since Dec.2021 there are two new development versions of wxPython. The latest one had dropped support for 32bit versions and in additionsupport for Python 3.6 was dropped too. Latest working version for those is wxPython-4.1.2a1.dev5226+a843ed14Further information: https://github.com/wxWidgets/Phoenix/commit/d3bdb14365ca754e83732cccd04e94a2ded5029f('Add new macros workers, * Drop 3.6 and most 3.7 builders, * Drop all win32 builders, at least for now, * Add some Py3.10 builders')Starting with wxPython-4.1.2a1.dev5259+d3bdb143 there is only support for x64 for python 3.7 to 3.9 (+3.10 as first development version)An updated release_windows.bat and github workflow files (buildpackage-win (2).yml, pypi-win.yml) can be found in my branch Test. This is notincluded in my branch Master.
--> solved since wxPython 4.2.0 is officially released. Support for Python 3.6 and all 32-bit windows versions has been discontinued.
-
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8 in position 39: invalid continuation byte or similar. this can happen if you switch between 1.x and 2.x versions. File printrunconf.ini seems to be corrupt. Close Pronterface, make a backup of this file and delete it. With starting Pronterface the config file will be created new. For windows you will have two places for the config file. One is in the root of your user directory like "c:\users\YOUR_USER_NAME" and the second is at "c:\Users\YOUR_USER_NAME\AppData\Local\Printrun". Delete the the file printrunconf.ini as well.
-
Support for Projector in windows Version of Printrun
this is included in branch Test and Master. For further information see https://github.com/kliment/Printrun/pull/1169 and https://github.com/DivingDuck/PrintrunGTK3
- Install Python 3.10
- Install C-compiler environment or Visual Studio 2022 Community edition
- Check for latest repository updates from https://github.com/kliment/Printrun or here
In the root of the repository you will find a batch script called release_windows_new.bat. Open in this directory a command line window and call the batch by typing [release_windows_new.bat] followed by [enter]. The batch will start and do what it need to do. Keep patient while the file is running First time you run this it will take a little bit more time.
What the scrip will do:
- Clean up previous compilations (directory .\dist)
- Check for virtual environment called v3 and generate it, if not available (start from scratch)
- Install all needed additional modules via pip
- Check for outdated modules that need to be updated and update them
- Check if virtual environment needs an update and do it
- Check for existing variants of gcoder_line.cp??-win_amd??.pyd and delete them (to prevent errors and incompatibilities)
- Compile Pronterface.exe and Pronsole.exe
- Copy localization files to .\dist
- Go to directory .\dist, list files and ends the activity