opencv Code keep crashing and didn't execute afterward - pytorch

I was working on a project that was running fine but now when I try to setup the whole code again for the client. my opencv code execute and crashes the first time I try to run it.afterwards the code doesn't even execute until I restart my system again.then code execute and crash again then it doesn't even execute. the terminal shows the msg(attached image) and nothing happen afterwards
os: ubuntu 18.04
python version: python3
opencv version 4

The problem seems to come from pytroch library as te error comes from torch.nn.modules.
I recommend you to check if you have the last version of Pytorch or if there are some issue within the test_2.py code in line 139 when calling:
utils.predict(model_ft, labels, transforms, test_dir, imgFile)

Related

Pytorch "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!"

SYSTEM: Ryzen 5800x, rx 6700xt, 32 gigs of RAM, Ubuntu 22.04.1
I'm attempting to install Stable-Diffusion by following https://youtu.be/d_CgaHyA_n4
When attempting to run the SD script, I get the "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!" error.
I believe this is caused by PyTorch not working as expected. When validating Pytorchs' installation with "The Master Test", I get the same error:
"hipErrorNoBinaryForGpu: Unable to find code object for all current devices!"
Aborted (core dumped)
I believe that it is install correctly as using the conda list command tells me that torch 1.12.0a0+git2a932eb and torchvision 0.13.0a0+f5afae5 are installed. Interestingly, when I change the command ever-so-slightly to torch.cuda.is_available, (without the parentheses), I get the following output: <function is_available at 0x7f42278788b0>. Granted, I'm not sure what this is telling me. Following the "Verification" step resulted in the expected array of random numbers. However, failed the GPU driver check.
Thank you in advance.
Try running the following command:
export HSA_OVERRIDE_GFX_VERSION=10.3.0
This made it work on my machine using an RX 6600 XT, with which I got the same error running it, before exporting the variable.
I was struggling with ROCm enabled Tensorflow, the tensorflow-rocm, package. Without setting up the environment variable
export HSA_OVERRIDE_GFX_VERSION=10.3.0
, tensorflow-rocm crashes.
After setting it up, it works with 6700XT as well (at least it does not crash.) But still having problem with finding libraries.
It seems ROCm has a lot to catch up.

Recurrent error when using pyinstaller & cx_Freeze

I've seen through the web that .exe taken from python scripts may often run into errors because of some "hooks missing", which happens because pyinstaller wasn't able to track some modules while creating the .exe file. I'm currently using Python IDLE 3.61 and the scripts works fine without any error. The .exe actually runs but, for instance, it simply crushes when I try to plot a table giving the error:
NoModuleFoundError: 'No module=plotly.validators.table found'.
Building the .exe also via cx_Freeze, I came up to the same sort of problem:
Module plotly.validators.table has no Attribute CellsValidators
which confirmed me the problem is caused by issues with plotly.
Uninstall plotly module.
Install older version of plotly module.
Now try building .exe file
(If not working again, try further more old versions of plotly)
I hope it works.

Running script inside Geany & IDLE do not work

EDIT Replying to Rohan's comment here...
So I've tried import sys and sys.path for both in IDLE and in the terminal and the paths are different, not sure if that's where the problem is.
The code I'm trying to run is...
import pygame
pygame.init()
screen = pygame.display.set_mode((640, 480))
screen.fill((0, 255, 0))
pygame.display.flip()
pygame.time.wait(3000)
If I run the code in a terminal it works like it's supposed to, but I try it in IDLE it gets stuck on line with the Module Error.
CLOSE EDIT
I have searched through the already asked questions but couldn't find a solution to the issue I'm having. I have IDLE installed with Python 3.6.3.(if I type python3 in a terminal though I get Python 3.6.5) I've installed pip3 and the module pygame. However when I run my code I get the Module Not Found Error: No module named pygame.
If I run the code in the terminal directory everything works fine. So I thought I'd try another text editor Geany. After following all the instructions I can't even get Hello World to run on that. A terminal opens but freezes. The Compile and Execute lines were written exactly as they were supposed to be. I've tried updating and restarting my laptop but nothing works.
I'm just starting and following along with a couple books and everything has been going fine until this point but now I can't figure out what's going on. The only thing I can think of is IDLE only recognizes python 3.6.3, but if I type python3 into a terminal it says Python 3.6.5. I've tried updating and reinstalling IDLE but nothing seems to work. I can't even remove it. I haven't had any problems with code in IDLE until now and it's driving me crazy. Is there any way I can just reinstall everything and start it over fresh?
I apologize if this isn't written properly, it's my first post and the little guide on the right was covered up with some similar questions that aren't similar as I was reading it...
Question with no answers, but issue solved in the comments (…)
Answer from #Terry Jan Reedy in the comments:
It is unusual to have both 3.6.3 and 3.6.5 separately installed. If
pygame is installed for 3.6.5 (but not 3.6.3) and python3 in the
terminal starts 3.6.5, then python3 -m idlelib should start IDLE with
3.6.5 and code run with IDLE so started should be able to import pygame.
If the name of the file is pygame.py:
This file will be read/reached and NOT the pygame extension.

cx_Freeze: Python error in main script (function not found)

I am trying to create an exe from python script using cx_freeze
I have been able to create the build and test it successfully on win7 but whenever I try to run the exe on win xp I get the following error.
Have tried uninstalling and reinstalling cx_freeze but it wont help.
I am using python 3.4
AttributeError: function 'SetProcessDPIAware' not found
Complete error description
Got the solution.
Build the application on win xp pc.
Add the following lines to your setup file-
os.environ["TCL_LIBRARY"]=r"C:\Python34\tcl\tcl8.6"
os.environ["TCLLIBPATH"]=r"C:\Python34\tcl\tcl8.6"
os.environ["TK_LIBRARY"]=r"C:\Python34\tcl\tk8.6"
All must point to the correct tcl paths within the python setup.
In my case it was looking for tcl in some other location due to some environment variable confusion.
And build your script using cx_freeze again.
Will work like a charm.

node not found when using brackets IDE

So i am following along a lynda tutorial video for node.js, and it was suggested to download the node.js binding for brackets so that we can have a terminal inside of brackets to run our node.
However, whenever I try to run I get the following:
/bin/sh: node: command not found
Program exited with status code of 127.
The terminal path where it is showing its attempt at running node is:
"/Users/userName/Documents/lynda_practice/nodejs/my-module.js". I am at a complete loss as to why this rather poorly documented plugin is incapable of finding node considering that I can run it just fine if i use my mac's terminal. As is seen here, while being located in the same directory:
node module-demo.js
text from module: Hello from module
These are multiple debugger are available in Bracket
top hundred packages of Bracket
I ran into the same problem, and based on your post I think I'm doing the same Lynda.com training. What I did is I uninstalled Brackets 1.8 and instead installed Brackets 1.7. In Brackets 1.7 I was able to install the Node.js Bindings with the extension manager as they do in the training video. Here is a link to the Brackets 1.7 download: https://github.com/adobe/brackets/releases/tag/release-1.7
I'm running on Windows 7 and this fixed the problem for me. Hope it helps!

Resources