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.
Related
Trying to get the samplebinding example working, but no matter the compiler, python or pyside version used, I still get
ImportError: DLL load failed while importing Universe: The specified module could not be found.
Last configuration used:
VS2019
cmake 3.16.2
python 3.81 amd64 from python.org
pyside2, shiboken2 5.14.1 from pip
shiboken-generator whl 5.14.1 from here
Library is compiling fine:
Python 3.8 changed the dll path resolution.
Adding the shiboken2.abi3.dll to the folder resolved the issue.
Modify the import to be Python3 compatible:
from build.Universe import Icecream, Truck
The import of __future__.print_function suggests the file is still written for Python2.
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.
How do I force cx_Freeze to include all required dependencies? I've tried to compile using cxfreeze script.py --include-modules=BeautifulSoup
but get this error:
ImportError: No module named 'BeautifulSoup'
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.