Error executing the result of cx_freeze using pycrypto - cx-freeze

I am trying to freeze a Little python program using pycrypto library in Windows. Last version of everything including cx_freeze.
After running >python setup.py build apparently everything goes nice.
But running the exe file generated reports the following error : ImportError: cannot import name _AES
The error is reported by AES.py file which is part of pycrypto lybrary.
I have copied the pycrypto structure in the same directory where setup.py is and I played with the contents of setup.py making a lot of subtle changes but I always get the same error.
Does someone know what I am missing?

Related

PyMesh problems with Setup on Windows10 and Error using Docker Version

I want to install PyMesh on a Windows 10 PC, if possible it should be installed in the side-packages of an interpreter delivered with the IDE we use.
I tried the way to run the setup discribed here
https://pymesh.readthedocs.io/en/latest/installation.html
so the part :
git clone https://github.com/PyMesh/PyMesh.git
cd PyMesh
git submodule update --init
worked without any problems.
I am not sure on windows if I now just can write
set PYMESH_PATH = path
and if i can use the path "...\PyMesh\PyMesh" here?
so i left out this part
I installed numpy and scipy (allready installed)
and nose because it is mentioned in the requirements.txt.
So my numpy scipy and nose versions are
numpy 1.19.1
scipy 1.6.0
nose 1.3.7 (same as requirenments)
and just run the setup.py with admin rights
python .\setup.py install
which also seemed to work but i got an error trying
python -c "import pymesh; pymesh.test()"
from the PyMesh folder
saying ModuleNotFoundError: No module named 'PyMesh'
or if i go up one Folder doing the same
saying AttributeError: module 'PyMesh' has no attribute 'triangle'
I found this link ImportError: No module named PyMesh
but i just dont know what i should type in there
I tried to install via pip by using pip install pymesh
but pip Installer gives me a different library.
So i tried in the docker version and in docker i tried the pymesh.load_mesh method with an stl File
but got
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
I dont know if this is just the stl format (expecting binary getting ascii or vice versa)
The stl file itself can be opened so shouldnt be corrupted.
So is there a different way to install pymesh? A wheel would be great. Is it possible to install pymesh to the side-packages of a given Interpreter? Did someone else allready had the same error in Docker and knows the issue
thank you for your help

Installing python Github package error: package directory 'src' does not exist

I am new at installing external Github packages into python.
I successfully cloned a package by running the command
git clone https://github.com/vishnubob/python-midi.git
However, when I ran
python setup.py install
I received the error:
No sequencer available for 'win32' platform.
C:\Python27\lib\site-packages\setuptools\dist.py:341: UserWarning:
Normalizing 'v0.2.3' to '0.2.3'
normalized_version,
running install
running bdist_egg
running egg_info
creating midi.egg-info
writing midi.egg-info\PKG-INFO
writing top-level names to midi.egg-info\top_level.txt
writing dependency_links to midi.egg-info\dependency_links.txt
writing manifest file 'midi.egg-info\SOURCES.txt'
**error: package directory 'src' does not exist**
Is this a directory problem? And is there another approach to install this package (possible via pip)?
The readme on git hub has: "I am extremely interested in supporting OS-X and Win32 sequencers as well, but I need platform expert who can help me. Are you that person? Please contact me if you would like to help."
So it is simply not supported on Win32.

pyinstaller gives weird errors when compiling pandas

