Search Unity

Question "The associated script can not be loaded". Can't drag 3DBall.nn model into Behavior Parameters (Scri

Discussion in 'ML-Agents' started by bobcy2019, Jun 29, 2020.

  1. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    I'm the beginner of the Unity development. Recently I planned to learn to machine learning research with Unity ML-Agents. I followed the steps in the "Installation.md" document on the lastest ml-agents resository and installed all the components in my Window 7 laptop. My Unity Hub version is 2.3.5. My Unity Version is 2019.4.0f1.
    project.png

    I added the ml-agents\Project folder to the Projects list in the Unity Hub. Then I open the project and upgraded it to Unity Version: 2019.4.0f1. it seemed to work fine.

    Then I followed the steps in the "Getting-Started.md" document to open the example 3DBall.

    In the step2, I can not find the Behavior Parameters (Script) component in the Agent GameObject Inspector window. When I expanded 3DBall and click on the Agent prefab, the Inspector window can only show the agent's properties and can not load all the scripts which should bundle with the agent, like the attach pictures shows.
    model.png

    Please tell me if there are some mistakes i were made, or how can I fix the problom to run the 3DBall example.

    Thanks a lot for your help.
     
  2. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    I found the warning message: Unable to open Packages/com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs: Check external application preferences.

    But in my \ml-agents\com.unity.ml-agents\Runtime\Policies folder, the file exists.
    scripts.png

    The version of com.unity.ml-agents Unity package in the Package Manager is:
    package.png
     
  3. BotAcademy

    BotAcademy

    Joined:
    May 15, 2020
    Posts:
    32
    which ML-Agents version did you clone? I guess you have a version mismatch between the project folder from the mlagents repository that you cloned and the ML Agents version in the Package Manager.

    On https://github.com/Unity-Technologies/ml-agents/releases you can see the matching versions (com.unity.ml-agents in the one you install via the package manager). Make sure it matches the repo version (0.XX.X)

    Oh and btw. you're not using the com.unity.ml-agents package from your cloned version when you install it via the package manager. So you looked into the wrong folder for the file. Make sure to look in your unity project in the packages folder.
     
    Last edited: Jun 30, 2020
  4. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    This time I downloaded the lastest version release_3 from the https://github.com/Unity-Technologies/ml-agents/releases. Then I unzipped the zip file and add the ml-agents-release_3\Project into the Unity Hub Project.

    But After I opened the project with Unity 2019.4.0f1 (64-bit), I found the same error:
    "The associated script can not be loaded".

    I checked the Package Manager, found that ML Agents version is preview 1.1.0. It's the same as ML Agents Release 3 list. Mable I was wrong to operate the example 3DBall. The step 2 in the Getting-Started.md is confusing me totally.

    Please show me the complete operation of open the Behavior Parameters (Script) of the example 3DBall. Not only the Project window screenshot, I need the more size of the screenshot, just like the picture below:
    model.png

    Thank you very much. Hoping for your reply.
     
  5. BotAcademy

    BotAcademy

    Joined:
    May 15, 2020
    Posts:
    32
    That's interesting. I'd recommend going through my ML-Agents setup video and check that you didn't miss something (probably even going through it step by step) - from the Feedback I got, the video worked for nearly everybody. If it still doesn't work, I'd try using Unity 2019.3. Please let me know if it's still not working.

     
  6. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    QUOTE="BotAcademy, post: 6040379, member: 5125603"]That's interesting. I'd recommend going through my ML-Agents setup video and check that you didn't miss something (probably even going through it step by step) - from the Feedback I got, the video worked for nearly everybody. If it still doesn't work, I'd try using Unity 2019.3. Please let me know if it's still not working.

    [/QUOTE]

    Thanks for your video. The difference between you and me is I used release_3 and Unity 2019.4.0f1 (64-bit).

    But when I type "mlagents-learn" in Anaconda Prompt (Anaconda3) console, it shows some errors:
    mlagents-learn.png

    Then I opened the project with Unity 2019.4.0f1 (64-bit) and open the example 3DBall agent. The errors are still the same. There are the screenshots about the errors:

    screenshot1.png

    When I click the "Play" button on the top, it shows: error.png

    The first two errors hint is blank. so what should I do to solve the problem? Maybe I should install all components with the same version you used in the video and try again?
     
  7. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    This is my conda list:
    (ml-agents) C:\Users\Administrator>conda list
    # packages in environment at C:\ProgramData\Anaconda3\envs\ml-agents:
    #
    # Name Version Build Channel
    absl-py 0.9.0 pypi_0 pypi
    astunparse 1.6.3 pypi_0 pypi
    attrs 19.3.0 pypi_0 pypi
    ca-certificates 2020.1.1 0 defaults
    cachetools 4.1.0 pypi_0 pypi
    cattrs 1.0.0 pypi_0 pypi
    certifi 2020.4.5.2 py37_0 defaults
    chardet 3.0.4 pypi_0 pypi
    cloudpickle 1.4.1 pypi_0 pypi
    gast 0.3.3 pypi_0 pypi
    google-auth 1.18.0 pypi_0 pypi
    google-auth-oauthlib 0.4.1 pypi_0 pypi
    google-pasta 0.2.0 pypi_0 pypi
    grpcio 1.29.0 pypi_0 pypi
    h5py 2.10.0 pypi_0 pypi
    idna 2.9 pypi_0 pypi
    importlib-metadata 1.6.1 pypi_0 pypi
    keras-preprocessing 1.1.2 pypi_0 pypi
    markdown 3.2.2 pypi_0 pypi
    mlagents 0.17.0 dev_0 <develop>
    mlagents-envs 0.17.0 dev_0 <develop>
    numpy 1.18.5 pypi_0 pypi
    oauthlib 3.1.0 pypi_0 pypi
    openssl 1.1.1g he774522_0 defaults
    opt-einsum 3.2.1 pypi_0 pypi
    pillow 7.1.2 pypi_0 pypi
    pip 20.1.1 py37_1 defaults
    protobuf 3.12.2 pypi_0 pypi
    pyasn1 0.4.8 pypi_0 pypi
    pyasn1-modules 0.2.8 pypi_0 pypi
    pypiwin32 223 pypi_0 pypi
    python 3.7.7 h81c818b_4 defaults
    pywin32 228 pypi_0 pypi
    pyyaml 5.3.1 pypi_0 pypi
    requests 2.24.0 pypi_0 pypi
    requests-oauthlib 1.3.0 pypi_0 pypi
    rsa 4.6 pypi_0 pypi
    scipy 1.4.1 pypi_0 pypi
    setuptools 47.3.0 py37_0 defaults
    six 1.15.0 pypi_0 pypi
    sqlite 3.32.2 h2a8f88b_0 defaults
    tensorboard 2.2.2 pypi_0 pypi
    tensorboard-plugin-wit 1.6.0.post3 pypi_0 pypi
    tensorflow 2.2.0 pypi_0 pypi
    tensorflow-estimator 2.2.0 pypi_0 pypi
    termcolor 1.1.0 pypi_0 pypi
    urllib3 1.25.9 pypi_0 pypi
    vc 14.1 h0510ff6_4 defaults
    vs2015_runtime 14.16.27012 hf0eaf9b_2 defaults
    werkzeug 1.0.1 pypi_0 pypi
    wheel 0.34.2 py37_0 defaults
    wincertstore 0.2 py37_0 defaults
    wrapt 1.12.1 pypi_0 pypi
    zipp 3.1.0 pypi_0 pypi
    zlib 1.2.11 h62dcd97_4 defaults
    ----------------------------------------------------------------------------------------------------------------------
    I think maybe the tensorflow v2.2.0 is not compatible with ml-agents v0.17.0
     
  8. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    Maybe I found the key to solve the problem "The associated script can not be loaded".

    While I was installing Unity V2019.3.15f1, My computer popped an error window:
    permission.png

    I'm not use administrator account to login my Windows 7 system. Although the account I used is created with administrator level, but sometimes I was forced to open the application with administrator permission to run it correctly.

    While I was installing many software, the pop window like above is often shows. If Unity installation do not have permission to copy the script files to its install folder or my account do not have permisson to read the script files, then the Unity IDE will encount the problem and can not load the scripts.

    Can someone tell me which default setup folders is the com.unity.ml-agents package used? Just like :
    D:\github\ml-agents-release_1\com.unity.ml-agents\Runtime\Policies
    But it actually should be installed in Driver C somewhere, such as:
    C:\Program Files\Unity\Hub\Editor\2019.3.15f1\Editor\..
     
  9. BotAcademy

    BotAcademy

    Joined:
    May 15, 2020
    Posts:
    32
    That goes beyond my knowledge to be honest, so I hope someone else can help you. Chances are quite big that it is not working cause of missing admin privileges. Windows 7 should be fine (I know from some other users that it's working with Win7)
     
  10. bobcy2019

    bobcy2019

    Joined:
    Jun 29, 2020
    Posts:
    7
    Finally I found the solution to solve the problem "The associated script can not be loaded".
    It is not Windows's privilege policies cause Unity can not load the script, It is antivirus software's failure. I used a Windows 10 desktop PC without antivirus software reinstalled the all components. Then when I open the example 3DBall with Unity IDE, the all scripts are loaded correctly. And 3DBall can be played with 3DBall.nn model.

    This time I will shutdown Avira AntiVirus in my notebook and reinstall the all components with the lastest Version(release_3 + Unity v2019.4.1f1 LTS + TensorFlow 2.2.0).

    BTW: The error I met with TensorFlow is not Version Conflict. The reason is I don't install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019.

    Thank you so much again for your help.
     
  11. BotAcademy

    BotAcademy

    Joined:
    May 15, 2020
    Posts:
    32
    Good to know. Glad that it's working for you now! Enjoy ML-Agents :)