How do I build cx_freeze from source on Windows? - windows

I tried to install cx_freeze on my computer (windows) with an MSI, but the installation kept failing saying something like "one or more needed files could not be found." Because installing from a prebuilt binary wasn't an option, I decided to build cx_freeze from source.
I downloaded the .tar.bz and extracted until I got to the actual folder containing the setup.py. I cded into the directory, and ran the command
python setup.py install
A cmd windows came up and printed out a lot of text along the lines of "adding base module named...",then printed out
running install
running build
running build_py
However, the install then failed with the error
error: package directory 'cx_freeze' does not exist
I have no idea how to solve this. If someone could give me working instructions on how to install cx_freeze that would be great
BTW, I'm on python 3.3

After struggling around for 1 and a half hour I found the solution!
I followed these steps to compile CX_Freeze from source for Python 3.3:
install visual studio 2010 c++ (only 2010 works!)
Download the latest version of CX_Freeze from BitBucket. You need this one, the version on the main page of CX_Freeze misses one file! https://bitbucket.org/anthony_tuininga/cx_freeze
Extract the file
Launch cmd and cd to the directory of the extracted folder. (This will avoid your problem)
(optional: path to python.exe) setup.py install
Done!
During this I faced one major issue. There where some problems with mt.exe and it failed with exit status 31.
The solution is to go to you python and edit msvc9compiler.py in Lib/distutils.
Search for the following line:
ld_args.append(‘/MANIFESTFILE:’ + temp_manifest)
replace it by:
ld_args.append(‘/MANIFEST’)
sources which helped me:
http://fuyun.org/2009/12/install-mysql-for-python-on-windows/
http://grokbase.com/t/python/tutor/03be598tkx/how-to-install-new-package#20031115zd5eiqq27cbflktokjw4esr4g4

Related

ninja: error: loading 'build.ninja': The system cannot find the file specified. when build hello world in Visual studio

I have followed esp-idf guideline to install and test to build the hello world and blink sample code but both the code met this problem.
Visual studio try to build hello world
> Executing task: ninja <
ninja: error: loading 'build.ninja': The system cannot find the file specified.
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1.
I have tested all the ways I can find to fix it but I'm not sure anything I missed or not.
This is one of the way that I test but also met some problem.
cmd try to run the command below
C:\Espressif\frameworks\esp-idf-v4.4>python -m pip install --user -r %IDF_PATH%/requirements.txt
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
This possible problem is the python environment is exist so I cannot do this command, but I try many ways to disabled or deactivated it still cannot.
python path
system environment
After trying to debug this for a long time, I made a backup copy of the entire project folder, then just went hog-wild deleting files. I deleted almost every file I didn't author. Only left the main/CMakeLists.txt, main/component.mk, main/main.c, main/main.h, .gitignore, CMakeLists.txt, and Makefile. Then I ran idf.py set-target esp32 and idf.py -p /dev/ttyACM0 flash monitor and it worked fine again.
VS Code & ESP-IDF on Ubuntu 20.04.05 LTS
Check if the compiler is properly selected. If you don't select a proper c/c++ compiler, then you might get this error. I had mingw in my system, but vs code did not auto detect the compiler. Then I manually added mingw and selected it for compilation after which this issue was resolved.
What worked for me after updating to the new stable release (v5.0) was
Go to the folder S:\esp\esp-idf\esp-idf-v5.0
Run command prompt at this directory and execute install.bat and later export.bat
After trying to build the program in VSCode the error "ninja: error: loading 'build.ninja'" shows up.
Update the path in the ESP-IDF extension in VSCode using ESP-IDF:Configure Paths
locate your project folder e.g. "V:\simpleTest_using_EspIDF_v5_0"
Open command prompt and execute: idf.py build
Now it builds also in VSCode using the Espressif IDF extension.
You not have a build.ninja file. Find this file on proje

Py2Exe detected as virus. Alternatives?

So, I created a python program. Converted to exe using Py2Exe, and tried with PyInstaller and cx_freeze as well. All these trigger the program to be detected as virus by avast, avg, and others on virustotal and on my local machine.
I tried changing to a Hello World script to see if the problem is there but the results are exactly the same.
My question is, what is triggering this detection? The way in which the .exe is created?
If so, are there any other alternatives to Py2exe, Pyinstaller, cx_freeze?
You can try nuitka.
pip install -U nuitka
Example:
nuitka --recurse-all --icon=app.ico --portable helloworld.py
Website:
http://nuitka.net/
Maybe you need to install Visual C++ 2015 Build Tools for compile.
http://landinghub.visualstudio.com/visual-cpp-build-tools
If you download Nuitka package, you will find a Trojan files in the folder.
If you use this library, you will create a exe file with a Trojan embedded in the exe file.
It converts files much faster than other similar libraries with no errors.

build a .exe for Windows from a python 3 script importing theano with pyinstaller

