I am trying to create standalone exe of twisted application using PyInstaller. Everything is ok, even executable file is getting build, but its not working. I mean if try to execute it gives error 'Import error: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface."
I already have installed zope.interface 4.1.0. Also twisted application is running fine, with 'python ' But at the time of building executable file Pyinstaller is unble to import zope.interface.
How to solve this issue?
Thank you in advance.
finally problem solved.
Problem is zope.interface is not getting added in PYTHONPATH.
Actually I have tried different setups (like pip & exe), though it was not getting added. Exact reason I don't know.
But after installing zope.interface using 'easy_install ', it is added in PYTHONPATH & I am able to create executable file.
Thank you for taking interest.
Maybe it'll help in your problem: http://github.com/kpdyer/fteproxy/issues/66
Related
I have been building an application on Linux using python pygobject, and now I need to distribute it on Windows.
I first installed pygobject via msys2 (as per the official pygobject documentation)
Now, using msys2/mingw32, I can run my program typing
python3 main.py
But when I try to freeze it into a .exe with Pyinstaller, and try to run the produced .exe
If I Don't use --onefile, I get an import error on the _struct module (whereas "import _struct" works in python shell)
If I use --onefile, I get the Following error :
error:
lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.dll could not be extracted!
fopen: No such file or directory
I’m using the devel version of Pyinstaller. I know next to nothing on Windows OS… does anyone know how to fix that error ?
It sounds like you were on the right path, unfortunately you ran in to a bug in PyInstaller. The good news is that the issue with the No module named '_struct' error is now fixed and released in version 3.6 and later. I would recommend using the --onedir mode of PyInstaller, you should be able to successfully package a GTK app for Windows.
I have been trying for quite some time now to make my Python program run on pc's that don't have python installed. I have issues because I'm using python 3.6.0. In this post I am going to discuss a method I got from this video.
The first thing I did, was install Python 3.5 and create a virtualenv for it, which I activated. You can see how I did that on the post I made earlier today. After I activated the environment, I used this command in cmd in the python 3.5 environment: pip install cx_Freeze. It got installed with no errors. Then I made this setup.py file:
from cx_Freeze import setup, Executable
setup(name='vkv',
version='0.1',
description='Berekent de wortels van een vkv',
executables = [Executable('vkv.py')])
The python file that I want to turn into a .exe file is called vkv.py. The vkv.py file and the setup.py file are both the only 2 files on this path: C:\Users\hp\Desktop\Code\Python testing\distr.
Ok so now I only have to enter setup.py build in the command line in order to make the .exe file. But when I do that, I get a bunch of lines, with an error on the last line:
AttributeError: module 'dis' has no attribute '_unpack_opargs'
Here is a screenshot of it:
Does anyone know what I did wrong? Is it something in the setup.py file, is it not setting up the virtualenv correctly? And does anyone know what this error means and how I can fix it?
You are dealing with an version of cx_freeze that has a bug that manifests itself for versions larger than 3.5.2, this issue has already been reported here and fixed.
In short, a small change was introduced in Python 3.5.2 that cx_freeze failed to catch, now a check is made to work smoothly.
In short, you'll need to update cx_freeze, you could either try pip install -U cx_freeze or get the source for it.
p.s Using Python 3.6 right now probably isn't the best idea since quite some changes were made and bugs might take a while to be caught and fixed.
From IDLE, I tried to run a script with a newly installed scrapy 1.0.3.
I'm using a script from a friend whom it worked for (but on Windows, I'm on a Mac).
From the import of scrapy on the first line, I get this error when running the program:
ImportError: No module named twisted.persisted.styles
The whole script, if it's helpful, points to this:
Traceback (most recent call last):
File "/Users/eliasfong/tutorial/tutorial/spiders/medspider.py", line 1, in <module>
import scrapy
File "/Library/Python/2.7/site-packages/scrapy/__init__.py", line 27, in <module>
from . import _monkeypatches
File "/Library/Python/2.7/site-packages/scrapy/_monkeypatches.py", line 20, in <module>
import twisted.persisted.styles # NOQA
ImportError: No module named twisted.persisted.styles
Any suggestions on how to tackle this problem?
Just try to force the update of twisted :
pip install twisted --upgrade
That works for me with python3.4 and Scrapy==1.1.0rc1
Either twisted is installed on your mac (I highly doubt it since it's not a standard library) and for whatever reason the IDE (i'm assuming that's what you mean since you typed "idle") or the terminal you are in doesn't have your updated environment variables, meaning it doesn't understand where your default python libraries are (again I highly doubt it), or you simple do not have twisted installed on your mac. If it's not installed you have a couple of options:
The easiest way to install a python package is through pip.
If that not an option you can try homebrew which is another package manager for macs. It offers an easy way to install packages correctly.
If that still is not an option for you or you simply don't want to attempt that you can download twisted directly from here (the .bz2 since you're on a mac), click on it and it should unzip it for you. Then just run setup.py and it should install it in the correct location on your mac.
If that still doesn't work and you have decent knowledge of unix. Use the "locate" command on the terminal and find out where your dist-packages directory is and put the source for twisted in there directly and then attempt to import twisted in your IDE or in the python interpreter to verify that it is installed.
note: If you're still having problems after it is installed trying restarting your IDE or messing with some setting to make sure your IDE has the right environment and python path. Hope that helps!
It could be related to having installed Python without bzip2. I had the same error and this helped me, see the accepted answer here:
Installing Twisted through pip broken on one server
Had this exact thing on FreeBSD. Solution (as root/sudo):
chmod -R go+rX /usr/local/lib/python2.7/site-packages
Some directory permissions weren't set up right on install.
I am trying to use Nuitka to compile a simple zeroMQ example and am having problems. I have used the following command to compile:
nuitka --standalone --portable --remove-output --recurse-all --python-version=3.4 testclient.py
and I get the following compile time warning:
Nuitka:WARNING:testclient.py:1: Cannot find 'zmq' as absolute import.
When I run the exe the run time error is:
ImportError: No module named 'zmq'
Am I doing something wrong or is there an incompatibility with nuitka and zmq? ( The testclient.py works fine in the interpreter. )
Can anyone help with fixing this? ( I post this here instead of emailing the Nuitka author directly so others can learn from my difficulties aswell )
Using Ubuntu 14.04 and Python3.4.
Edit: Having similar problems using Windows 7 with Anaconda Python 3.4.
Extract egg packages so that plain .py files are accessible.
You can do it by adding
[easy_install]
zip_ok = false
to your ~/.pydistutils
and reinstalling dependencies.
For some reason nuitka 0.5.14.3 does not like compressed .egg files
I am using Ubuntu and virtualenv, and I am having this recurring problem, while attempting to use Fabric to create a deployment script. Fabric depends on paramiko, which depends on PyCrypto.
Each time I try to use Fabric, or PyCrypto directly, I get this error:
ImportError: cannot import name Random
I have tried reinstalling with pip install -U PyCrypto. I have also tried installing the python-crypto and python-crypto-dbg packages with Aptitude, to no avail. I still get the same error. Anyone have any ideas that might help me solve this problem? Thanks in advance!
It's possible that there's a file name collision in your the directory from which you're running Fabric. Do you have a file called Crypto.py in your project?
Can you get Crypto.Random to import from outside of your project directory? (but still using your virtualenv. Ipython is a big help here.)
I've had the same trouble in the past using Ubuntu. I no longer have a Ubuntu install available, but on my old 10.04 box, the file Random in the Crypto directory was missing. Make sure it exists, if it doesn't, that's the problem.