Why PyCharm not running the same code as run in shell? - python-3.x

I have a strange behavior today. When I am running my mxnet model load program in PyCharm it gives :
terminate called after throwing an instance of 'dmlc::Error'
what(): [14:21:09] /home/travis/build/dmlc/mxnet-distro/mxnet-build/3rdparty/mshadow/mshadow/./stream_gpu-inl.h:115: Check failed: err == CUBLAS_STATUS_SUCCESS (1 vs. 0) : Create cublas handle failed
But the same code and same virtual-env activated running flawlessly!
What is happening in PyCharm? Is it changing as Env? Any ideas?

It is ENV problem. Pycharm didn't recognize my .bashrc LD_LIBRARY_PATH this was the problem.

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.

Python 3.9 virtual environments with windows 10

I faced this silly problem since the last 2 days, and it turns me mad.
Since I installed python 3.9 on my new Windows 10 machine, when I run the command python3 -m venv .\venv, I get the error "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases."
If I switch off the app execution aliases, as mentioned in the message, I got a message:
'python3' is not recognized as an internal or external command,
operable program or batch file.
So, I looked at similar issues on Stackoverflow and fixed the path in the environment variables (in the user variables and in the system variables).
I added to the variable 'paths' the 2 following entries:
C:\Users{myuser}\AppData\Local\Programs\Python\Python39
C:\Users{myuser}\AppData\Local\Programs\Python\Python39\Scripts\
In all cases seen on Stack, that should have been enough. Not in my case.
I rebooted my machine twice, to make sure the new variables were picked up, but it's still the same.
I must add that I am using daily my Jupyter Lab environment, and everything works fine.
It's just this venv that refuses to work.
Does anyone has a hint on other places I should look for ?
Solution found thanks to Michael Vine.
To summarize:
referring to python instead of python3 in the command line
using [virtualenv venv] instead of [python -m venv .\venv] as I did

Python unable to start correctly ( 0xc0000005)

i just install python 3.7 and also config the path.but when i type python in cmd its showing me "the application is unable to start correctly 0xc0000005"
The application was unable to start correctly (0xc0000005).click ok to close the Application
For me, this happened because ordinary users didn't have read+execute access on the following file:
C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll
This was discovered by running Sysinternals' Process Monitor to see what the Python3 thread was doing.
HTH

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.

Error in using 'theano-nose' command

After installing Theano from Enthought Canopy on Windows, following the steps here: http://deeplearning.net/software/theano/install.html#id9 , I tried to execute the command theano-nose from Canopy terminal. I got an error message saying "unable to find theano-nose". Can someone tell me what might be going wrong?
theano-nose is from the command line. But your shell need to be able to find it.
It is highly possible it didn't got installed correctly on Windows or that you need to reboot or log out/log in. I do not remember Windows particularities on that level.
But a simple work around is to start python and run this:
import theano
theano.test()
This is equivalent for what you want to do.

Resources