Conda activate base error - The term "conda" is not recongised - python

I'm trying to use anaconda with visual studio code but keep getting this error message every time I try to run something.
enter image description here
enter image description here
What Iv'e tried/confirmed:
Python 3.9.1 is installed and Iv'e got no problems running codes in VSC when I use the standard enviroment or inside a command terminal.
The version of python the anacoanda says it is using is 3.8.5. Should it be 3.9.1 or is that normal?
Python and anaconda were added to path during installation - Iv'e already made that mastake before.
Presumably anaconda is installed properly. I can access the navigator and command prompt.
Its not the code that Iv'e writen. I tried simply writing print("Hello") and it gives me the same error.
Installed the latest version of anaconda.

I have encountered the same problem. The reason is that VS Code uses the powershell terminal by default, but powershell does not activate the conda environment by default.
Therefore, it is recommended that you use the cmd terminal or other terminals that come with the system. (Because in VS Code, the terminal it uses is to integrate the terminal from the system and it not only supports the powershell terminal.)
Solution: for example, switch to using cmd terminal:
Reference: Integrated terminal in VS Code.

Related

I keep getting "ModuleNotFound" error when i try to run code on my terminal even though i installed it

i work with:
Atom as a text editor
GitBash as a terminal
i've been trying to work with the numpy module but, even though i installed it via conda command on my terminal, it still gives me the ModuleNotFoundError when i run my code on the terminal
For example, here's some code:
https://i.stack.imgur.com/GL4JP.png
and here is me trying to run it on my terminal:
https://i.stack.imgur.com/ChOWm.png
As you have mentioned that you have installed numpy using conda, run your script or .py file in anaconda prompt (python yourfile.py) instead of GitBash or windows command prompt.
Otherwise, add python to the path and make sure that you are adding the right variable to path. If you are using conda installation of python, then add that to your path or if you installed python standalone, you should add that to path. Use following commands to know where is python installed in your system and add to path accordingly. Then use GitBash or CMD to run your files.
In CMD:
where.exe python
In GitBash:
which python
or
where.exe python

How change the python version 2.7.16 on my Visual Studio Code terminal to the newer python version?

I recently downloaded VS Code however the python version the VS CODE terminal is 2.7.16 but the python on my mac terminal is 3.8.5. How can I change the python version to the latest on the VS code terminal?
macOS#
The system install of Python on macOS is not supported. Instead, an installation through Homebrew is recommended. To install Python using Homebrew on macOS use brew install python3 at the Terminal prompt.
Note On macOS, make sure the location of your VS Code installation is included in your PATH environment variable. See these setup instructions for more information.
for reference:
click here to view official vs code documentation
You need to execute Python: Select Interpreter(shortcut:Ctrl+Shift+P) command to switch the python environment in the VSCode.
The environment of python which you are using was displayed at the bottom left of the VSCode, and you can click it directly to switch the environment.
Hopefully you've solved that problem. If not, these solved the problem for me:
Launch VS Code.
Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
For more information:
https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line

Does Spyder download its own Python with it?

Common issue here: I installed Python and then Spyder, and now when I install packages with "pip install ", Spyder can't find the modules, but if I call Python on the command prompt (using Windows), it finds all installed packages with pip.
I noticed that in Spyder, a new console shows it is running Python 3.7.9, but if I run "python -V" on the command promp, it shows Python 3.9.1 , also for "py -0" and "py -0p" it only shows one installation of Python, namely
>>> py -0p
Installed Pythons found by py Launcher for Windows
-3.9-64 C:\Users\my_name\AppData\Local\Programs\Python\Python39\python.exe *
so what is going on here? Why does Spyder seem to have its own Python version? Is this the reason why packages installed with pip are not communicating with Spyder?
I was facing the same issue as you. I understand your question and the answer to it is yes. However you can change it and use the systems python as well.
Tools -> preferences -> python interpreter -> select "use the following interpreter" and provide is the path to the directory that you have the systems python installed.
Restart spyder and the kernel should then show you the update version
For any library that you want to add that is not included in the default search path of spyder, you need add its path via the PYTHONPATH manager.
Go to Spyder->Tool-> PYTHONPATH manager ->Add Path

PIP version VSCode

I am having troubles trying to understand why VSCode uses a different pip version.
I have two python versions installed in Windows, python38 and python39, if I open the win 10 terminal I got pip version 20.2.4 when running pip3 --version, but if i run the same command inside the VSCode terminal i got pip 20.2.2 from c:\python38\lib\site-packages\pip (python 3.8).
Both terminals are running PowerShell 7.0.3 on the same profile.
Also removing python38 from the global PATH variable gives command not found error only in vscode, in windows terminal keeps working as i described before.
Could not fix this so I deleted all temporary and profile data of vscode and can now run pip from within its terminal.
Try changing your interpreter: ctrl+shift+p->select python interpreter and choose the one you want because pip is part of the python environment, and therefore the version of pip you are using is tied to the active python interpreter (cc #DragonBobZ)
It's all about the Process PATH. Check $Env:PATH in both. Starting from the left, the first folder with pip3.exe is used. You have probably selected a python interpreter for VS Code, which then adds it in the PATH.
You can also check the location of the used pip3.exe with Get-Command pip3. (might be helpful in debugging)
It appears something got fixed after deleting all profile and settings data from visual studio code, it runs pip now form the terminal inside vscode.

Notebook and terminal launch wrong python version

I don't know why but after half day using my kernel 'geomatic' in jupyterhub, something crash. My notebook doesn't work anymore... After some researches, I understand that issue comes from python version used by notebook or console. It's a bad one python: 3.6.3 whereas in my kernel terminal (source activate geomatic) I have python 3.6.6. I don't know why but this difference makes crash my scripts and I can't import geopandas in a notebook for example.
always install from "Anaconda Prompt" if using Anaconda Navigator in windows. I had a similar issue and installing the package using Anaconda prompt. Make sure the python version from Anaconda prompt and jupyter are the same (should be)

Categories

Resources