"tput: Unknown terminal 'emacs'" messages when using PyCharm / iPython console on Windows - python

I am using PyCharm with iPython on Windows. The only Python I have installed on the box is the latest Anaconda distribution, Python 3.4 flavor.
Very often, while using the console, I get numerous instances of the following warning message:
tput: unknown terminal "emacs"
This is mixed in with the normal output. Has anyone else experienced and/or fixed this? I have dug through both the iPython and PyCharm documentation and have not found anything related.

Did you install anything new recently?
Check your path for anything "unixy", for example I removed ...\Git\bin from my path and it solved the problem for me.

Related

Error in Python 3.9.12 while using input command

I am using spyder in anaconda to run my python program (added the figure below to show my version ) .
When I type input() command in editor window, an error pops up .
(above)I have attached the screenshots of the same.
If I retain first part alone, there is no error.
Can someone help me as to why this error pops up.
I reinstalled the anan conda several times, thinking it was an installation error
I think its a bug in anaconda-spyder which a lot of users have reported. I suggest one of the two appraoches :
Install 'non-anaconda' distribution of python and do pip install spyder.
Or check if your anaconda version is 5.1.5, if yes then check this - link or downgrade spyder or search other relevant links.

Open Jupyter in VSCode: TypeError: Cannot read properties of undefined (reading 'makeSettings')

System: MacOSX 10.15,
VSCode Version: 1.67.2,
Python Kernel Version: 3.8.13 (Conda base).
I created a new Jupyter notebook in my VSCode using command shortcut and selected the right python kernel showed above. The empty notebook page is well loaded and no error message occurred.
But when I typed and ran any code in the cell, this error message showed up below the cell.
Then I clicked the "log" link and the error log showed up and it was like this:
And hence I couldn't run any code in the notebook cell. Then I changed to another Python Kernel (3.9.12) of the same notebook, it showed the same error message:
Please give me a solution to overcome this bug.
Update: I tried to reinstall pyzmq to an older version in the canda base environment and it didn't change anything. Then I typed command jupyter --version and everything is well installed.
Update: I have searched on Github Issues of VSCode. There are two similar issues that are all caused by some extensions, one is called "Gitduck"(now renamed "duckly"), the other is "nur.Script". The link to these issues are here:
Cannot read property 'makeSettings' of undefined #834
Cannot read property 'makeSettings' of undefined #128458
But unfortunately, I never have installed any of these extensions in my VSCode. So it may be caused by a similar extension but I still don't know the name.
Finally, I use the command code --list-extensions to list all my installed extensions here, maybe helpful for filtering which extension is the bad guy:
Final Update: Today (05/31) I opened VSCode and tentatively created an empty Jupyter notebook, and this problem has gone away. I have done nothing, maybe VSCode's auto-update has solved this problem. Case closed.
You can try reinstalling the pyzmq module.
pip uninstall pyzmq
pip install pyzmq==19.0.2
Hope this helps you.

Environment issues with running Anaconda Python in VS Code

I am trying to learn Python and debug code for the first time in VS Code (latest edition). I have anaconda running and the code I have runs fine by itself but now I need to know how to update the code and debug it for the first time.
I keep getting the following error related to NumPy:
Exception has occurred: ImportError
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
The Python version is: Python3.7 from "C:\Miniconda2\envs\myproject_flask\python.exe"
The NumPy version is: "1.18.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed: The specified module could not be found.
In the Miniconda path above the Python.exe is version 3.7.7. I tried to install NumPy like so in myproject directory:
(myproject_flask) c:\MyProject\source\MyProject.Flask>conda install numpy=1.18.5
I still get the same error when I go to F5 to debug and run to a breakpoint.
Need help with my environment.
I need to use VS Code in my Windows environment with Anaconda.
You should launch VS Code from Anaconda Navigator so that the environment is initialized.
When you have problems with importing the numpy C-extensions in Anaconda it's very likely that your virtual environment hasn't been activated. Having just Python on the path is not good enough. You also need access to the libraries. This is what the activation does.
When you are running/debugging code you should see a terminal open. You can tell from the prompt
(myproject_flask) C:\MyProject
that conda has been activated. Sometimes this just takes a bit too long for VSCode. So simply push the start button a second time.
Note that the Code Runner extension in VSCode is also known to cause this kind of problems.
However, I wonder why you are using Miniconda2 with Python3, although in general this should work.
I was getting the error even after adding all the anaconda paths, it was due to VScode running the code in the python debugger terminal which is not able to enter the conda environment.
This worked for me:
press ctrl+Shift+P > Type Terminal:Select Default profile > Select Command prompt
after this code ran in Command prompt by default, inside the environment.

