I get a message that says my GPU Device is ignored because its multiprocessor count is lower than the minimum set. However, it gives me the environment variable TF_MIN_GPU_MULTIPROCESSOR_COUNT but it doesn't seem to exist because I keep getting command not found. When I look at the environment variables using set or printenv and grep for the variable name, it doesn't exist. Does anyone know where I can find it or how I can change its set value?
Do something like this before running your main script
export TF_MIN_GPU_MULTIPROCESSOR_COUNT=4
Note though that the default is set for a reason -- if you enable slower GPU by changing that variable, your program may run slower than it would without any GPU available, because TensorFlow will try to put run everything on that GPU
In windows, create a new environmental variable with this name and assign its value.
You can do that by right clicking on the This PC in File Explorer, select Properties at bottom, then select Advanced system settings on left. That will get you to the System Properties dialog. Also you can type "environmental properties" in Cortana Search.
From there you click the Environmental Variables button. Once in the Environmental Variables dialog, select new to create the variable and assign the value, then back out. You may have to restart your IDE or open a new DOS window for that environmental variable to be visible.
Related
I am having a problem in PyCharm (2022.3.1) that the variables of my code are not showing in the right-bottom area of "Variables" in Python Console in PyCharm.
This function is extremely useful when coding. You can keep track of the changes and data-type of your variables.
How to solve it?
The problem mentioned was solved and I will described, here, how to do it:
I ran a simple code with two variables. The code runs fine but the variables do not show (in the red circle area, as they should be).
Se this first first screenshot
If I add a new variables manually in the Python Console it will show in the variable area as it shows
So how did I solve this issue?
You will need to change the Debug configurations as shown here, and check the box "Run with Python Console", then Apply, Ok.
After that when you run your code, your variables will be shown in the variables tab at the bottom-right-corner, as shown here.
After that you will also be able to type new variables in the Python Console and they will immediately be shown in the variable tab.
Is there a specific code or a setting on Spyder that can remove the default variables from the variables explorer?
I have changed the settings so that all variables are cleared each time I click run but the variable explore shows some default values (e.g values such pi, e, euler_gamma, cast, ScalarType and many more).
I have tried to play around with the settings and search on google but can't find any solution.
See screenshot (all the default variables have been highlighted)
I found the answer, you need to untick the following box in SpyderIDE preferences:
Tools > Preferences > IPython console > Graphics > Automatically load Pylab and NumPy modules
I am simply attempting to define a variable in Python. I am using Spyder and in the variable explorer, the defined variable "V0Z" does not show up at all. There is no error message that appears and I double checked my math by plugging in the definition into Wolfram Alpha and it gives me a real number (1.5E+7). Why is Python refusing to acknowledge it?
Code:
import numpy as np
MirrorAngle = 30
V0X = 1E7
MirrorAngleRad = MirrorAngle*(np.pi/180)
V0Z = (np.abs(V0X)/np.abs(np.sin(MirrorAngleRad)))*(1 - np.sin(MirrorAngleRad)**2)
Screenshot of what I see:
Spyder's Variable Explorer doesn't show all-uppercase variables by default. You can change this in the hamburger menu on the pane, just uncheck the box to hide those variables:
The likely reason all-caps variables are hidden by default is that many style guides recommend all-caps for constants, so they'll never change during the lifetime of a program. That would make monitoring them in the variable explorer pretty pointless.
I am trying to use the variable explorer in PyCharm.
I click on python console and I have a window for the variables.
However, the variables that I created in my code do not appear, only built in variables appear. (Under special variables, there is: builtins and sys)
Where can I find the variables that appear in my code?
The specific variable I'm looking for is a dictionary called "data_model".
It is created within the program and filled during runtime.
You can run the code in python console and then you will be able to see all the variables (along side builtin variables). By default it will only show builtin and sys variables and as you run the code in python console, it will show the variables.
The dictionary view is not great I think but in pandas dataframe you will be able to right click on variable and click on 'view as a dataframe' which puts the dataframe in a new window.
I have a python app that I'd like to call on some images, by something like this:
right clicking on images in windows
menu pops up => shows the python application in the list of items
when clicked, batch runs on the images
Can this be done w/o using Visual Studio?
That "list of items" is called the context menu. That is controlled by "The Registry", which is only accessible by the computer's administrator.
MANDATORY WARNING: THE REGISTRY IS NOT A TOY, AND WILL BREAK YOUR COMPUTER IF YOU DO NOT KNOW WHAT YOU ARE DOING. IF YOU ARE NOT AT LEAST 80% CONFIDENT, DON'T TOUCH IT. I TAKE NO RESPONSIBILITY IF YOU BREAK YOUR COMPUTER.
That's not to say you will though. If you still want to continue, you should definitely back it up:
Open the registry
Press (Windows key) + R to open the run dialog
Type in "regedit.exe" and then enter
Enter you Administrative approval when prompted
Once in the registry, look at the panel on the left and all the way at the top there should be a "folder" (called "key" in the registry) called "HKEY_CLASSES_ROOT". Click on it. (If you can't find it, it might be under "Computer". Just expand it.). You should now see a lot of keys.
Backup the registry (optional but recommended)
Click on "File" (top) => "Export".
On the bottom, choose "Selected branch". If you want though, you could export the whole registry by selecting "All" just to be safe (it's a HUGE file though, and probably not necessary)
Choose a file to save it to and click "Save". Wait for the loading to finish.
Decide which file type you want. You said: image. That could be: ".jpg", ".png", ".bmp", etc. Just repeat the following steps for all desired file types.
Find the "file type association"
Under your selected key, find the key with the file extension you want (eg. ".jpg"). Click on it
There will be a couple of "values" on the side. Check the one called "(Default)". This has the name of the file. (eg: "jpegfile")
Navigate to the file. Still in the same key as the extension (".jpg"), locate the key with the name from step 5. Open it.
Make a new command.
Right-Click the "shell" key, select "New" => "key"
Name this new key with a logical, one word name (eg "process").
This new key has a "(Default") value. Change it's value (not the name) to what you want to appear on the right click menu.
Under your new key, make a new key called "command".
Set this key's default value to the full path of your Python installation, a space, then the script path, including any arguments. You can pass "%L%" as an argument to have the registry replace it with the path to the right-clicked file. (eg. "path/to/python.exe path/to/script.py %L%"). Just make sure your Python script can take arguments.
Done!
Feel free to comment with questions