edit September, 2, 2017, 1pm
I eventually managed to build a .exe with pyinstaller after many episodes.
Unfortunately I failed to deal with the ‘theano’ module (that is required in my case by the ‘pymc3’ module) and I had to modify the .py files and give up part of the application. My description below has two aims: first it may help; second could anyone help me building a .exe for windows 7+, with the ‘theano’ module ?
reminder: My python 3 script opens a simple GUI made with Qt Designer in a ‘.ui’ file and imports pyqtgraph (with pyqt5), pymc3 (and thus theano that is required by pymc3), scipy, numpy, os, sys. It will be distributed on machines with Windows 7+. I tried to build a ‘.exe’ with py2exe, cx_freeze, pynsist and pyinstaller (I opened and updated several posts, this one is still opened: build a .exe for Windows from a python 3 script importing pyqtgraph and opening a GUI) but all failed. My best result (with pyinstaller) is described below after I had to give up theano.
the command line I ended up with is: pyinstaller —noupx —onefile —add-data “toto.ui;.” toto.py. But strangely:
1 the qt designer file ‘toto.ui’ is not included and must be distributed together with the .exe. Otherwise there is an error message when running the .exe saying toto.ui not found;
2 the ‘platforms’ directory from the ‘Library/plugin’ directory of the python environment must also be distributed along with the .exe. Otherwise there is an error message when running the .exe ‘this application has failed to start because it could not find the qt
platform plugin windows’ (but there is no error message from pyinstaller when building !)
3 the .exe is 220MB big ! it seems pyinstaller includes a bunch of useless things during the building.
pyqtgraph problem:
At first sight, the module ‘pyqtgraph’ seems to be incompatible with pyinstaller. Indeed, when the python code imports pyqtgraph, pyinstaller gives a SyntaxError: ‘yield’ inside async function. This seems to me very awkward (is this a bug in pyinstaller ?) because I had the impression from forums this is related to asynchronous generators that are only compatible with python 3.6, while pyinstaller works only with python 3.5- that is not compatible with asynchronous generators… so why does pyinstaller use this ? It turns out this bug-like feature is disabled in a new version of pyinstaller that is not released (and so not installed by default): pip install git+https://github.com/pyinstaller/pyinstaller, thanks to 9dogs (in comments). I also found it may help to explicitly write os.environ[‘PYQTGRAPH_QT_LIB'] = 'PyQt5’ or ‘PyQt4’ before importing pyqtgraph in the py file(s)
theano problem:
theano turns out to make several implicit imports that are not detected by pyinstaller. Thus the building looks ok but when running the .exe you get error messages like ‘no module theano.tensor.shared_randomstreams’. Unfortunately I failed to use the '--hidden-import' option of pyinstaller so I added explicitly the imports in the py file(s) (in this example ’import theano.tensor.shared_randomstreams’ ).
But this is not the end: after that, the file ‘…\AppData\Local\Temp_MEI35682\theano\gpuarray\blockgemv.c' is missing, leading to [4128] Failed to execute script. I don’t know what this file is and didn’t find information. I gave up and removed part of the GUI to avoid theano. Can anyone help me using theano with pyinstaller ?

Cannot generate solution file of v8 with gyp for visual studio 2013

This is really painful.
I followed the instruction from https://github.com/v8/v8/wiki/Building%20with%20Gyp.
fetch v8
cd v8
And when fetching is finished,
set DEPOT_TOOLSPWIN_TOOLCHAIN=0
Instruction said to use command "python build\gyp_v8" but obviously, my v8 clone does not have "build\gyv_v8" file. I googled about this, And found gyp_v8 is in that "gypfiles" folder, not in "build" folder. So command I used was
python gypfiles\gyp_v8
It seemed like working at first. cmd put out the response "Updating projects from gyp files...". No warning or error. But nothing happens!
I think it should generate solution file for my VS. But even after process is finished, no solution file was found.
Am I missing something?
Im almost dying for this. T-T
Please, help me.
Try setting this environment variable before running GYP:
set GYP_GENERATORS=msvs
Then, after running GYP, do a recursive search for .sln files in your V8 directory :)
It seems the google is using a new build system instead of gyp. It is called "gn" and i could generate the Visual Studio solution by executing following code in the v8 directory:
gn gen --ide=vs out/Default
The all.sln is then located in .\v8\out\Default\
Source: http://dev.chromium.org/developers/how-tos/get-the-code

Installing python modules in TideSDK

I am trying to install an external dependency into Python for TideSDK. The current module I am trying to install is redis-py.
To install it I tried the following steps:
Open Command Prompt in regular administrative mode
Change directory to the downloaded module of redis-py
Provide the path to the python module used by TideSDK followed by the standard compile and install from source command prompt. The command I used: "C:\Program Files (x8
6)\TideSDK Developer\modules\python\1.3.1-beta\python.exe" setup.py install
The setup looked very promising. The redis-py module with egg file is confirmed to be installed by both the installer with exited with no errors and with a visual check on the directory.
So what gives? The correct files are installed in Lib/site-packages. TideSDK gives me ImportError: No module named redis. Any suggestions?
I solved it for another module: simplejson.
I guess the workaround should work for any module of this kind.
BTW, simplejson may be used to support json, as the actual version (TideSDK 1.3.1-beta) comes with Python 2.5 which doesn't support the standard json module, it comes in Python 2.6 (or higher).
First, the path you are using is for "TideSDK Developer", that's the program to launch and build apps. It happens that "TideSDK Developer" is built using TideSDK, so the structure is the same.
C:\Program Files (x8 6)\TideSDK
Developer\modules\python\1.3.1-beta\python.exe
The path that TideSDK actually uses to launch and compile apps is inside "C:\ProgramData"
In my case, it's:
C:\ProgramData\TideSDK\modules\win32\python\1.3.1-beta\python.exe
So, this is what I did, I ran:
C:\ProgramData\TideSDK\modules\win32\python\1.3.1-beta\python.exe setup.py install
That "installs" the module, but installs it inside "site-packages". So, when I launched the app I got the same error ("no module named simplejson"), I then copied the module from inside "site-packages" to outside.
I copied from:
C:\ProgramData\TideSDK\modules\win32\python\1.3.1-beta\Lib\site-packages\simplejson
to:
C:\ProgramData\TideSDK\modules\win32\python\1.3.1-beta\Lib\simplejson
And that's it. That worked for me.
In summary: Go to ProgramData, install with python and copy the folder installed inside site-packages.

Resources