I am currently facing the issue, that multiprocessing in python with fork as starting method causes a crash on Catalina. The same Code worked perfectly fine on Mojave, even without the classic workaround OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES. This line does not seem to have any effect in Catalina anyway. The crash does not result in any catchable exception or traceback, so i am very sorry but i cannot provide more information. It occurs whenever the forked process uses openMP threading, id est spawns threads itself. Does anyone know how to fix the forking behaviour on Catalina ? Using another starting method is probably not an option since i am dealing with none pickable objects.
its kinda hard to determine your cause without a Crash Report.
Attempt this to find your crash reports:
Open the Console application:
Type “Console” into Spotlight or navigate to “Application -> Utilities -> Console.app.” then Click on Crash Reports.
I had similar issue, where Python kept crashing when i was running Ansible, on Mojave..the classic fix was to add "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES"
However, with Catalina this was not the fix for me any longer. I had to deal with missing links to libcrypto openssl on OSX, The openssl this did the trick for me.
Try this script (or run the commands manually) if you indeed have an OpenSSL issue:
https://gist.github.com/cpavlatos/265d5091a89148eec1cfa2d10e200d32
Note: Prior to running the above script, you might want to cd to /usr/local/Cellar/openssl/ and see what version you have then change the script accordingly.
Also, worth checking is this thread:
https://github.com/Homebrew/homebrew-core/issues/44996#issuecomment-543945199
Summarized better here:
https://gist.github.com/llbbl/c54f44d028d014514d5d837f64e60bac#gistcomment-3115206
Related
I have a PyQt application that occasionally will crash due to memory issues with the error shown below
The instruction at 0X00007FFC450FA07 reference memory at 0X0000000000000048. The memory could not be read.
I personally have not been able to reproduce this error in any way. It has happened on the computer's of a few people I work with while running my application. I have looked and see a lot of questions for languages like C# or C++, and it seems to be a pointer issue. Since I am using Python though, these questions and solutions are not very relevant since Python does not use pointers.
Seen here: C# example question the problem here is a long running thread. I do use threading in my application so I have been looking there. I have ran my application many times with the task manager open to monitor threads and have not seen any problems. All threads seem to close. If there is a better way to monitor this please let me know.
I am using PyCharm and my Python version is 3.9. I am also using Pyinstaller to create an executable version of the application. I have ran the program using the command line, launching the executable, and also directly through PyCharm and have not been able to see the error at all or debug it.
Is it possible this is happening due to bit related issues? Meaning that I am compiling my code using a 32-bit version of Python, could some computers have a problem with that? Would compiling with a 64 bit version possibly solve this?
So I'm working on a Python 3 package and some functionalities are tested within scripts that can run for several hours/days on a remote machine.
Before I started using multiprocessing (on Windows), there was no problem editing the source files, then starting the script and continue editing, because all the imports are resolved immediately and all the code remains in memory unchanged.
With multiprocessing I'm getting syntax errors etc. when I'm in the middle of editing a file and the running script hits an import statement.
What is a safe way to edit my Python sources that doesn't interrupt my programming workflow too much?
I like the fact that I can try out ideas quickly and I don't want to add too many steps between making changes to the code and running it on the remote machine.
My ideas:
Use version control and work on a local copy on my local machine. Problem here: I have to do some of the debugging on the remote machine so I would have to push even minor changes while looking for small mistakes.
Use version control and work on a copy on the remote machine. Problem here: If I understand this correctly, I would have to switch between a "debug" and "test" conda environment. Seems a bit tedious also.
Find a solution to the multiprocessing issue .....
I'm sure there is a way to do this right, can you help me out?
I'm trying to do the exact same thing as this question:
How to prevent a block of code from being interrupted by KeyboardInterrupt in Python?
(sorry, not enough rep yet to post this as a comment there)
However both of the top answers posted there aren't working for me. When I hit CTRL+C with either of those solutions in place, the script still closes immediately with:
forrtl: error (200): program aborting due to control-C event
The code I'm working on is fairly long and includes quite a few imported modules. Am I correct to assume one of these modules is interfering with the normal behavior of KeyboardInterrupt? If so, how can I figure out which one?
(I'm running python 2.7.6, 32bit on Windows)
thanks.
Scipy was causing the problem. The link below provides a solution, note that this is not unique to scipy.stats, but also occurs with other scipy functions.
Ctrl-C crashes Python after importing scipy.stats
A part from those specific cases above (question and above answer), for those of you still stuck in this
forrtl: error (200): program aborting due to control-C event
trying to obtain a normal behaviour of CTRL+C KeyboardInterrupt during the execution of a program (in my case it's a training procedure of neural network model with PyTorch executed within PyCharm IDE on Windows 10 and anaconda python3.8).
It turned out to be a problem of corrupted anaconda environment or either some package within. For me, reinstalling the previous version of PyCharm (downgrading from 2022 to 2021) and replacing the old environment with a brand new one, solved the problem. The KeyboardInterrupt turned back to its old useful behaviour, stopping the program but not exiting the python console at CTRL+C event.
Hope it helped someone.
I am experiencing a very similar problem to this one:
Using multiple versions of Python
The context of my problem though I believe is different enough to warrant a separate question. I receive this error when trying to launch the non-commercial version of The Foundry's Nuke. The error manifests similarly to this:
http://community.thefoundry.co.uk/discussion/topic.aspx?f=197&t=113695
,except the error message returned before the command prompt immediately closes is that displayed in the first link. This leads me to believe that Nuke is trying to access the wrong version of Python (currently it is trying to access
Python 3.5).
Assuming my line of thinking is correct, how can I change the version of Python that Nuke is attempting to access? None of the advice in the Foundry forum link proved successful either, I should mention. And according to what I have read,the latest version of Python to be used by Nuke is 2.7. So to ask the question more specifically, how can I make Nuke access Python 2.7 as opposed to Python 3.5? Both are installed on my desktop, 64-bit Windows 10.
The syntax error returned as the prompt closes and Nuke fails to launch
I have removed PYTHONPATH from System variables and Nuke9.0v8 non-commercial now appears to function properly. As this has not caused any problems with other applications and programs that rely upon Python 2.7 or 3.x, I believe this solution was sufficient in solving the problem I initially proposed. Previously I had specified the location of Python 3 within the Path variable, and this I have NOT modified. I imagine that this solution should be applicable to any software that generates the error message linked in the question.
I have had trouble setting up the pycharm ide on my macosx10.7 with python3..
I have scoured every resource available and tried hundreds of approaches, at this point I must accept my incompetence and seek help via this channel.
In my research, I notice a lack of ground-up explanations on python integration into macosx and how to configure pycharm to import modules, run code within the editor, etc. If i ever solve this I will make a very detailed tutorial.
I have imported python3 successfully, it looks like it is linked appropriately from /sys/lib/frameworks to /usr/lib ...etc -- version control is working just fine.
I think my issue is either in setting environmental variables (tried the program to fix this and tried macports) and in the script needed to execute. it will catch errors throughout but final product does not run in python and returns printout of :
/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /Users/anon/Desktop/pythonpractice/Py_Ex/classes.py
Process finished with exit code 0
i really need to get this configuration sound for my python programming class. please help (I've been through every line of pycharm website) .. preferably is there a way to map it via terminal? thanks for anyone who took the time to read this.
Summary of the discussion above:
Python 3.2.2 installation was broken on this Mac, installing ActiveState Python 3.2.2 from scratch and configuring it in PyCharm has fixed the problem.
Python path to be used in PyCharm settings: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3
Incompatible third-party plug-ins may break PyCharm, uninstall/disable them in Preferences | Plugins.
Ensure the latest PyCharm version is installed.
User's code depends on the graphics.py module which was not in the project or in the PYTHONPATH. Putting it into the project has solved the problem.
Most likely the wrong Run/Debug configuration was used in PyCharm, the easiest way to run or debug such scripts is by using the editor context menu Run and Debug actions. PyCharm creates the configuration automatically and debugging works fine as shown of the screenshot:
If one wants to configure and debug it, he can use the code.zip file to get started.
Sorry for the comments mess above, but it was not possible to move it into chat as user had only 1 reputation point, hence not able to use the chat feature of StackOverflow.