I'm training a Yolov5 model with Torch on Jupyter Notebook using this line of code:
!python train.py --img 416 --batch 16 --epochs 50 --data dataset.yaml --weights yolov5s.pt --cache
but I'm getting this error that says:
Traceback (most recent call last):
File "C:\Users\suzan\Desktop\CSPPEDA\yolov5\train.py", line 29, in <module>
import torch
File "C:\Users\suzan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\__init__.py", line 123, in <module>
raise err
OSError: [WinError 1455] The paging file is too small for this operation to complete. Error loading "C:\Users\suzan\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll" or one of its dependencies.
So I searched for answers online and found a solution from Chris O'Bryan (How to efficiently run multiple Pytorch Processes / Models at once ? Traceback: The paging file is too small for this operation to complete), however I'm getting this error in Command Prompt as I run the fixNvPe.py python script:
Failed to write modified DLL! [[WinError 5] Access is denied: 'C:\\Users\\suzan\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\torch\\lib\\torch_cuda_cu.dll']
I looked back at the explanation from the first solution by Chris, in which he said "If it is under Program Files, you will need to run the script with administrative privileges". So I run the command prompt as adminstrator and typed in net user administrator /active:yes, then on the normal command prompt, and rerun the fixNvPe.py python script.
After rerunning it, I tried to train the Yolov5 model again, but the same error OSError: [WinError 1455] The paging file is too small for this operation to complete. still exists.
Am I running the script in administrative priviledges the correct way? What should I do? I apologize for the question as I'm a beginner in this stuff.
Related
I want to remove all files in the directory d:\\tmpdata in os win10.
import shutil
shutil.rmtree('d:\\tmpdata')
It encounter an issue such as:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'd:\\tmpdata'
Try to get which process is using the resources--directroy d:\\tmpdata:
tasklist | findstr 'tmpdata'
or
tasklist #run it only ,search by eye.
No process can be found ,how to get which process is using the directory ?
Try built-in software Resource Monitor. Search resmon.exe. Start program, select CPU then Associated Handles - type your folder path and see, what is using it.
I'm trying to automate IPython scripts using batch files and the Windows Task Manager. After much digging I've found that you can use Task Manager to trigger a BAT and through that execute the nbconvert package in order to run the Jupyter Notebook without the interactive bits.
In the BAT my code first "turns the Windows cmd into an Anaconda Prompt" with the code: <anaconda3 path>\Scripts\activate.bat <anaconda3 path>
(No formal CS education, so bear with me on this.)
That line allows me to run conda and jupyter commands out of the Windows cmd. I then run
jupyter nbconvert --execute --ExecutePreprocessor.enabled=True --ExecutePreprocessor.timeout=60 <Notebook>
I keep receiving a timeout error when this occurs. Yes, I could adjust the timer, but before setting the timer to 10 hours and coming back in the morning I'm hoping for some understanding of what is going on behind the scenes in nbconvert, and maybe some insights into how to get this working. The .ipynb file works fine when run through Jupyter Notebook. There is however a point at which the script is attempting to load several gb of data, which has taken ~20 minutes each time I've run it.
To that end - when nbconvert engages the Pre-processors, are they running the entire script preemptively? I'm struggling to find a reason as to why nothing opens, pings, runs, updates, etc... when executing the nbconvert command. I would expect at least an uptick in RAM usage, but as far as I can tell that isn't happening either.
How can I work around this, and what is going on behind the scenes when nbconvert is executed?
Traceback:
C:\Users\User>jupyter nbconvert --execute "C:\Users\User\Desktop\_for_Python\CBSA.ipynb"
[NbConvertApp] Converting notebook C:\Users\User\Desktop\_for_Python\CBSA.ipynb to html
[NbConvertApp] Executing notebook with kernel: python3
[NbConvertApp] ERROR | Timeout waiting for execute reply (30s).
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Continuum\anaconda3\lib\site-packages\nbconvert\preprocessors\execute.py", line 423, in _wait_for_reply
msg = self.kc.shell_channel.get_msg(timeout=timeout)
File "C:\Users\User\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\blocking\channels.py", line 57, in get_msg
raise Empty
_queue.Empty
For anyone else facing this error with a correct path, I was able to extend the timeout using the flag --ExecutePreprocessor.timeout=300
According to the documentation:
The timeout traitlet defines the maximum time (in seconds) each
notebook cell is allowed to run, if the execution takes longer an
exception will be raised. The default is 30 s, so in cases of
long-running cells you may want to specify an higher value.
Fixed by adding the Anaconda3/Library/Bin path to c/windows/system32 PATH. Timeout was occurring due to DLL error, being returned as Timeout in command line.
According to the documentation: "The timeout option can also be set to None or -1 to remove any restriction on execution time.". So that would be: --ExecutePreprocessor.timeout=-1
I want to write GUI in perl by using the Tk module. Therefore, I want to install Tk module.
I opened a command window, and typed "cpan Tk". After a few minutes the run was over and then I got the following message on the command window:
""windres' is not recognized as an internal or external command, operable program or batch file. dmake.exe: Error code 129, while making 'tkres.o' dmake.exe: Error code 255, while making 'pTk\libpTk.a' SREZIC/Tk-804.032.tar.gz C:\Perl64\site\bin\dmake.exe -- NOT OK"
Apparently, the installation didn't go well. I also tried to execute a perl script that contains the line "use Tk" and I got the following message:
""Can't locate Tk.pm in #INC (you may need to install the Tk module)
(#INC contain s: C:/Perl64/site/lib C:/Perl64/lib .) at file.pl line 1. BEGIN failed--compilation aborted at file.pl line 1."
Can you help me install Tk properly?
After installing CPAN module with command perl -MCPAN -e "shell",
add path c:\Perl\site\lib\auto\MinGW\bin to system PATH and restart window with CPAN console.
Then commands 'make Tk', 'test Tk' and 'install Tk' in CPAN console should work.
Have you tried running the "Perl Package Manager"? It's located in your Perl directory under "bin/wperl.exe."
Copy the location of the file and type this in the cmd window.
'Location of wperl.exe' -x '"Location of ppm.bat"'
Example :
C:\Perl\bin\wperl.exe -x "C:\Perl\bin\ppm.bat"
ppm.bat should be in the same folder.
An easier way to launch that would be from your start menu in the "All Programs" section under your Perl Directory. There should be a "Perl Package Manager" there.
It's basically a GUI that allows you to locate every module on the CPAN website. From there you can find Tk (which I don't know, but I assume it's http://search.cpan.org/dist/Tk-804.030/).
I have read everywhere that the subprocess module is the best way to use the command line from Python, but I'm having trouble making it work. I have a firefox extension called Page Saver that saves an image of an entire webpage. On the comand line, this command successfully saves an image:
firefox -savepng "http://www.google.com"
I've tried this script to automate the process, but no luck:
import subprocess
subprocess.call(['firefox', '-savepng', 'http://www.google.com'], shell=False)
I get this error:
Traceback (most recent call last):
File "C:/Users/computer_4/Desktop/Scripts/crescentsaver.py", line 2, in <module>
subprocess.call(['firefox', '-savepng', 'http://www.google.com'], shell=False)
File "C:\Python27\lib\subprocess.py", line 524, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 711, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 948, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Am I using subprocess incorrectly?
Thanks.
Update:
Found the solution. It was a little detail of the extension I was using. The script had to be run from the Firefox default saves folder to work. I also ran the parameters as a string, not a list, with shell=True:
import subprocess
subprocess.call('firefox -savepng http://www.google.com', shell=True)
I could not answer my own question due to the limitation on new users answering their own questions within eight hours of posting.
What subprocess.call() is telling you with that error is that it cannot find the firefox command on your PATH. (Which is a list of directories where Windows searches for commands).
So you have two options here:
Specify the full path to the Firefox command in your script: this is easy, just put the full path in your python code.
Add the directory that contains the Firefox command to your PATH. This is a little more complicated but you can find a decent tutorial on Super User
I am trying to create a python program to easily change my cmd startup folder(rather than typing cd ... to navigate to the desired file)
But first I need to figure out how to change it without having to type regedit.exe into cmd.
After going through python documentation this is where I got:
from winreg import*
a=OpenKey(HKEY_CURRENT_USER,"Software\Microsoft\Command Processor\\")
SetValue(HKEY_CURRENT_USER,"Software\Microsoft\Command Processor\\",REG_SZ,"cd\\the path that I want.")
This code does edit the string value (I believe that is what its called) Default.
But what I need it to do is to edit the string value Autorun
#I tried diffrent ways of putting Autorun in that SetValue function but it didn't work.
Note: both Default and Autorun are in HKEY_CURRENT_USER\Software\Microsoft\Command Processor.
I've also tried
SetValueEx(a,"Autorun",0,REG_SZ,"cd\\The path that I wantsss.")#Don't know if this is the right way to use it.
But this gives me this error:
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
SetValueEx(a,"Autorun",0,REG_SZ,"cd\\The path that I wantsss.")
WindowsError: [Error 5] Access is denied
I use python 3.1 and windows7
Thank you in advance.
You have to use SetValueEx and also open the key with appropriate access rights, either KEY_WRITE or KEY_ALL_ACCESS, like this:
from winreg import*
a=OpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Command Processor",0,KEY_WRITE)
SetValueEx(a,"Autorun",0,REG_SZ,"cd\\The path that I wantsss.")
CloseKey(a)