tensorboard: command not found, when I use - python

I already use python IDE PyCharm and have installed the package tensorflow but when I use the terminal and give an input to the tensor board as follows
--logdir = '/user/....',
it shows command not found?
is there still something Im missing like setting the tenor flow path or any thing else?

Maybe you need to activate your relevant environment via source activate some_conda_env.
If it isn't either of those you're going to need to give more information than you've given in the question (versions, environment, etc.)
Update (due to discussion in comments):
It seems that tensorboard is not in your search path.
That can be fixed, but meanwhile you can just run tensorboard by using the full path. e.g. /my/full/path/to/tensorboard --logdir='/path/to/logger' etc.
Good luck!

Related

Import "pybit" could not be resolved [duplicate]

I'm on day 1 of Python and trying to import SciPy into a project. I installed it via pip install on ElementaryOS (an Ubuntu derivative). I have verified it's existence via:
$ python
>>> help("modules")
The exact error I'm getting is:
Import "scipy" could not be resolved Pylance (reportMissingImports)
When searching for this error I found:
Import could not be resolved/could not be resolved from source Pylance in VS Code using Python 3.9.2 on Windows 10 Powershell -- the accepted answers all pointed towards a project specific .env file. I have no such project structure, nor does it make sense to me that one would be needed.
A github issue -- this issue ends with "it just fixed itself"
When I run my program, I get no errors in console. And looking up "Pylance" it appears to be a Microsoft product. I suspect that VSCode is failing to lint correctly. Potentially because pip installed something in a place it wasn't expecting. This is my guess, but any help would be very much appreciated.
Edit: Following through on the idea of missing paths, I found this post -- How do I get into the environment VS Code is using for pylance?
Having added the path to where my modules can be found has yielded no results, though I'm not sure if the formatting is correct. Perhaps it needs glob syntax (eg path/**/*)
The issue was indeed with Pylance. It was missing an "additional path" to where pip had installed the projects I wanted to import. To solve the issue:
First make sure you know the location of your import; you can find it with:
$ python
>>> import modulename
>>> print(modulename.__file__)
Then, once you know the location:
Open settings (ctrl + ,)
Search "pylance" or find it under "Extensions > Pylance"
Find the "Extra Paths" config item
Use "add item" to a add a path to the parent folder of the module. It will not do any recursive tree searching
And you should be good to go!
For a further example, you can see the image above where I had added the path /home/seph/.local/lib/python2.7/ to no avail. Updating it to /home/seph/.local/lib/python2.7/site-packages/ did the trick.

VSCode "Import X could not be resolved" even though listed under `help('modules')`

I'm on day 1 of Python and trying to import SciPy into a project. I installed it via pip install on ElementaryOS (an Ubuntu derivative). I have verified it's existence via:
$ python
>>> help("modules")
The exact error I'm getting is:
Import "scipy" could not be resolved Pylance (reportMissingImports)
When searching for this error I found:
Import could not be resolved/could not be resolved from source Pylance in VS Code using Python 3.9.2 on Windows 10 Powershell -- the accepted answers all pointed towards a project specific .env file. I have no such project structure, nor does it make sense to me that one would be needed.
A github issue -- this issue ends with "it just fixed itself"
When I run my program, I get no errors in console. And looking up "Pylance" it appears to be a Microsoft product. I suspect that VSCode is failing to lint correctly. Potentially because pip installed something in a place it wasn't expecting. This is my guess, but any help would be very much appreciated.
Edit: Following through on the idea of missing paths, I found this post -- How do I get into the environment VS Code is using for pylance?
Having added the path to where my modules can be found has yielded no results, though I'm not sure if the formatting is correct. Perhaps it needs glob syntax (eg path/**/*)
The issue was indeed with Pylance. It was missing an "additional path" to where pip had installed the projects I wanted to import. To solve the issue:
First make sure you know the location of your import; you can find it with:
$ python
>>> import modulename
>>> print(modulename.__file__)
Then, once you know the location:
Open settings (ctrl + ,)
Search "pylance" or find it under "Extensions > Pylance"
Find the "Extra Paths" config item
Use "add item" to a add a path to the parent folder of the module. It will not do any recursive tree searching
And you should be good to go!
For a further example, you can see the image above where I had added the path /home/seph/.local/lib/python2.7/ to no avail. Updating it to /home/seph/.local/lib/python2.7/site-packages/ did the trick.

Installed Python 3.10.2 and now my Pip installs are not being found

