Errors Port connection to trainer on port 5004 using API version 1.5.0 and grpc_csharp_ext.x64.dll

Hello I’ve been trying to solve the following errors for the past 5 days with MLAgents
I use the following versions:
Python: 3.9.13
ml-agents: 0.30.0
PyTorch: 2.0.1+cpu

the errors are :
in Unity :
Unexpected exception when trying to initialize communication: System.IO.IOException: Error loading native library “C:\Users\Clément\Documents\Projet\MLAgents\Library\PackageCache\com.unity.ml-agents@2.0.1\Plugins\ProtoBuffer\runtimes/win/native\grpc_csharp_ext.x64.dll”
at Grpc.Core.Internal.UnmanagedLibrary…ctor (System.String[ ] libraryPathAlternatives) [0x00063] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.Internal.NativeExtension.Load () [0x000d7] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.Internal.NativeExtension…ctor () [0x00006] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.Internal.NativeExtension.Get () [0x00022] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.Internal.NativeMethods.Get () [0x00000] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.GrpcEnvironment.GrpcNativeInit () [0x00000] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.GrpcEnvironment…ctor () [0x0001e] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.GrpcEnvironment.AddRef () [0x00028] in <2f154ad39ec14cfea604815989d96352>:0
at Grpc.Core.Channel…ctor (System.String target, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable1[T] options) [0x00051] in <2f154ad39ec14cfea604815989d96352>:0 at Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials) [0x00000] in <2f154ad39ec14cfea604815989d96352>:0 at Unity.MLAgents.RpcCommunicator.Initialize (System.Int32 port, Unity.MLAgents.CommunicatorObjects.UnityOutputProto unityOutput, Unity.MLAgents.CommunicatorObjects.UnityInputProto& unityInput) [0x00007] in .\Library\PackageCache\com.unity.ml-agents@2.0.1\Runtime\Communicator\RpcCommunicator.cs:224 at Unity.MLAgents.RpcCommunicator.Initialize (Unity.MLAgents.CommunicatorInitParameters initParameters, Unity.MLAgents.UnityRLInitParameters& initParametersOut) [0x0003b] in .\Library\PackageCache\com.unity.ml-agents@2.0.1\Runtime\Communicator\RpcCommunicator.cs:112 UnityEngine.Debug:Log (object) Unity.MLAgents.RpcCommunicator:Initialize (Unity.MLAgents.CommunicatorInitParameters,Unity.MLAgents.UnityRLInitParameters&) (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Communicator/RpcCommunicator.cs:141) Unity.MLAgents.Academy:InitializeEnvironment () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:445) Unity.MLAgents.Academy:LazyInitialize () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:279) Unity.MLAgents.Academy:.ctor () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:248) Unity.MLAgents.Academy/<>c:<.cctor>b__83_0 () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:117) System.Lazy1<Unity.MLAgents.Academy>:get_Value ()
Unity.MLAgents.Academy:get_Instance () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:132)
Unity.MLAgents.Agent:LazyInitialize () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Agent.cs:451)
Unity.MLAgents.Agent:OnEnable () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Agent.cs:365)

And

