pyinstaller rejects numpy on Mac (M1, Big Sur & Intel Catalina) - numpy

pyinstaller have been working fine for me in this program until I began using numpy. The error message seems to be saying that I'm using the wrong version of numpy. I supposed that to mean that version I'm using isn't for the M1 chip. But I've also tried this on an Intel MacBook Air to no avail. Same error message there. And I looked at the material and the error message refers us to, and tried that too. Ie, I ddid a pip install of cython, etc. But.... still no go, and same error message. I'm making the program in Pycharm, and have tried this using both its venv environment and also the conda environment.
Both give the same result. Ideas anyone?
Here's the error message:
Please note and check the following:
The Python version is: Python3.9 from "/Users/abMain/zaad/zaad"
The NumPy version is: "1.21.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen(/var/folders/n1/26fjs9wx6hz5q9r5kdt5bn3w0000gp/T/_MEIJmdMCM/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): no suitable image found. Did find:
/var/folders/n1/26fjs9wx6hz5q9r5kdt5bn3w0000gp/T/_MEIJmdMCM/numpy/core/_multiarray_umath.cpython-39-darwin.so: mach-o, but wrong architecture
/private/var/folders/n1/26fjs9wx6hz5q9r5kdt5bn3w0000gp/T/_MEIJmdMCM/numpy/core/_multiarray_umath.cpython-39-darwin.so: mach-o, but wrong architecture

Related

OSError: WinError 193 %1 is not a valid Win32 application

I have been working on a project in Visual Studio Code with Python 3.8.5, and I have a windows 64 bit operating system. I decided to upgrade to Python 3.11.1, and downloaded the official 64 bit installer and followed the instructions. All the packages I import at the beginning of my project that were previously working now give this error "[WinError 193] %1 is not a valid Win32 application" when I run the import statements for them.
For some of the packages (pandas, numpy, matploblib) this was solved by using an approach I saw on a few similar questions to this, by opening the command prompt and typing "pip uninstall pandas" etc and then doing "pip install pandas".
However, for the other packages (sklearn, umap, nltk), this isn't working even after trying that process a few times. I've also tried updating pip. Does anybody have any ideas on what could be causing this to work for some packages but not for others? It allows me to install all of the packages via the command prompt, the issue only arises when I actually try and import them via VSCode, and it's the same error for every package. I've seen some suggestions saying to ensure the environment path is clean, but I'm still quite a beginner so I'm a bit unsure as to what that means.
Any help would be really appreciated.

Psychopy stack smashing detected

I am trying to execute the following basic psychopy (version 2021.2.3) code through the Python 3.6.13 console:
import psychopy.visual as pv
pv.Window()
Which gives the following error.
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
The only related topic I can find is on the psychopy forum with no answers
I'm running this on an Ubuntu 18.04.05 machine. The machine is initialized as a headless server, but I am trying to run this through RDP.
I installed psychopy using pip inside a conda environment. Initially I was getting errors related to wxPython. When I manually installed wxPython from a whl file that error was resolved and error in this question appeared.
My guess is that this is to do with the version of one of the libraries but very hard to tell from this limited info.
What version of PsychoPy are you trying to install and by what means are you installing it? Are you running from the app or is this a script you're trying to launch from the terminal? ie. trying to work out what parts of PsychoPy this is affecting (the app, the visual lib, the gui libs...?)
I had a very similar problem on ubuntu 18.04.5, psychopy 3.2.4, no headless server. I suspect that the problem is general but ubuntu/drivers related.
My solution was to update the system and to install&switch to a proprietary NVIDIA driver.

Troubles installing Pandas on Mac Book Pro with M1 procesor

I switched from Windows NTB to MacBook Pro with M1. And I am not able to install Pandas, some issue with missing wheel for numpy. I am using Python 3.9. I went through various solutions presented here like this one below, but none work for me: https://stackoverflow.com/a/66048187/16324084
This one was one of the most explanatory, but I went through all steps, but when I run some code I will get this error message:
ModuleNotFoundError: No module named 'pandas'.
As I am new with Apple, no idea what is conda or roseta, so please can somebody write me what I should do to get Pandas installed and working? And please try to explain it as a small child, thanks.
I recommend you install Anaconda, a package manager. Instructions here. I have all of my packaged managed through this on my Big Sur m1 silicone MacBook pro and have not had issues since switching over from Intel.
Once you have installed anaconda, open terminal and run:
conda install pandas
More info on using anaconda here

pyinstaller with matplotlib windows

I use pyinstaller in generate pythion program with matplotlib a exe file
The exe is generated well but when use the exe, there is a error said no module named 'tz'
what does it mean?
I have test the pythinstaller with program with numby and pyqt4 without matplotlib, it worksenter image description here well! )
I have find the solution on pyinstaller git hub provided by Cecil Curry.
It is:
This is a known issue. python-dateutil 2.5.0 is currently broken with respect to PyInstaller, unfortunately.
Until python-dateutil issues a new stable release correcting this, consider temporarily downgrading to python-dateutil 2.4.2. Apologies for the mild inconvenience – and thanks for taking the time to report this, nonetheless.
I have tested and it works

Mac OS Snow Leopard, IPython Notebook matplotlib backend mismatch with libpng

The other day I was trying to delve deeper into this question and provide some insights. Maybe with the additional insights it can finally be solved.
Things to note:
Installing a different Python version is not an option for me (I'd do it in a heartbeat) because I need to use the Gurobi linear programming solver.
matplotlib is compiled with libpng 1.5.14 and linked at runtime just fine. In the IPython console I can use it to plot png figures perfectly.
Because of the previous point I believe the error must occur with the backend used in the IPython Notebook which is also compiled with matplotlib.
I'm trying the whole thing with the source for matplotlib 1.3, if someone can make it work with a previous, not too old version I'd be happy, too.
So, when I try to plot something in the Notebook I get the normal text output from matplotlib put no figure. In the terminal where I started the notebook, I can see the following error:
libpng warning: Application built with libpng-1.2.41 but running with 1.5.14
Since I concluded earlier that the problem must lie in the backend, I checked what libraries are linked there:
otool -L /Library/Python/2.6/site-packages/matplotlib-1.3.0-py2.6-macosx-10.6-universal.egg/matplotlib/backends/_tkagg.so
The output on my system was:
/Library/Python/2.6/site-packages/matplotlib-1.3.0-py2.6-macosx-10.6-universal.egg/matplotlib/backends/_tkagg.so:
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 8.5.0, current version 8.5.7)
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.7)
So the likely offending candidates are Tcl and Tk. Then I ran:
find /System -name libpng\*
and indeed I find:
/System/Library/Tcl/8.4/Img1.4/libpngtcl1.2.24.dylib
/System/Library/Tcl/8.5/Img1.4/libpngtcl1.2.24.dylib
as well as Python shipping its own:
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/libpng.3.dylib
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/libpng.dylib
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/libpng12.0.dylib
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/libpng12.dylib
I went ahead and downloaded the source code for Tcl/Tk 8.6 and compiled them myself in the hope of them compiling against libpng but that wasn't the case. I still got the same error:
libpng warning: Application built with libpng-1.2.41 but running with 1.5.14
When I compile matplotlib it says that due to patches it ships its own libagg and I can't find which tkagg it is using, so maybe that's where things go wrong? Or is the Python 2.6 provided by the system compiled with Tk which is linked against that older libpng?
I guess I could try compiling matplotlib against the libpng version of Tcl/Tk 8.5 or against the one available in the Python framework and see if then both run on libpng version 1.2.41.
Does anyone know where in the backend this might occur and how to fix the compilation to use the right libpng version?
Have you solved the problem yet? I have a similar issue, and I solved it by temporarily renaming the folder containing the header files of libpng shipped with Python (in my case, it's X11) when building matplotlib. After installing matplotlib, rename the folder back.