i'm using cx_Freeze for the first time, and i'm facing an issue with numpy.
after i build the application with cx_freeze, whene i run the .exe file, i got this error in the image
i'm using numpy in my software, and obviously that's what make the problem, i wrote a litte software that uses numpy just for testing, and i built the .exe, and it gives me the same error, any help please ?
I suggest posting your setup.py but guessing based on a similar error I had previously, check that you have included numpy in the build_exe_options["packages"].
Related
I have a rather large python script that I would like to convert to .exe. I use PyInstaller and I managed to import every library needed so now I don't get any error message. My problem is that at some point, the .exe is stuck, so the conversion with PyInstaller didn't really worked. I suspect the issue is related to the PyAutoGui library, but I had to import it to convert my python script (I used pip install).
Does anyone else got the same issue? Is there something I can do to remove this issue?
I have python 3.9.2 and pyinstaller 4.2 and I am working with windows 10.
The libraries I had to import are : pyautogui, pandas, bs4, pygame, PyQt5, pywin32, winshell, pymysql, sqlalchemy, sqlalchemy.sql.default_comparator, wmi, Pillow, psutil and lxml.
Thanks for your suggestions!
In my experience, PyInstaller has had trouble generating .exe files from python scripts that use graphics libraries such as pygame and PyQt5. Mostly, it fails to generate the .exe and even when it does, the .exe takes a long time to load up and is really slow. If you want an .exe file, I would suggest trying out cx_freeze. To my knowledge, it won't generate .exe in one file like pyinstaller does, but the .exe file it does generate is of much higher quality.
We think we found the issue: pyautogui needs an other package called open-cv to work. Hope it'll help someone someday ;-)
I am using Django and Python with Anaconda. At the beginning, I was able to migrate by the addition of a sqlite3.dll file. However, when I try to migrate again, it gives me this error. I have tried uninstalling and installing both numpy and pandas in Project Interpreter. I'm using Pycharm and I'm using Conda Package manager with the Conda environment. I also tried migrate --run-syncdb but it still gives me the error.
How would I fix this to be able to use .objects.bulk_create()?
To fix .objects.bulk_create(), one recommendation was to run migrate --run-syncdb and I cannot run it currently because of the error below.
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\PuTung\anaconda3\envs\swe_project\python.exe"
* The NumPy version is: "1.19.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.```
I'm working on my first gui exe. I'm using the anaconda packages with spyder and the code works fine there. Math, pyplot, numpy, tkinter, and PIL are imported, and the app is fully functional with the exception of pyplot which will not show up when activated from a button widget.
If instead I create a simple exe with the code:
import numpy
import matplotlib.pyplot as plt
x=numpy.linspace(1,100)
fig,ax=plt.subplots()
lineData,=ax.plot(x,3*x)
I get one error during the initial build:
ModuleNotFoundError: No module named 'Crypto.Math'
and many warnings, but note that the analysis warning file contains no errors either.
Running the created exe, I get failure and cmd exits. Running from cmd initially instead and turning on debug and verbose imports yields tons of warnings, but no errors.
I've tried including hidden imports like 'matplotlib.pyplot','matplotlib','Crypto', and importing Crypto, to no avail. Crypto is not being called anywhere and the reference plot in the build folder says only pyinstaller imports it. I'm at a loss here for what the problem could be.
Packages in anaconda folder
Ok, so it turned out to be a simple fix. lineData,=ax.plot(x,3*x) will plot/show the figure in spyder/Ipython, but not when called in the exe or python standalone, so I had to add plt.show().
From there I made a virtual environment with the latest packages and needed to
downgrade numpy to 1.16.2 per this thread, and now everything works.
If I include numpy in my script the bundle application does not even open. However, if I run the application from the console everything is fine. So:
pyinstaller -w myScript.spec
with import numpy as np in one of the modules does not create a proper executable. However:
python3.7 myScript.py
runs without problems. Even more, if I comment the import numpy as np line the executable is created without problem. I have also used numpy in another console-only script without problems.
So, how can I make PyInstaller include numpy in the bundle app?
I checked the warn-myScript.txt file from PyInstaller and there are lots of modules from numpy.core that are not found, for example: numpy.core.sqrt.
But I have no idea where to find these modules.
I tried doing what j4n7 suggested here, but it did not work.
I am using Python3.7, numpy 1.15.4 and PyInstaller 3.4
I installed Python from the Python web page and numpy and Pyinstaller using pip.
In a different computer I installed Python3.7 from homebrew and I have the same problem
I installed miniconda and then created an environment with numpy 1.15.4, Pyinstaller 3.4 and python3.7.1. Within the environment, I can create the bundle app with no problem.
However, the bundle app goes to 600MB. I will start a new question regarding how to reduce the size of the bundle app.
i am trying to create an executable from my python script. My script runs fine, but after freezing it, starting the .exe gives me the following error:
http://www.bild.me/bild.php?file=4663406scipyerror.png
I am using Python 3.2.3, Scipy 0.12.0b1, Numpy 1.7.0 and Matplotlib 1.2.0 (all 32bit).
Any ideas/hints on how to solve this? My guess is i have to include something manually in my freezing script, but i am running out of guesses :-(
I got it finally to work, but I am very unsatisfied with my solution:
1) copy _odepack.pyd and odepack.py from the SciPy package to my program folder
2) in odepack.py change from . import _odepack to import _odepack (otherwise ValueError: Attempted relative import in non-package is raised)
3) in my main change from scipy.integrate import odeint to from odepack import odeint
Now it is working as expected and after using cx_freeze it is still working.
Still got no idea why it would not work before :-(
Thanks ThomasK for pushing me in the right direction though :-)
I finally got around this vode-problem by specifying "scipy.integrate.vode" as an include in the cx setup-file. This resulted in a file "scipy.integrate.vode.pyd" to end up in the build folder. I am using SciPy 0.11, Python 3.2.3 and the latest cx on Windows.
But adding such a "scipy.integrate.vode" file manually to the build folder would not fix the problem for me either, even though such manual-include-fixes were needed for many other .pyd files cx could not find either (and whereby the above setup.py include-solution would not work instead)...
Thanks for sharing your distress and wisdom, would not have managed to freeze my program otherwize...