VSCode: Using the MS Python extension cannot execute code

I have been using VSCode with the Microsoft Python extension for a couple of months now. However just today I found that the green button I had in the top right that executed my code is gone. I have tried uninstalling the python extension and reinstalling, I have deleted and redownloaded VSCode, I have tried installing code runner. None of these have fixed the issue.
This is the image of my VSCode, which may help to solve the issue:
When I tried to select the Python: select interpreter I got an error in the bottom right that says,
"Command 'Python: Select Interpreter' resulted in an error (command 'python.setInterpreter' not found)"
I have never experienced an issue like this before so any help is greatly appreciated. Thank you!
Image of the plugin I have installed.
Try the following. If that does not help create a new bug.
Do the following to remove stale versions of the extension:
1.Uninstall Python extension (if you have pylance uninstall it first) in visual studio code.
2.Close all instances of VS Code or close visual studio code.
3.Go to, %USERPROFILE%/.vscode/extensions (on windows) or ~/.vscode/extensions on Windows/Linux/Mac.
4.Go to Run and give %USERPROFILE%/.vscode/extensions (on windows). It will open extensions folder.
5.Delete any folder with the name starting with ms-python.python*
6.Start VS Code, and install Python extension again(also pylance if you uninstalled it in step 1).
So I had faced the problem and couldn't find solution until I stared at VS code and found at the bottom left corner that it was in restricted mode, you have to run it in trust mode and it will fix the problem.
If the option is not coming, there is an option to run the program on the left panel in vs code which looks something like this:
Then you need to click debug and run or whatever the option is, if that is blurred out then you've not saved the file, first save it and then again do the same options, and then it will run.
I figured it out!!! The most recent update for the Microsoft Python plugin on VSCode seems to be bugged or something, I'm not sure. However I installed an older version and everything works now, including bringing back the green run button. Thank you all so much for the help!
Yep it's an issue with the most recent releases of vscode. The quick fix right now is just to roll back to an older version. You can easily do this by pressing CTRL+SHIFT+X in vscode to get to the extensions menu, and then clicking the Python extension, and then clicking the little arrow to the right of "uninstall". Here, you can just click "Install Another Version".
For me v2020.10.332292344 did the trick.
https://github.com/microsoft/vscode-python/issues/14959
Many others are facing the issue right now too.
https://github.com/microsoft/vscode-python/issues/14977
I am using WSL2, and i encountered this error today. My VScode used to work fine until my version was automatically upgraded to 1.60. When i checked my extensions, it said that my Python extension is not installed in WSL2, so i clicked on install and the problem was solved.
It may also come from the restricted mode. Please make sure you're in a trusted window.
"Command 'Python: Select Interpreter' resulted in an error (command 'python.setInterpreter' not found)"
The error happened on the newer version 3.10.6 I installed on my new system.
I uninstalled the new python version. Then went to Microsoft store and installed the older version 3.9 directly from the store. When I tried adding the interpreter again on vscode, it was successful.
reloading or upgrading python extension worked for me.
Kindly install the Python interpreter from the following site:
https://www.python.org/downloads/
Then vs code will ask for permission to run the interpreter.
and then its done

Is my editor getting confused by python because I have 3.7 and 3.8?

Currently on windows 10, using VSCode to run python.
So I recently downloaded python3.8 when I was using python 3.7. Everything was working fine when I was still on python3.7. I now have multiple python directories and I think my imported libraries are throwing errors because of it.
I now have python in(these are results from searching python and right clicking -> open file location) :
C:\Python38
C:\Users\david\AppData\Roaming\Python\Python38
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.8
C:\Users\david\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7
As for installed programs I have :
python3.8.5(64-bit)
Python launcher
Should I add all four paths to my environment...?
Frankly I don't even know anymore how to tackle this problem. I'm not even sure what the problem is I just think its a problem. If someone could link me another stackoverflow or help that would be great.
If this isn't supposed to be a problem then I guess I have some more googling to do...
Thank you
EDIT(commented below): One specific error I keep on getting is when I install keras and tensorflow, and run a program, it keeps on asking me to install tensorflow 2.2.0 even though I've already installed it. I have C:\Python38 and C:\Users\david\AppData\Roaming\Python\Python38 in my windows path and C:\Python38 as my VSCode path –

Categories