UPDATE june 18:
I would like compiling my python code for windows.
I use to work with pyinstaller, python 3.5+, windows 7 and anaconda to control modules pandas, pyqt (v5) and pyqtgraph, but it seems something is not compatible. I would not be surprised if you tell me to change a version.
In previous versions, it worked with python 3.5, windows 7 and Pyinstaller 3.3.1- without pandas; the new version imports pandas and then this doesn’t work anymore:
with the usual config pyinstaller gives a message saying the C libraries are not built. Following the instructions, I should run python setup.py build_ext --inplace --force, except I don’t see the setup.py file, so I don’t know what to do. Forums tell me it should be a problem with pip but not with conda… but I use conda…
with python 3.6, I got an error message ‘RecursionError: maximum recursion depth exceeded’ (https://github.com/steph2016/profiles/blob/master/errorMessage). This problem seems known and solutions I found on forums is either to downgrade python or to replace my PyInstaller-3.3.1 by PyInstaller-3.4.dev0+7b3143612. But with PyInstaller-3.4.dev0+7b3143612 I get a ’’str’ object has no attribute ‘items’’ error (https://github.com/steph2016/profiles/blob/master/ErrorMessage2). I’m not sure pyinstaller is compatible with python 3.6…
with python 3.4, I got an error similar to the ‘str object’ one above. I’m not sure python3.4 is compatible with qt5…
I would be pleased by any solution with any version of whatever to windows-compile my code
I don't know if it is the issue but I didn't find PyQtGraph in Supported-Packages
I eventually applied the first solution proposed in No module named 'pandas._libs.tslibs.timedeltas' in PyInstaller in the original config (python 3.5, PyInstaller 3.3.1, pyqtgraph, pandas, windows 7,...) and it worked.
I don't know why adding def get_pandas_path ..... a.binaries) helps, so I can't justify. But just to be explicit even if it seems obvious: pyinstaller must be run on the spec file, not on the py one (for instance > pyinstaller toto.spec)

kmpfit module not in Kapteyn v2.2 module list

I am using Python 2.7 through Anaconda 2.7.8 and need Kapteyn 2.2 to perform Non-linear Least Squares fitting easily (it is probably an alternative to Scipy.optimize.leastsq() for dummies like me!).
After copy-pasting this from a previous post here on Stack Overflow:
conda install -c https://conda.binstar.org/dhirschfeld pyodbc
and then running on my cmd (as I did not have pyodbc installed I think, because of which maybe the command prompt on my Windows 7 64-bit system was not responding well to python setup.py install inside the Anaconda directory where I unzipped the Kapteyn .zip file downloaded from University of Groningen website.
But, after the installing pyodbc properly and running python setup.py install, the cmd gave me an error saying error: command 'C:\Users\windows 7\Anaconda\Scripts\gcc.bat' failed with exit status 1. Later, when I tried to import kmpfit module (needed for Non-linear least square fitting with Kapteyn), here is the problem:
import kapteyn
help(kapteyn)
Help on package kapteyn:
NAME
kapteyn - Kapteyn package.
FILE
c:\users\windows 7\anaconda\kapteyn\__init__.py
PACKAGE CONTENTS
_ni_support
celestial
doccer
filters
interpolation
maputils
mplutil
positions
rulers
shapes
tabarray
wcsgrat
DATA
__all__ = ['celestial', 'wcs', 'wcsgrat', 'tabarray', 'maputils', 'mpl...
__version__ = '2.2'
VERSION
2.2
As you can see, there is no module named kmpfit (or even wcs) here. But according to http://www.astro.rug.nl/software/kapteyn/intro.html, these two should be there.
Kindly help. I have never imported any module before.
Thanks in advance...:-)
I just managed to get this working (on Mac OSX, so you may have to adjust this). My steps were:
$ conda install pyodbc (didn't need to go through binstar)
Download & unarchive the kapteyn package, then navigate to its directory
$ python setup.py install, which used my OS's C compiler and Anaconda's python, and installed kapteyn to my anaconda distro's site-packages, as it should.
Check that kmpfit.so is in the kapteyn folder in site-packages, showing that kmpfit installed correctly.
>> from kapteyn import kmpfit failed, ImportError: cannot import name kmpfit. I did some digging and discovered that it was still importing kapteyn from the folder that I downloaded, not from site-packages.
Delete the downloaded kapteyn folder, then try again. It worked!

easy_install M2Crypto failing on Windows platform

I am attempting to install M2Crypto on a Windows XP platform. I have Python, easy_install and SWIG installed, but when I attempt to easy_install M2Crypto I get the following:
SWIG\_m2crypto.i(31) : Error: Unable to find 'openssl\opensslv.h'
SWIG\_m2crypto.i(45) : Error: Unable to find 'openssl\safestack.h'
SWIG\_evp.i(12) : Error: Unable to find 'openssl\opensslconf.h'
SWIG\_ec.i(7) : Error: Unable to find 'openssl\opensslconf.h'
error: Setup script exited with error: command 'swig.exe' failed with exit status 1
I have read elsewhere that people have suggested easy_install openssl-devel, but that simply tells me that there are no packages found with that name. Is the name perhaps case-sensitive (I've tried various permutations without success), or does that advice not apply to Windows?
I'm not looking for alternatives to M2Crypto. I am picking up some existing code that uses it, so I need to get my development environment to be able to run what's already written.
As jay stated in his answer you should try to build it from source. And I tried. The setup.py does not recognize the --openssl option. Looking at the output from the default setup.py I realized that the search location was c:\pkg and not c:\pkg\openssl.
The solution:
Download and install OpenSSL from Win32 OpenSSL
Copy the lib and include folders to c:\pkg
Check that swig.exe is available in your path
Run easy_install M2Crypto
Worked for me like a charm.
Had a similar problem. After downloading the source package of M2Crypto and reading the INSTALL file I found the following:
Differences when installing on Windows
--------------------------------------
Before building from source, you need to install OpenSSL's include files,
import libraries and DLLs. By default setup.py assumes that OpenSSL include
files are in ``c:\pkg\openssl\include``, and the import libraries
in ``c:\pkg\openssl\lib``. As with other platforms, you can specify a different
OpenSSL location with --openssl option to build_ext command.

Resources