Install FedML on Windows 10

Recently, the teacher recommended a federated learning platform, which is FedML developed by He Chaoyang's team.
FedML
has been working on the installation of this platform for the past three days, and recorded the problems that have occurred. I am Windows 10. I use conda to install FedML
according to the official steps in conda . Finally, run the test code to verify that the installation is complete.

import fedml

if __name__ == "__main__":
    fedml.run_simulation()

After installing according to the steps on the first day, I found that python3.1 was installed, which could not be used in pycharm, so I reinstalled python3.7 with pip in cmd. After running, I found that the numpy version was wrong, so I changed the numpy version to 1.21, followed by problems with the versions of torch, matplotlib, torchvision and other packages. Running the test code reports errors like this:

The torch version is wrongpsutil package version is wrong
The next day I spent the whole day configuring the environment again, adjusting the versions of various packages, and finally it was able to run after the adjustment, but a UserWarning about numpy was still reported, which probably means that I seem to have repeatedly called Numpy twice in the program , I just want to solve this problem, I want to change to a Numpy version (I don’t know how much impact this behavior will have at the time), I don’t know why, the specified version of Numpy installed with pip is not installed, I uninstalled Numpy again Reinstallation, not to mention the failure of uninstallation (in the process, some packages may be deleted or damaged), and then I fell into the process of constantly updating packages. Finally, I decided to uninstall FedML directly and reinstall it again.

Re-downloaded on the third day, the amazing thing is that the steps are still the same, but this time it is installed python3.6, so there is no more version inconsistency, the third day is relatively smooth, basically it is automatically installed, but there are The package will fail to install. At this time, I will download the corresponding whl file and install it with pip. The last bug that stumped me was this:
insert image description here
I initially focused on the error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp -build-tools, click on the URL 404, I downloaded this software everywhere, but when I finally found the installation, it showed that the installation package was damaged. I went to see various tutorials, but the results were useless. Later, I saw this post Microsoft Visual C++ 14.0 is required solution and installation package damage solution! I tried the first solution, but it didn’t work. The second solution reminded me that there was still a problem with some package downloads. I went back to check the error and found this: I suddenly realized that the gensim package might have failed
insert image description here
. , I went to download the corresponding whl file, and sure enough the problem was solved.
Test result:
insert image description here
At this point, the installation is over.

Summary:
I tried three times during the installation process. The first time I got stuck in an error in the torch package, the second time I got stuck in solving userwarring and messed up the environment, and the third time I succeeded. At first I didn’t realize that the error was only because the version of the package did not correspond. The first error was numpy. I searched for solutions everywhere. Most of the solutions required changing the code. I felt that something was wrong subconsciously. I always felt that the code provided by FedML should be is complete. I saw a plan that said the version problem, I tried it and it was solved. The later problems were all about the package version or not being installed, and the errors reported were also different. My first thought of getting the error was not based on the version issue. This is the first time I realized how important version correspondence really is.

Attached (various package versions that are currently running normally):
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/Bad_foxS/article/details/126541782