web123456

Multiple ways to completely solve the problem in pycharm: OSError: [WinError 1455] The page file is too small to complete the operation.

catalogs

1. restart pycharm (basically useless)

2. Set num_works to 0 (probably won't help)

3. increase the size of the page file + change the batch_size (solve the problem completely)


 

I believe that many of my buddies are usingpycharmI have encountered this problem when running PyTorch related code, and have searched for solutions, here is my experience.

Here are the three solutions I found in my search, in order.

1. restart pycharm (basically useless)

This is the easiest way to do it, so try it, it's easy enough, but if it's the first time you've encountered the problem, it's basically impossible to solve.

2. Set num_works to 0 (probably won't help)

This method is also the most common method seen on the Internet. But one thing is, the online tutorials are really unfriendly, many answers directly on this sentence, without any other operation, a lot of small friends simply can not find the place, do not know where the variable.

Here to introduce a way, good use of pycharm's search function, directly in the search box search for the variable name, you can directly find the relevant files, do not have to find slowly.

This is the dataloader file mentioned by the user, just click on it to enter the file.

The answer on the web is this, which means that changing the value of the following variable num_workers to 0 is sufficient

After I found the file, I searched for the location of the variables with Ctrl+F, but I didn't find the block of code in the picture above, and there are users in the comments who said it's in other locations (dataset), I've tried them all, and I can't find them.

At this point I've pretty much given up on this approach, and I've thought that even if the change to 0 works, it will probably have an effect on other code in the future, because after all, the variable must be useful or it wouldn't be there, which means that it's a cure-all, not a cure-all.


Update: I read the answer again, the location of the variable may not be in the system file, but you may have written your own program that uses this variable, check your own program, if you use it, change it and try it.


Why did I write this method if it didn't solve the problem? First of all, some users did comment that it solved the problem, which means that the method itself works, and secondly, I provided a way to search for the variable, which can be used anywhere, so that you won't have to worry about finding the variable in the future.

Let's go back to the error report of this problem, which is that the page file is too small to complete the operation, which means that our computer does not have enough pages, so we should essentially solve the problem of the page, not the variable.

With this in mind, I started looking for other answers, and finally found the last way, as follows.

3. increase the size of the page file + change the batch_size (solve the problem completely)

First of all, the existence of this problem, we look at the following picture, you will find that the computer default is not allocated to the D disk virtual memory, so the Python installed in the D disk friends, in the runtime program, not allocated virtual memory, naturally encountered the above problem, so the fundamental operation as long as the D disk allocation of virtual memory can be. (If Python is installed on the C drive, change the value of the virtual memory on the C drive, and adjust it larger.)

To do this, search for Advanced System Settings.

Follow the operation as shown in the figure, and finally set the size of the virtual memory according to the size of the available space on your D-disk, and finally click on the confirmation, and then re-run the program, the problem is solved. Here, there may be another situation, that is, your D-disk virtual space has been set up, it may be that you run the program sample is too large, you can try to change the batch_size is the value of your training volume, set it a little smaller, to see if it can be solved, or fail to go to try the second method, this is the solution I have found almost all the way out.