-
Notifications
You must be signed in to change notification settings - Fork 11
multiprocessing producing EOFError #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks @DavidEHayden. I am travelling for work right now, but will look into this in a couple of days. It looks like an upgrade to a dependency has created a conflict. Can you confirm your operating system? I can likely fix this problem by figuring out the offending dependency and pinning the version. |
Thanks @DavidEHayden. That should help. I have just updated the macOS testing on github actions to python 3.10 to test it there. An update to a dependency has definitely broken something. Not only does numpy not seem to install in the macOS testing, the Linux tests are now failing. The only thing that will have changed since tests were last run are to the dependencies. I suspect it's the update to numpy a few days ago that has broken things. This should be easy to fix |
Hi @DavidEHayden. I've just got testing working for Python 3.10 on Monteray: here. It seems to work fine. Tests were actually failing because the package uses CDO as a system dependency and an update to CDO caused one of the tests to fail. So nctoolkit definitely seems fully compatible with the latest versions of packages on pypi. Based on your error, the difficulty is caused by importing nctoolkit dependencies. nctoolkit itself is not the issue. Though ideally I want to be able to ensure problem-versions of dependencies are excluded when installing nctoolkit. Are you able to import multiprocessing? You are using an old(ish) version of pip, so it's possible something is going wrong at that end. |
I am experiencing the same error on Mac M1 running Ventura 13.4 and python11 (through mamba + pip git). Showstopper for verifying your submission to JOSS openjournals/joss-reviews#5494 |
I am unable to reproduce this problem @platipodium. I've set up a Mac M1 testing environment on CircleCI and the tests passed OK. This was done with Python 3.11 and Ventura, and the pypi version of nctoolkit. Test output available here CircleCI config and install methods here. Can you provide further info on your environment @platipodium? I can figure out if there is a problem with specific dependency versions. This is an error from subprocess, not nctoolkit. So this is almost certainly something external to nctoolkit, but one that maybe needs solved by dependency pinning. |
My reproducible installation: Steps to reproduce
|
But my bad, I tried to run nctoolkit as part of a script ...
So I guess I am not supposed to do that? |
Working interactively is fine :=)
|
OK, I'm able to reproduce the scripting issue @platipodium. I've pinned it down to behaviour in the subprocess package. This script (pure subprocess) fails in macOS when it is run in a script: https://github.com/robertjwilson/nctoolkit/blob/master/testing/test_scripting.py. However, running it interactively or from pytest is totally fine. On linux, no problems at all. I'll investigate this today and see if there is a workaround. This only applies to doing things in parallel in nctoolkit, so if it's a bug in subprocess without an easy workaround, I can just turn off the ability to do things in parallel in macOS for now. |
@robertjwilson I think it would be totally fine to document this properly or catch it when the script is trying to execute on macOS in parallel. While it is not fixed, of course. |
I have released version 0.9.3 which should fully resolve this issue @platipodium. The problem appears to be a bug within multiprocessing on macOS. After investigating it for a couple of hours, I found a simple solution is to just replace multiprocessing with multiprocess. All that was needed to fix the issue was to change the import from https://github.com/pmlmodelling/nctoolkit/blob/master/testing/test_parallel.py The new version is on pypi and conda. This should sort the issue out, but ideally I don't want another dependency, so I'll keep this open or open another issue to figure out how to drop multiprocess. |
The error persists for me, after updating to 0.9.3
So it is still loading |
Please create a new issue for this, such that we can close this one and it appears on the JOSS review issues as closed, as well. Once this is fixed :=) |
Can you double check that @platipodium? It looks like your pip install has not actually installed the latest version. Line 7 in session.py is actually blank. https://github.com/pmlmodelling/nctoolkit/blob/master/nctoolkit/session.py I think you need to add --force-reinstall or something to that effect to the pip call. |
Sure, but just FYI:
So the version seems to be the updated one ...
So without an apparent change in the version, the issue is now fixed. So something is off, but this issue can be closed. |
This appears to have been fixed. I will close it for. If @DavidEHayden is still having it I will reopen. |
Using a fresh install of python 3.10, I install numpy and then nctoolkit using pip3, as per the installation instructions. Then running "import nctoolkit as nc" I get the following error:
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/spawn.py", line 125, in _main
prepare(preparation_data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 289, in run_path
return _run_module_code(code, init_globals, run_name,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/davidhayden/Desktop/Dataset/PythonProject/main.py", line 2, in
import nctoolkit
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/init.py", line 1, in
from nctoolkit.api import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/api.py", line 18, in
from nctoolkit.cleanup import cleanup, clean_all, temp_check
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/cleanup.py", line 9, in
from nctoolkit.remove import nc_remove
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/remove.py", line 2, in
from nctoolkit.session import session_info, get_tempdirs, get_safe
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/session.py", line 7, in
mgr = Manager()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 57, in Manager
m.start()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/managers.py", line 562, in start
self._process.start()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 288, in _Popen
return Popen(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
Traceback (most recent call last):
File "/Users/davidhayden/Desktop/Dataset/PythonProject/main.py", line 2, in
import nctoolkit
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/init.py", line 1, in
from nctoolkit.api import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/api.py", line 18, in
from nctoolkit.cleanup import cleanup, clean_all, temp_check
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/cleanup.py", line 9, in
from nctoolkit.remove import nc_remove
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/remove.py", line 2, in
from nctoolkit.session import session_info, get_tempdirs, get_safe
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nctoolkit/session.py", line 7, in
mgr = Manager()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 57, in Manager
m.start()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/managers.py", line 566, in start
self._address = reader.recv()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/connection.py", line 255, in recv
buf = self._recv_bytes()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/connection.py", line 419, in _recv_bytes
buf = self._recv(4)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/connection.py", line 388, in _recv
raise EOFError
EOFError
I have tried to reinstall python and tried different virtual environments however I always get the same error.
The text was updated successfully, but these errors were encountered: