I need to write a program that will be running in the end on CentOS (Version 6.3 - its a security appliance but I have root access)
I installed a development environment in Ubuntu and used pyinstaller to create a single executable. In PyCharm I can select between Python versions 2.7 and 3.6 - I tried both and created the exe.
The program works fine on Ubuntu, but unfortunately not under CentOS
CentOS shows me Python Version 2.66
Questions:
should it work in general?
I am getting errors- (missing lib's) (but files exist):
"./ICC: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/_MEIoHOzeE/libz.so.1)" - I assume the versions do not match?
is it important which python version is installed on CentOS (2.66) (I was hoping the executable would contain everything needed?)
I used pyinstaller with the option "--onefile"
I added "#!/usr/bin/python" as first line of my source code
if I run the.py file (source code) I get multiple errors:
./ICC.py: line 1: import: command not found
./ICC.py: line 2: import: command not found
./ICC.py: line 13: version: command not found
./ICC.py: line 24: try:: command not found
./ICC.py: line 25: syntax error near unexpected token (' ./ICC.py: line 25: logfile = open ("/tmp/icm-log.txt","w")'
(same code runs fine on ubuntu, guess things have changed in newer python versions which would make sense)
Do I need to write the program in Python 2.66? Do I need to move development to CentOS?
I cannot upgrade Python on CentOS as it might break other things
Any recommendations, ideas, hints on how to make this work.
When you use PyInstaller to create an executable binary you must do so on the target machine or target environment.
The output of PyInstaller is specific to the active operating system and the active version of Python. This means that to prepare a distribution for:
a different OS
a different version of Python
a 32-bit or 64-bit OS
you run PyInstaller on that OS, under that version of Python. The Python interpreter that executes PyInstaller is part of the bundle, and it is specific to the OS and the word size."
More info available here
Related
I'm new to webots program and I'm building a new robot controller, but when I hit the start simulation button, it gives me this error :
WARNING: "python3.8.exe" was not found.
Webots requires Python version 3.7 or 2.7 (64 bit) from python.org in your current PATH.
To fix the problem, you should:
1. Check the Python command set in the Webots preferences.
2. Check the COMMAND set in the [python] section of the runtime.ini file of your controller program if any.
3. Fix your PATH environment variable to use the required Python 64 bit version (if available).
4. Install the required Python 64 bit version and ensure your PATH environment variable points to it.
The first thing I recommend to start with is to download Python 3.7. in the documentation https://cyberbotics.com/doc/guide/using-python it is claimed that Webots supports python 3.7 (I think you are using windows). Python 3.8 support is only specified for MacOS and Ubuntu. Download link for Python 3.7: https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe.
When installing, be sure to specify that python should be added to the Path variable (I have circled this field in the figure below with a red rectangle). After installing python, you must restart Webots.
Also using the Windows command line, try running Python using the "python" command, also in the settings in Webots: Tools-Preferences (see the window below) the command that runs Python on your computer is specified. The command to run Python from the command line and the command to run Python specified in Webots-Preferences must match.
Is there now an easy protocol to build a .exe from python 3.5+, using modules pyqtgraph, qt5, theano, pymc3, numpy, scipy, os and sys, and opening a simple GUI stored in a '.ui' file ? I lost hours and eventually failed to make one (for w7-64 bits). Help !
preliminary failure with py2exe: I first install py2exe for python 3 but it turns out this is not compatible with my python 3.6 yet, so I downgraded to python 3.5… to get a bunch of errors. Then I went to forums and tried the proposed cures but failed (I’m uneasy with windows), the alternative being to downgrade to python 3.4… So I downgraded to python 3.4 to get an error concerning a missing ‘msvcr100.dll’ that I tried to install following instructions on forums but by default I don’t have the permission to modify system directories… When I eventually had this permission it turns out the ‘regsvr32’ command fails (isn’t this for 32 bits ? but there is no ‘regsvr64’…). Following episodes are described below.
update august 23, 2017, 1pm:
I also tried pyinstaller as advised but it failed (see my related question build a .exe for Windows from a python 3 script importing theano with pyinstaller)
I also tried cx_freeze but it failed (see my related question build a .exe for Windows from a python 3 script)
I also tried pynsist but it fails (same link than above)
what's next ?
update september, 2, 2pm:
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. Could anyone help me building a .exe for windows 7+, with the ‘theano’ module ?
see build a .exe for Windows from a python 3 script importing theano with pyinstaller
Pyinstaller Works with Python 3.5 and it is working even for packages like tensor-flow, scipy , etc (The packages I worked with)
py -3.5 pip install pyinstaller
then go the C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts
and run the command
pyinstaller <code .py file along with directory> --onefile
--onefile : is for compressing the build and get a single file as output
I would suggest pyinstaller see http://www.pyinstaller.org/
The pyinstaller already supports 3.5
The development version supports 3.6
It is better to use spec file to import other hidden libraries. I listed all Sklearn libraries and add them to spec file as a hiddenimports, you can add libraries you used in your project.
When attempting to install the scikit-bio toolkit via pip on Windows XP using Python 2.78 and Visual C++ 2008 Express Edition, the process is interrupted with the following message issued by VC:
cl : Command line error D8021 : invalid numeric argument '/Wno-error=declaration
-after-statement'
Concerning this error, Microsoft Developer Network website just says:
invalid numeric argument 'number'
A number greater than 65,534 was specified as a numeric argument.
I did not (yet) attempted to install scikit-bio under Linux (Ubuntu 12.04 Precise), but I am under the impression that it will work fine (as everything goes as regards Linux).
Has anyone ever succeeded installing scikit-bio under Windows (XP, 7, 8)? Any hints?
Thanks in advance!
I've installed Anaconda's Python (3.5) on a Windows 10 machine. As you should know, there is no official version of scikit-bio for this platform, but you can install it with this workaround:
Download the latest source from the Scikit-bio Github repository.
Using a tool like 7-zip, unzip it at your home directory.
Open a command line client and change to the source's directory
cd %HOMEPATH%\scikit-bio-master
Using Notepad++ edit the file setup.py
"C:\Program Files (x86)\Notepad++\notepad++" setup.py
Look for the line where the ssw_extra_compile_args variable is defined and change it. You can comment the previous version and redefine the variable in a new line:
#ssw_extra_compile_args = ['-Wno-error=declaration-after-statement']
ssw_extra_compile_args = []
Save the changes, close the editor and run the installation with this command:
python setup.py install
Hopefully you won't receive any error messages. Open an Anaconda's Python session (using the command python) and test if Scikit-Bio was installed rightly using print(skbio.art).
By the way, I've previously installed Visual Studio 2015 Community Edition with C++ SDK features enabled, in order to meet the compiler requirements for the package (Scikit-Bio) installation.
At this time, scikit-bio doesn't officially support windows. We'd definitely be interested in hearing about people's efforts to install, test, and use scikit-bio on Windows, but we don't have developers with expertise in this area.
This is related to biocore/skbio#941.
I'm trying to build PySVN from source on my Windows 7 PC. It's running 64bit Windows, but for various reasons I need to compile it so that it works on 32bit Python. That's what we run on a lot of our automation servers.
I've downloaded the PySvn extensions source, I've got Visual Studio 2008 Express Edition installed. I've tried to a batch to automate the process, it looks like this:
set PROJECT_DIR=%~dp0
set SRC_DIR=%PROJECT_DIR%pysvn-1.7.8
cd %SRC_DIR%\Builder
set SVN_VER_MAJ_MIN=1.8
call builder_custom_init.cmd
cd %SRC_DIR%\Source
python setup.py configure --platform=win32
When I get to the last line I get the error message:
Info: Configure for python 2.7.6 in exec_prefix c:\python27
('Error:', 'cannot find PyCXX include CXX/Version.hxx - use --pycxx-dir')
My python - include directory does not contain a file called Version.hxx. Where do I get this file, how do I fix this bug?
One way is to install PYCXX by hand - it installs a Version.hxx under the Include folder on windows.
The source for PYCXX is here: http://cxx.sourceforge.net/
Another way is to point the C/L parameter --pycxx-dir at the Import folder under the pysvn root where the corresponding version of PYCXX for the version of pysvn is kept.
(On top of this you will have to build the subversion libraries on windows.)
I'm trying to package a python program to an app with py2app 0.7.3.
I have one (Mountain Lion) Mac on which I installed the python.org version of Python 2.7.3 and all required modules by using the distributables that were available for them.
However, I also needed a 32-bit version of the app, so on another (Mountain Lion) machine I have set up the same environment (i.e. python + modules) using macports (with i386 for build_arch).
From source, my program runs fine on both machines. However, only the app that is generated on the 64-bit machine works. When trying to run the 32-bit app generated on the macports machine, I get the error:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/apptemplate/lib/site.py", line 20, in <module>
import os
zipimport.ZipImportError: can't decompress data; zlib not available
For both apps the same setup.py file was used.
It seems as if the app generated on the macports machine still tries to use the external Python instead of the one that is packaged with it (though it should not be semi-standalone as the system's python was not used). zlib is present in the .app file (and, of course, also outside).
Most other posts I have found about this problem, recommend to alter the sys.path variable in the __boot__.py file that can be found inside the package, but it seems as if my app doesn't even reach that module and crashes beforehand.
I found a, maybe not so elegant, but working solution:
In py2app/__init__.py I set the variable 'Compression' to False. This prevents the compression of the site-packages folder to a zipfile. This partly solved the problem as there were still some invalid mach-o error messages afterwards, but by invoking py2app like
python setup-mac.py py2app --arch i386
the generated app ran fine