I am trying to make an executable of a Stackless Python 2.6 program. The setup file is
from distutils.core import setup
import py2exe
setup(console=['controller.py'])
and I run it with
python setup.py py2exe
However, when I try to run it, it raises an ImportError and says that there is no module named serial. When I try:
python setup.py py2exe --includes serial
or
python setup.py py2exe --includes pyserial
the build fails with an ImportError. Do you have any ideas?
Had same issue. Upgrading pyserial to 2.5 solved the problem: exec built without additional "includes" contains pyserial.
Related
I downloaded the pyodbc module as a zip and installed it manually using the command python setup.py install. Although I can find the folder inside the Python directory which I pasted, while importing I am getting the error:
ImportError: No module named pyodbc
I am trying to use to this to connect with MS SQL Server. Help
As installation error showed, installing Visual C++ 9.0 solves problem because setup.py tries to compile some C++ libraries while installing plugin. I thing Cygwin C++ will also work due to contents of setup.py.
I'm trying use py2exe on a program that imports urlparse from six.moves.urllib_parse. Here is the program:
# hello.py
from six.moves.urllib_parse import urlparse
print('hello world')
And here is my setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
Running hello.py works fine. When I compile hello.py into an exe using python setup.py py2exe, a hello.exe file is produced. However, when I run hello.exe I get an error saying:
ImportError: No module named urlparse
I'm using Python 2.7.
With Python 3.4, I get an error saying KeyError: 'six.moves' when running python setup.py py2exe.
How can I stop these errors from occurring?
The problem is just that py2exe doesn't detect the modules that are proxied through six, so they're not bundled.
All you have to do is add the module in question (urlparse) to your includes in your setup.py:
options={
"py2exe": {
...
"includes": ["urlparse"],
...
That way the module will be packaged, and when six tries to import it, it will work.
py2exe released a new version recently that fixes this problem:
Changes in version 0.9.2.2:
- Added support for six, cffi, pycparser, openssl.
Using this version I was able to create an .exe and run it successfully.
I have a program that imports a library called pyfits. When I compile the project, I get an error that says:
Traceback (most recent call last):
File "C:\Users\KenPreiser\Desktop\Space thing\Sample.py",
line 2, in
import pyfits
ImportError: No module named 'pyfits'
I have pyfits downloaded to my E:\ drive. Is this a problem?
Downloading a library to any folder on your system will not make it available for the python interpreter to import into other modules.
pyfits has instructions on how to install it. Preferred way to install any python package is using pip.
If you have downloaded the .exe of the library, install it like how you would install any windows program.
If you have downloaded the source instead, uncompress the source archive. And install it with commands:
python setup.py build
python setup.py install
This will install the library into python site-packages. If pyfits is installed correctly executing this command:
python -c 'import pyfits; print pyfits.__version__'
from your command prompt should display the version information of the library. Once you confirm that you have installed it correctly by doing the above, you can re run your sample.py
My python script imports a shared library (.so) which was generated by distutils.core from a C++ code. When I generate an executable using pyintaller, it prints out
The CococaAgg backend required PyObjC to be installed!
during building, and running the executable failed with
ImportError: No module named sysconfig
I believed this is due to .so importing, and not sure how to fix it in pyinstaller.
Update:
I installed PyObjC. The
The CococaAgg backend required PyObjC to be installed!
disappeared during building, but the
ImportError: No module named sysconfig
failure was still there during execution.
i want to create .app application by Py2app, i was installed Py2app on my mac os x lion by terminal and copy "gtkapp.py" (the name of my app that used PyGTK) and "setup.py" but when i run the setup.py get this error:
from setuptools import setup
and
ImportError: cannot import name setup
what problem?
Be sure the py2app binary is in your path. A simple way around this is to use MacPorts for your py2app isntallation.