Everything in my code was working perfectly fine up until I decided I wanted to utilize match-case in Python. Find out its only a thing in 3.10+, so I quickly install it and change it to be the interpreter in command palette.
Then I try to run my code same as before, and I'm not sure what changed but my Keyboard import is giving me 'Import "keyboard" could not be resolved'. Issues. The same issue was actually present as well with the 'from nis import match' module.
I installed keyboard initially using 'pip install keyboard' when running my 3.9 version, and legit everything was fine. This all started after I installed 3.10 (which I did from Pythons website yes); and I did add to PATH, but I dont think that would have any impact on my imports in VScode.
Confused as heck right now, please look at my screenshots for clearest explanation of what I'm facing.
Import could not be resolved
.
Module Not Found Error
.
pip3.10 show keyboard
.
My interpreter list from command palette
Any and all help appreciated, I'm extremely confused and think I've tried it all now
New Python versions use new site-packages folders. You need to reinstall everything. This is why poetry, pipenv, or requirements.txt are used
I think the linter-like extension/whatever Pylance is is the problem. Why? Because as we've tried, pip install keyboard and pip install --upgrade keyboard just confirm that the requirement is satisfied and the latest version of keyboard is already installed.
What I did was change Pylance's settings. Yes, it's not an actual error (with the code), but Pylance's problem. It just didn't see enough files in the keyboard package to satisfy its hunger, or Microsoft was just too lazy to pass more checks and update it accordingly, because however it happened, when I tried changing the setting to display an "error" at "missing imports" for fun, it didn't show errors or the default "warning" but "none", because I had run the file before I changed it back to display an error (maybe Pylance observed that when the file was run, there was no ModuleNotFoundError, and so stopped showing the warning).
I better shut now, because the setting I changed/overrode by adding it in settings.json is:
"python.analysis.diagnosticSeverityOverrides": {"reportMissingImports":"none"}
which is in:
{
...,
...,
...,
"python.analysis.diagnosticSeverityOverrides": {"reportMissingImports":"none"}
}
Here is a list of keys like "reportMissingImports" whose values you can change. These are the allowed values for the keys in python.analysis.diagnosticSeverityOverrides:
error (red squiggle)
warning (yellow squiggle)
information (blue squiggle)
none (disables the rule)
You would want to change their values only if you want to change their behaviour.
You can find settings.json by its path or by going to the settings GUI and clicking on any "Edit in settings.json" link-like button. You can also make settings.json open instead of the GUI by default.
Now, you won't see any more warnings when you import modules and can code without being anxious about the stupid warning.
Wow, So as it turns out, a solution I tried previously, to no avail is now working to solve this bizarre issue.
Simply put, I once again went to Command Palette (Ctrl+Shft+P), and looked through my interpreters I had to see what could be wrong.
Decided to click on the 'recommended' option I assumed I had been running this whole time. Turns out I was using this 'third' option as shown in the screenshot (the one not highlighted ofcourse); and it's the reason my module installs were being found on my machine, but not by the interpreter; as such giving me errors and not running the module for the program.
Simple error, but thanks to those who did help.

How to get quick documentation working with PyCharm and Pytorch

I'm running PyCharm on Windows 10, and installed PyTorch following the getting started guide. Where I used Chocolatey and Anaconda to set up everything.
I can run the PyTorch tutorials from inside the PyCharm IDE without any problems. So I feel like I have a proper set up, but there aren't any intellisense documentations for any of the PyTorch APIs.
For example;
import torch
x = torch.randn(128, 20)
If I mouse over randn and press CTRL+Q then PyCharm shows me a popup of the function definition without any documentation.
I'm expecting to see Python comments from the API documentation for that function:
https://pytorch.org/docs/stable/torch.html?highlight=randn#torch.randn
I'm a new beginner with Pytorch and Python, but this is something that I often have access to from inside the IDE with many other languages and libraries. So I feel like this should be possible to get working, but I can't seem to find any instructions on how to fix this.
I was able to get it working by doing the following:
PyStorm 2019.3
Open the settings for external documentation:
File / Settings / Tools / External Documentation
Add the following URL patterns:
Module Name: torch.nn.functional
URL: https://pytorch.org/docs/stable/nn.functional.html#{element.qname}
Module Name: torch
URL: https://pytorch.org/docs/stable/{module.basename}.html#{element.qname}
Seems to work for most APIs but you have to trigger the quick documentation tool window. This won't show docs if you CTRL+CLICK something.
You probably want to get Kite. It has this feature (that I use intensively) called co-pilot where you can get python docs immediately. I don't know if it's Linux/Mac specific but works for any editor, nit just Pycharm.
It's just another solution
PyCharm2022.1.x still cannot display torch(1.10) documentation.
#Reactgular 's answer is helpful. But the url that works for me is different.
Following the steps:
file --settings--tools -- external documentation -- add
Module Name: torch
URL/Path Pattern: https://pytorch.org/docs/stable/generated/{element.qname}.html#{element.qname}
Actually the above steps only let the pycharm show a link. But it is better than nothing. just click the link and a default browser will open the documentation.
You can also specify a customized browser instead of the system default browser: file-- settings-- tools --web browsers and preview
torch quick doc
I was about just to add a comment for Reactgular's solution but it turned out I didn't have enough "reputation" to do it.
For the torch.nn.functional module, I found it is more helpful to do this to jump directly to the detailed documentation for the function you are searching for.
torch.nn.functional
https://pytorch.org/docs/stable/generated/{element.qname}.html#{element.qname}
But of course, this is not a stable page so I guess it may not work later, so be careful about it.

pyrouge: 'pyrouge_set_rouge_path' is not recognized as an internal or external command

I have Windows 7 and use Python 2.7. I recently installed ROUGE (Recall-Oriented Understudy for Gisting Evaluation) in order to evaluate summaries that I have.
Unfortunately, my summaries are in .txt format, and wouldn't work with ROUGE. I therefore, installed pyrouge from pypi.
In the same website above, they have installation steps. I followed the first step, which was to use pip install. The next step says:
"Assuming a working ROUGE-1.5.5. installation, tell pyrouge the ROUGE path with this command:
pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory"
I try that line in the command prompt:
pyrouge_set_rouge_path C:\rouge
Yet I keep getting this error:
'pyrouge_set_rouge_path' is not recognized as an internal or external command, operable program or batch file.
Any help in this matter is greatly appreciated.
Thanks
Try this:
set pyrouge_set_rouge_path=C:\rouge
Although it is an old questions, there are probably still people looking for the answer.
"Assuming a working ROUGE-1.5.5. installation" does not correspond to your pyrouge installation. It references to the following. (Maybe you got that right immediately, I did not)
https://github.com/andersjo/pyrouge/tree/master/tools/ROUGE-1.5.5
pyrouge_set_rouge_path is a script, not a variable you have to set.
The script is located at Python_PATH\Scripts.
Hence try something like:
python Python_PATH\Scripts\pyrouge_set_rouge_path C:\rouge

Categories