ray.tune.error.TuneError: The Ray Tune run failed - python

This is from the ray package official code, it works well on Linux systems but appears some errors on windows. All of the ray version is 2.2.0.
import numpy as np
import ray
from ray import air, tune
from ray.air import session
from ray.air.integrations.wandb import setup_wandb
from ray.air.integrations.wandb import WandbLoggerCallback
def train_function(config):
for i in range(30):
loss = config["mean"] + config["sd"] * np.random.randn()
session.report({"loss": loss})
def tune_with_callback():
"""Example for using a WandbLoggerCallback with the function API"""
tuner = tune.Tuner(
train_function,
tune_config=tune.TuneConfig(
metric="loss",
mode="min"
),
run_config=air.RunConfig(
callbacks=[
WandbLoggerCallback(project="Wandb_example")
]
),
param_space={
"mean": tune.grid_search([1, 2, 3, 4, 5]),
"sd": tune.uniform(0.2, 0.8),
},
)
tuner.fit()
if __name__ == '__main__':
tune_with_callback()
And this is printed log with running above python code:
2022-12-30 11:50:41,732 INFO worker.py:1538 -- Started a local Ray instance.
2022-12-30 11:50:46,508 INFO wandb.py:250 -- Already logged into W&B.
Traceback (most recent call last):
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 928, in _wait_and_handle_event
self._on_pg_ready(next_trial)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 1018, in _on_pg_ready
if not _start_trial(next_trial) and next_trial.status != Trial.ERROR:
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 1010, in _start_trial
self._callbacks.on_trial_start(
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\callback.py", line 317, in on_trial_start
callback.on_trial_start(**info)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\logger\logger.py", line 135, in on_trial_start
self.log_trial_start(trial)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\air\integrations\wandb.py", line 527, in log_trial_start
self._trial_processes[trial].start()
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\air\integrations\wandb.py", line 367, in __reduce__
raise RuntimeError("_WandbLoggingProcess is not pickleable.")
RuntimeError: _WandbLoggingProcess is not pickleable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\tuner.py", line 272, in fit
return self._local_tuner.fit()
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\impl\tuner_internal.py", line 420, in fit
analysis = self._fit_internal(trainable, param_space)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\impl\tuner_internal.py", line 532, in _fit_internal
analysis = run(
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\tune.py", line
726, in run
runner.step()
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 981, in step
self._wait_and_handle_event(next_trial)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 960, in _wait_and_handle_event
raise TuneError(traceback.format_exc())
ray.tune.error.TuneError: Traceback (most recent call last):
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 928, in _wait_and_handle_event
self._on_pg_ready(next_trial)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 1018, in _on_pg_ready
if not _start_trial(next_trial) and next_trial.status != Trial.ERROR:
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\execution\trial_runner.py", line 1010, in _start_trial
self._callbacks.on_trial_start(
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\callback.py", line 317, in on_trial_start
callback.on_trial_start(**info)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\logger\logger.py", line 135, in on_trial_start
self.log_trial_start(trial)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\air\integrations\wandb.py", line 527, in log_trial_start
self._trial_processes[trial].start()
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\air\integrations\wandb.py", line 367, in __reduce__
raise RuntimeError("_WandbLoggingProcess is not pickleable.")
RuntimeError: _WandbLoggingProcess is not pickleable.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\shaohan.tian\Desktop\laptop_python_run\wandb_test.py", line 36, in <module>
tune_with_callback()
File "C:\Users\shaohan.tian\Desktop\laptop_python_run\wandb_test.py", line 33, in tune_with_callback
tuner.fit()
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\site-packages\ray\tune\tuner.py", line 274, in fit
raise TuneError(
ray.tune.error.TuneError: The Ray Tune run failed. Please inspect the previous error messages for a cause. After
fixing the issue, you can restart the run from scratch or continue this run. To continue this run, you can use `tuner = Tuner.restore("C:\Users\shaohan.tian\ray_results\train_function_2022-12-30_11-50-36")`.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\shaohan.tian\scoop\apps\miniconda3\current\envs\steel\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
I tried modifying versions of ray and wandb, but it was of no use. Could you help me to solve it?

Related

Why does python p5 give so much errors and warnings?

I'm trying to use the Python Processing port by Abhik Pal and Manindra Mohrarna. It seems to work fine, but it gives lots of warnings and errors and it really bothers me.
WARNING: Traceback (most recent call last):
File "C:\Users\gabri\Documents\Programmazione\Python\p5Sketchbook\test.py", line 10, in <module>
run()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\userspace.py", line 155, in run
p5.sketch = Sketch(setup_method, draw_method, handlers, frame_rate)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\base.py", line 60, in __init__
app.Canvas.__init__(
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\canvas.py", line 211, in __init__
self.create_native()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\canvas.py", line 228, in create_native
self._app.backend_module.CanvasBackend(self, **self._backend_kwargs)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\backends\_glfw.py", line 298, in __init__
self._on_resize(self._id, size[0], size[1])
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\backends\_glfw.py", line 394, in _on_resize
self._vispy_canvas.events.resize(
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 453, in __call__
self._invoke_callback(cb, event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 471, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
<< caught exception here: >>
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback
cb(event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\base.py", line 157, in on_resize
p5.renderer.reset_view()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\renderer2d.py", line 82, in reset_view
self.texture_prog['modelview'] = self.modelview_matrix.T.flatten()
TypeError: 'NoneType' object does not support item assignment
ERROR: Invoking <bound method Sketch.on_resize of <Sketch (Glfw) at 0x1fba232bfd0>> for ResizeEvent
Exception ignored on calling ctypes callback function: <function CanvasBackend._on_close at 0x000001FBA2375EA0>
Traceback (most recent call last):
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\glfw\__init__.py", line 660, in callback_wrapper
return func(*args, **kwargs)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\backends\_glfw.py", line 400, in _on_close
self._vispy_canvas.close()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\canvas.py", line 463, in close
self.events.close()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 453, in __call__
self._invoke_callback(cb, event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback
cb(event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\base.py", line 148, in on_close
exit()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\_sitebuiltins.py", line 26, in __call__
raise SystemExit(code)
SystemExit: None
Traceback (most recent call last):
File "C:\Users\gabri\Documents\Programmazione\Python\p5Sketchbook\test.py", line 10, in <module>
run()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\userspace.py", line 167, in run
exit()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\userspace.py", line 250, in exit
p5.exit(*args, **kwargs)
AttributeError: module 'p5.core.p5' has no attribute 'exit'
Process returned 1 (0x1) execution time : 20.330 s
What does this mean? Why does it happen and is there a way to fix this?

OSError: [Errno 22] Invalid argument | _pickle.UnpicklingError: pickle data was truncated

When trying to train a ResNet I get this error. Any help as to why this happens would be appreciated.
This happens when I try to iterate through the Dataloader:
File "C:\Users\JCout\AppData\Local\Temp/ipykernel_2540/2174299330.py", line 1, in <module>
runfile('C:/Users/JCout/Documents/GitHub/Hybrid_resnet/transfer_learning.py', wdir='C:/Users/JCout/Documents/GitHub/Hybrid_resnet')
File "C:\Users\JCout\anaconda3\lib\site-packages\debugpy\_vendored\pydevd\_pydev_bundle\pydev_umd.py", line 167, in runfile
execfile(filename, namespace)
File "C:\Users\JCout\anaconda3\lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents + "\n", file, 'exec'), glob, loc)
File "C:/Users/JCout/Documents/GitHub/Hybrid_resnet/transfer_learning.py", line 24, in <module>
model, train_loss, test_loss = train.train_model(training, testing,
File "C:\Users\JCout\Documents\GitHub\Hybrid_resnet\train.py", line 70, in train_model
train_stats = train.train_step(model, criterion, optimizer, train_loader)
File "C:\Users\JCout\Documents\GitHub\Hybrid_resnet\train.py", line 121, in train_step
for i, (x_imgs, labels) in enumerate(train_loader):
File "C:\Users\JCout\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 359, in __iter__
return self._get_iterator()
File "C:\Users\JCout\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "C:\Users\JCout\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 918, in __init__
w.start()
File "C:\Users\JCout\anaconda3\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\JCout\anaconda3\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\JCout\anaconda3\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\JCout\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\JCout\anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
OSError: [Errno 22] Invalid argument
I'm also getting this traceback after the error which I find a bit weird since I'm not using pickle at all. The data consists of 2 .tif files and 2 .mat files for the data/targets.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\JCout\anaconda3\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\JCout\anaconda3\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
_pickle.UnpicklingError: pickle data was truncated
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\JCout\anaconda3\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\JCout\anaconda3\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
_pickle.UnpicklingError: pickle data was truncated
Not entirely sure what was happening, but I had
pin_memory = True
num_workers = 4
within the DataLoader. Removing these removed the error.

Tf-Agents ParallelPyEnvironment fails silently

I have written a custom environment so I can play around with reinforcement learning (PPO) and tf-agents.
This works fine if I wrap my env ( which inherits from py_environment.PyEnvironment) in a TfPyEnvironment, but fails if I try to wrap it into a ParallelPyEnvironment. I have tried playing around with all the keyword arguments of ParallelPyEnvironment but the code just runs up to the line and then nothing happens - no Exception, the program does not terminate etc.
Here is my code initialising the environment and showing off the working variant for the eval_env:
train_env = tf_py_environment.TFPyEnvironment(
ParallelPyEnvironment(
[CardGameEnv()] * hparams['parallel_environments']
)
)
# this works perfectly:
eval_env = tf_py_environment.TFPyEnvironment(CardGameEnv(debug=True))
If I terminate the script via CTRL+C, this is what is being output:
Traceback (most recent call last):
Traceback (most recent call last):
File "E:\Users\tmp\Documents\Programming\Neural Nets\Poker_AI\poker_logic\train.py", line 229, in <module>
File "<string>", line 1, in <module>
train(model_num=3)
File "C:\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
File "E:\Users\tmp\Documents\Programming\Neural Nets\Poker_AI\poker_logic\train.py", line 64, in train
[CardGameEnv()] * hparams['parallel_environments']
exitcode = _main(fd)
File "E:\Users\tmp\AppData\Roaming\Python\Python37\site-packages\gin\config.py", line 1009, in wrapper
File "C:\Python37\lib\multiprocessing\spawn.py", line 113, in _main
preparation_data = reduction.pickle.load(from_parent)
KeyboardInterrupt
return fn(*new_args, **new_kwargs)
File "C:\Python37\lib\site-packages\tf_agents\environments\parallel_py_environment.py", line 70, in __init__
self.start()
File "C:\Python37\lib\site-packages\tf_agents\environments\parallel_py_environment.py", line 83, in start
env.start(wait_to_start=self._start_serially)
File "C:\Python37\lib\site-packages\tf_agents\environments\parallel_py_environment.py", line 223, in start
self._process.start()
File "C:\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Python37\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
reduction.dump(process_obj, to_child)
File "C:\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\Python37\lib\site-packages\tf_agents\environments\parallel_py_environment.py", line 264, in __getattr__
return self._receive()
File "C:\Python37\lib\site-packages\tf_agents\environments\parallel_py_environment.py", line 333, in _receive
message, payload = self._conn.recv()
File "C:\Python37\lib\multiprocessing\connection.py", line 250, in recv
buf = self._recv_bytes()
File "C:\Python37\lib\multiprocessing\connection.py", line 306, in _recv_bytes
[ov.event], False, INFINITE)
KeyboardInterrupt
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\tf_agents\environments\parallel_py_environment.py", line 289, in close
self._process.join(5)
File "C:\Python37\lib\multiprocessing\process.py", line 139, in join
assert self._popen is not None, 'can only join a started process'
AssertionError: can only join a started process
From that I conclude that the thread ParallelPyEnvironment is trying to start does not do that, but since I'm not very experienced with threading in Python, I have no idea where to go from here, especially how to fix this.
Current training takes a long time and does not use my PC's capabilities at all (3GB of 32GB RAM used, processor at 3%, GPU barely working at all but VRAM full), so this should speed up training time significantly.
The solution is to pass in callables, not environments, so the ParallelPyEnvironment can construct them itself:
train_env = tf_py_environment.TFPyEnvironment(
ParallelPyEnvironment(
[CardGameEnv] * hparams['parallel_environments']
)
)

Python multiprocessing. Attribute Error: can't pickle local object

I'm learning a multiprocessing and have one problem:
[0120/214250.476:ERROR:gpu_process_transport_factory.cc(967)] Lost UI shared
context.
DevTools listening on ws://127.0.0.1:26840/devtools/browser/82bab26a-25fa-
4e67-84d9-ae52ebfbdcae
Traceback (most recent call last):
File "PyInstaBrut.py", line 70, in <module>
p.start()
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object '_createenviron.
<locals>.encodekey'
E:\PyInstaBrut>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\spawn.py", line 99, in spawn_main
new_handle = reduction.steal_handle(parent_pid, pipe_handle)
File "C:\Users\Dima\AppData\Local\Programs\Python\Python37-
32\lib\multiprocessing\reduction.py", line 87, in steal_handle
_winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] Access denined
I read this error, but I don't understand nothing.
The function is standard: has several arguments (but I don't want to show code by some reasons), but a part of it looks like a Process(target=func, args=(arg0, arg1, arg2)). I start process after if __name__=="__main__": structure and start in the shell, so I don't know how solve this problem.

Channel tests with selenium in Django raise error message

I'm following this tutorial to experiment Channels with Django. I'm working on Windows 10 HOME, Django 2.1.4 and Python 3.7.1
The goal of this tutorial is to build a chat app.
After downloading chromeDriver and adding it in the PATH, I run this command in my prompt :
py manage.py test chat.tests
Which returns this error message :
EETraceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
======================================================================
ERROR: test_when_chat_message_posted_then_not_seen_by_anyone_in_different_room (chat.tests.ChatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\test\testcases.py", line 202, in __call__
self._pre_setup()
File "C:\Users\kevin\Envs\myproject\lib\site-packages\channels\testing\live.py", line 52, in _pre_setup
self._server_process.start()
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
reduction.dump(process_obj, to_child)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\reduction.py", line 61, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'DaphneProcess.__init__.<locals>.<lambda>'
======================================================================
ERROR: test_when_chat_message_posted_then_seen_by_everyone_in_same_room (chat.tests.ChatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\test\testcases.py", line 202, in __call__
self._pre_setup()
File "C:\Users\kevin\Envs\myproject\lib\site-packages\channels\testing\live.py", line 52, in _pre_setup
self._server_process.start()
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
reduction.dump(process_obj, to_child)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\reduction.py", line 61, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'DaphneProcess.__init__.<locals>.<lambda>'
----------------------------------------------------------------------
Ran 0 tests in 4.689s
FAILED (errors=2)
Destroying test database for alias 'default'...
The same question (https://stackoverflow.com/questions/50016048....) provide a solution, but it doesn't work for me.
When I modify the file reduction.py to replace import pickle by import dill as pickle, I'm getting this new message error :
DevTools listening on ws://127.0.0.1:25037/devtools/browser/b4c722e4-c7f2-49fb-939b-7372e9688eea
C:\Users\kevin\Envs\myproject\lib\site-packages\daphne\server.py:13: UserWarning: Something has already installed a non-asyncio Twisted reactor. Attempting to uninstall it; you can fix this warning by importing daphne.server early in your codebase or finding the package that imports Twisted and importing it later on.
UserWarning,
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "c:\users\kevin\appdata\local\programs\python\python37-32\Lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
File "C:\Users\kevin\Envs\myproject\lib\site-packages\dill\_dill.py", line 304, in load
obj = pik.load()
File "C:\Users\kevin\Envs\myproject\lib\site-packages\dill\_dill.py", line 465, in find_class
return StockUnpickler.find_class(self, module, name)
File "C:\Users\kevin\Envs\myproject\lib\site-packages\channels\auth.py", line 12, in <module>
from django.contrib.auth.models import AnonymousUser
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\contrib\auth\models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\contrib\auth\base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\db\models\base.py", line 87, in __new__
app_config = apps.get_containing_app_config(module)
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\apps\registry.py", line 249, in get_containing_app_config
self.check_apps_ready()
File "C:\Users\kevin\Envs\myproject\lib\site-packages\django\apps\registry.py", line 132, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Please, someone could bring me help ?

Categories