I built a python based program. Prior to this project, I have not run a python program from an exe, but I needed to run this project from an exe on a Windows 10 machine. Using pyinstaller I created and tested the final project without issue, but as soon as I set it up on another computer, it returned an "Importing the numpy C-extensions failed" error message. This seemed weird because I did not receive this error on my computer. So I created a clean installation on a VM, and no error. The other system has python installed, but the version is the same as the one I am using on my computer. Regardless of the installed python version, I thought pyinstaller created a stand-alone python environment.
Is there something I should check or compare between the two systems?
Additionally, my system and the VM started the program without a Windows Defender popup, but the problematic system shows a "Windows protected your PC" popup that needs to be bypassed. Is there a Windows defender setting that might be causing this issue?
Thank you to anyone who has information on this issue. I am fairly new to Python and could use any positive advice available.
I have run the program on a clean VM, with no issues. After some research, I tried uninstalling and reinstalling the numpy on the problematic system, but the issue persists. I cannot figure out what is casuing the error on one system but not any others.
I'm trying to use processing-4.0b6-linux-x64 for Ubuntu 20.
It works well with Java and p5.js. Unfortunately it does not work at all with Python.
When I run the app from the terminal by ./processing, a sort of warning appears from the command line:
does not exist
created registry at port 8220
could not create registry; assume it's already created
Anyway, the GUI works well, but running a very simple code:
def setup():
size(800, 600)
def draw():
pass
does not work and I receive the following list of errors:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: 'java.lang.String processing.app.Sketch.getMainProgram()'
at jycessing.mode.run.PdeSketch.<init>(Unknown Source)
at jycessing.mode.PyEditor.runSketch(Unknown Source)
at jycessing.mode.PyEditor.handleRun(Unknown Source)
at jycessing.mode.PyToolbar.handleRun(Unknown Source)
at processing.app.ui.EditorToolbar$1.actionPerformed(EditorToolbar.java:135)
at processing.app.ui.EditorButton.mousePressed(EditorButton.java:191)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6623)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
at java.desktop/java.awt.Component.processEvent(Component.java:6391)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4572)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
I have java
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
and javac
javac 11.0.13
already installed. Any suggestions?
It's just a regression in the beta 6 release: a method was removed that Python Mode was still using.
It was already reported here and fixed for beta 7 (when that's available), or if you build from source.
Processing 4.0b6 runs on Java 17.0.2, which is bundled with the app. You shouldn't use your own java runtime.
Assuming that this is still a beta, and devs experience similar issues,
I would recommend you ensure that is run on bundled java.
Maybe try on another platform.
And finally, submit an issue to their GitHub
I have been trying to figure out this problem for few weeks now, but am still stuck. I have been researching it and slowly getting more information but have not been able to solve it yet.
I have read these similar questions on Stack Overflow:
dyld: Library not loaded: /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Python
dyld: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Resolving PyCharm python error - dyld: Library not loaded
The problem is that every time I launch PyCharm, the error below pops up:
Process: Python [15298]
Path: /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 3.6.4 (3.6.4)
Code Type: X86-64 (Native)
Parent Process: pycharm [14715]
Responsible: pycharm [14715]
User ID: 501
Date/Time: 2021-03-27 08:19:23.857 -0700
OS Version: macOS 11.2.3 (20D91)
Report Version: 12
Bridge OS Version: 3.0 (14Y908)
Anonymous UUID: 130B1388-444D-6CF3-9D98-7F06C81783B0
Sleep/Wake UUID: 89450DAE-41C7-4035-B0DA-8AAB177D9DD3
Time Awake Since Boot: 82000 seconds
Time Since Wake: 1000 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
dyld: No shared cache present
Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
Reason: image not found
Binary Images:
0x100000000 - 0x100000fff +org.python.python (3.6.4 - 3.6.4) <E585A67D-C0DB-448A-2E74-422D61BDC1C1> /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
0x7fff639aa000 - 0x7fff63a45fff dyld (832.7.3) <0D4EA85F-7E30-338B-9215-314A5A5539B6> /usr/lib/dyld
Model: MacBookPro14,2, BootROM 429.80.1.0.0, 2 processors, Dual-Core Intel Core i5, 3.1 GHz, 8 GB, SMC 2.44f6
Graphics: kHW_IntelIrisGraphics650Item, Intel Iris Plus Graphics 650, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x171), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1675.1)
Bluetooth: Version 8.0.3d9, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB 3.0 Bus
USB Device: Apple T1 Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.4
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.4
I believe that this started to occur after updating either my PyCharm installation, Python, or my Xcode Developer tools. From my research, I have concluded that a few possible issues might be causing this to occur.
Something might be broken with my Virtual Environments
Something might be broken with my PATH
Something might be broken trying to manage multiple Python versions on my computer
Some more information about my situation.
At the top of the PyCharm error message it shows the line:
Path:/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
This seems to suggest that PyCharm might be trying to launch with Python 3.6?
When I type the env command in terminal I get the following output:
PATH=/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions
/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/
Versions/3.9/bin:/Users/my_name/opt/anaconda3/bin:/Users/my_name/opt/anaconda3/condabin:/anaconda3/bin:
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/
bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/
bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
A few of the solutions mentioned in previous questions involve either changing the PATH or deleting/recreating the virtual environment.
I am really not familiar with how to do either of these things. Does anyone have any insight on what I can do to stop this error message from popping up every time I launch PyCharm? I am a novice when it comes to Terminal so I am not sure I understand the previous solutions.
Does anyone have any ideas what the problem might be or what I might be able to do to fix this? I have tried reinstalling both Python and PyCharm and neither of these solutions fixed the problem.
Note, I am running:
Max OS: Big Sur 11.2.3
Python 3.9
PyCharm: Community 2020.3.4
Something might be broken with my Virtual Environments
The easiest solution is using a venv - it's standard library and thus the best baseline for virtual enviorments. (For completness it's worth mentioning that historically there have been a number of solutions for this.) As an example creating a venv with the PyCharm GUI is easy, it creates a new interpreter from the base Python interpreter optionally sharing its site-packages. The GUI lets you interface with PyPI to install aditional packages.
Eventually, it's worth learning to do the same using the command line, see venv — Creation of virtual environments. This boils down to 3 commands
Create the venv (since you have Python on your PATH)
c:\>python -m venv c:\path\to\myenv
Activate the venv (this is OS specific, see the documentation)
<venv>/bin/activate
After activating use pip to install any libraries you want
pip install library_name
After having the venv created and activated it's ready to use on the terminal (inside or outside PyCharm), or you can use it with run configurations in PyCharm.
Now, in your case you are also using Anaconda, which manages the packages and the environments for you. But it's important to realize that what Anaconda does for the most part are the above steps wrapped in it's own GUI, see the similarities with Finding your Anaconda Python interpreter path.
Besides this, there's a hard rule that venvs should not be copied or moved. They have hardcoded paths inside them that will break. So, when you create a venv use it in the directory where you created it. The whole point of venvs is that if you break something you simply create a new one on-the-fly. Eventually, you'll want to write your own shell script to automate creating venvs.
Something might be broken with my PATH
PATH=
/Library/Frameworks/Python.framework/Versions/3.9/bin:
/Library/Frameworks/Python.framework/Versions/3.9/bin:
/Library/Frameworks/Python.framework/Versions/3.9/bin:
/Library/Frameworks/Python.framework/Versions/3.9/bin:
/Users/my_name/opt/anaconda3/bin:
/Users/my_name/opt/anaconda3/condabin:
/anaconda3/bin:
/Library/Frameworks/Python.framework/Versions/3.6/bin:
/Library/Frameworks/Python.framework/Versions/3.6/bin:
/Library/Frameworks/Python.framework/Versions/3.6/bin:
/Library/Frameworks/Python.framework/Versions/3.6/bin:
/usr/local/bin:
/usr/bin:/bin:
/usr/sbin:
/sbin:
/Library/TeX/texbin:
/Library/Apple/usr/bin
On macOS/Linux the colon : is used as the path separator. So if we break your PATH environment variable into individual lines we see you have Python 3.9 and Python 3.6 repeated (might be different micro versions, check by running the executable in each directory with python --version). The meaning of the path names is well explained in 4. Using Python on a Macintosh
To avoid any mix-up I only have the latest Python version on my PATH. Any other base Python version I need is chosen transparently by activating the right venv.
You also have the bin paths to Anaconda, check inside those to see what Anaconda makes executable. Besides that you have the normal OS stuff at /Library/Apple/usr/bin which shouldn't interfere with anything related to Python development.
Finally, module discovery is more dynamic than just what's in your PATH. The module search path sys.path gets populated with the path from where you execute a script, meaning any module/package on directory\where_you_execute\python your_script.py is discoverable (you can check it at run-time).
Something might be broken trying to manage multiple Python versions on my computer
Here is where it gets complicated. If you work with different interpreters, package versions, etc...Eventually you'll want to get a 3rd party tool that helps manage all that, which would be Anaconda, or Virtualenv or Poetry or etc...But essentially what all these do is managing venvs adding functionality and complexity, it's important to learn how to create and manage venvs manually to better understand what those tools are doing for you.
Finally, the PyCharm IDE itself is implemented in Java. When you launch the IDE it has its own executable and it's a rare case that something related to a Python interpreter should make the IDE crash at launch. On the up side you know the culprit is one of your Python interpreters, namely from the error message:
Python Version: 3.6.4 (3.6.4)
and the specific error says it all (either the files were moved, or some error broke the links):
"Reason: image not found".
If you can't launch the IDE to solve the problem from within get rid of any references to the problematic interpreter by editing the configurations files. I don't know how to do this exactly, but if you're using Anaconda it should be possible to launch the Anaconda GUI from outside the IDE to also get rid of the problematic interpreter.
As a side note, if you run into problems due to having several interpreters on the PATH use the which python command on bash, or the where python command on Windows. What this will tell you is which Python interpreter on your PATH is being called when you or some application execute python something on the command line.
I don't think this question (or the other linked questions) have enough info to fully diagnose the problem. It would require an in-depth look at the exact Anaconda configurations - but the same error was also reported by brew users.
The most likely scenario is that when you launch PyCharm the list of interpreters gets populated and that calls Anaconda. At one point after upgrading to the latest Python version one of the existing environments became out of synch because it resolved to a previous base interpreter on the PATH (instead of being hardcoded to a specific installation.) Something must have gone wrong by way of an inter-package incompatibility that required a general update, something was deleted, or it was just cached that needed clearing.
Python has a win32service package that seems to allow windows service creation. I have carefully checked available google examples, for example this one:
Is it possible to run a Python script as a service in Windows? If possible, how?
I have placed code into ~/Documents/test.py and executed following under elevated command prompt:
> python test.py install
> python test.py debug
Unfortunately, every example i tried fails with error:
Debugging service TestService - press Ctrl+C to stop.
Error 0xC0000005 - Python could find the service class in the module
AttributeError: 'module' object has no attribute 'AppServerSvc'
(null): (null)
I have tested it with latest version of ActivePython (2.7.2.5 32-bit) on Windows 7 64-bit and Windows 8 64-bit. Of course, if service is started maually via service manager, it will not start either.
Am i doing something wrong or Python is not intended to be used for service creation on modern operating systems? Maybe i need a specific version of windows/python/pywin32? Of course, i can manually test all combinations starting from windows XP but it will take lots of time :(. Maybe someone already has experience with Python and windows services and can hint me what i'm doing wrong?
update
Tested on Windows XP 32-bit virtual macine (same code, same activepython distribution) - same error.
It appears that there is a bug in the ActiveState build for PyWin32. Installing ActiveState python 2.7.2.5 and running the linked sample code above, I get the same error that you are reporting.
But if I download Python 2.7.3 (2.7.2.5 does not seem to be available for download) and add PyWin32 build 214 (ActiveState seems to be using the 214 version of PyWin32). Then everything seems to work just fine. I also tried the latest build of PyWin32 (218) and it also worked correctly.
So I guess you can try reporting the problem to ActiveState (I don't have a support contract with them) and unless you have a requirement for using ActiveState, you can just switch to the standard Python builds.
I have been using services with the standard Python builds for years running on everything from Windows 2000 up to Server 2008 and Windows 7 with no problems. So I have good reason to believe that it will work for you also.
If you want to work with ActiveState to get the problem fixed, then the bug appears to be in their build of PythonService.cpp in the LoadPythonServiceInstance function. I looked at the registry entries that were created and they look fine, it is the PythonService.exe that is failing at loading your class. Based on the error message it appears to have loaded the module correctly and is just having trouble finding the class.
I'm making graphs using scipy on python 2.7 on Windows 7 64 bit. I installed it from http://www.lfd.uci.edu/~gohlke/pythonlibs/.
When running scripts, I'm periodically getting error boxes that say:
Title:
Microsoft Visual C++ Runtime Library
Message:
Runtime Error! Program:
C:\Python27\pythonw.exe
This application has requested the
Runtime to terminate it in an unusual
way. Please contact the application's
support team for more information
And that's it. How do I begin to figure out what is causing this error?
You could consider installing Visual Studio, and build and install Python and SciPy with debug symbols. When Python subsequently crashes, if I'm not completely mistaken Windows should be giving you the option of debugging it in Visual Studio.
Otherwise, I'd ask for assistance on one of the SciPy mailing lists.