Couldn’t connect to trainer on port 5004 using API version 1.5.0. Will perform inference instead.
UnityEngine.Debug:Log (object)
Unity.MLAgents.Academy:InitializeEnvironment () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:459)
Unity.MLAgents.Academy:LazyInitialize () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:279)
Unity.MLAgents.Academy:.ctor () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:248)
Unity.MLAgents.Academy/<>c:<.cctor>b__83_0 () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:117)
System.Lazy`1<Unity.MLAgents.Academy>:get_Value ()
Unity.MLAgents.Academy:get_Instance () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Academy.cs:132)
Unity.MLAgents.Agent:LazyInitialize () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Agent.cs:451)
Unity.MLAgents.Agent:OnEnable () (at ./Library/PackageCache/com.unity.ml-agents@2.0.1/Runtime/Agent.cs:365)

Also in CMD i have :

(venv) C:\Users\Clément\Documents\Projet\MLAgents>mlagents-learn --run-id=test2

┐ ╖
╓╖╬│╡ ││╬╖╖
╓╖╬│││││┘ ╬│││││╬╖
╖╬│││││╬╜ ╙╬│││││╖╖ ╗╗╗
╬╬╬╬╖││╦╖ ╖╬││╗╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╜╜╜ ╟╣╣
╬╬╬╬╬╬╬╬╖│╬╖╖╓╬╪│╓╣╣╣╣╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╒╣╣╖╗╣╣╣╗ ╣╣╣ ╣╣╣╣╣╣ ╟╣╣╖ ╣╣╣
╬╬╬╬┐ ╙╬╬╬╬│╓╣╣╣╝╜ ╫╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╟╣╣╣╙ ╙╣╣╣ ╣╣╣ ╙╟╣╣╜╙ ╫╣╣ ╟╣╣
╬╬╬╬┐ ╙╬╬╣╣ ╫╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╟╣╣╬ ╣╣╣ ╣╣╣ ╟╣╣ ╣╣╣┌╣╣╜
╬╬╬╜ ╬╬╣╣ ╙╝╣╣╬ ╙╣╣╣╗╖╓╗╣╣╣╜ ╟╣╣╬ ╣╣╣ ╣╣╣ ╟╣╣╦╓ ╣╣╣╣╣
╙ ╓╦╖ ╬╬╣╣ ╓╗╗╖ ╙╝╣╣╣╣╝╜ ╘╝╝╜ ╝╝╝ ╝╝╝ ╙╣╣╣ ╟╣╣╣
╩╬╬╬╬╬╬╦╦╬╬╣╣╗╣╣╣╣╣╣╣╝ ╫╣╣╣╣
╙╬╬╬╬╬╬╬╣╣╣╣╣╣╝╜
╙╬╬╬╣╣╣╜

Version information:
ml-agents: 0.30.0,
ml-agents-envs: 0.30.0,
Communicator API: 1.5.0,
PyTorch: 2.0.1+cpu
[INFO] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.
Traceback (most recent call last):
File “C:\Users\Clément\AppData\Local\Programs\Python\Python39\lib\runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “C:\Users\Clément\AppData\Local\Programs\Python\Python39\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\Users\Clément\Documents\Projet\MLAgents\venv\Scripts\mlagents-learn.exe_main
.py", line 7, in
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\learn.py”, line 264, in main
run_cli(parse_command_line())
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\learn.py”, line 260, in run_cli
run_training(run_seed, options, num_areas)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\learn.py”, line 136, in run_training
tc.start_learning(env_manager)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents_envs\timers.py”, line 305, in wrapped
return func(*args, **kwargs)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\trainer_controller.py”, line 172, in start_learning
self._reset_env(env_manager)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents_envs\timers.py”, line 305, in wrapped
return func(*args, **kwargs)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\trainer_controller.py”, line 105, in _reset_env
env_manager.reset(config=new_config)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\env_manager.py”, line 68, in reset
self.first_step_infos = self._reset_env(config)
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\subprocess_env_manager.py”, line 446, in _reset_env
ew.previous_step = EnvironmentStep(ew.recv().payload, ew.worker_id, {}, {})
File “C:\Users\Clément\Documents\Projet\MLAgents\venv\lib\site-packages\mlagents\trainers\subprocess_env_manager.py”, line 101, in recv
raise env_exception
mlagents_envs.exception.UnityTimeOutException: The Unity environment took too long to respond. Make sure that :
The environment does not need user interaction to launch
The Agents’ Behavior Parameters > Behavior Type is set to “Default”
The environment and the Python interface have compatible versions.
If you’re running on a headless server without graphics support, turn off display by either passing --no-graphics option or build your Unity executable as server build.

Many has the same errors but i found no solutions.
Can someone help me xD ?

So i found the problem, that’s from the Unity package version, i use the 2.3.0 and i make a new folder for the project and all works

really pay attention to the different versions of packages and dependencies!