Python not recognised in windows prompt cmd - python

Anconda prompt:
where conda
C:\Users\shail\AppData\Local\Continuum\anaconda3\Library\bin\conda.bat
C:\Users\shail\AppData\Local\Continuum\anaconda3\Scripts\conda.exe
C:\Users\shail\AppData\Local\Continuum\anaconda3\condabin\conda.bat
where python
C:\Users\shail\AppData\Local\Continuum\anaconda3\python.exe
C:\Users\shail\AppData\Local\Microsoft\WindowsApps\python.exe
So i went to environment variables and added path of anaconda and python. Path added:
C:\Users\shail\AppData\Local\Continuum\anaconda3
C:\Users\shail\AppData\Local\Microsoft\WindowsApps
C:\Users\shail\AppData\Local\Continuum\anaconda3\Library\bin
C:\Users\shail\AppData\Local\Continuum\anaconda3\Scripts
C:\Users\shail\AppData\Local\Continuum\anaconda3\condabin
But when I type on windows cmd:
C:\Users\shail>conda --version
conda 4.8.3
C:\Users\shail>python --version
C:\Users\shail>
So there is no response from windows cmd on version of python, so I guess it is not recognising python. I mainly need to use pip command, for that I need python first. I dont have python separately installed on system. It is inside my anaconda. On some sites it is written I should not download python separately and add its path because that will confuse the computer since there will be 2 pythons; one from Anaconda and one downloaded separately. So sticking to the anaconda version of python.
How to get my anaconda version of python recognised ?

pip worked for me after restarting my computer. Though python is still not returning any output but pip is working fine.

Related

OS X "which python" points to python2.7 instead of Anaconda python3.9

I factory reset my MacBook and set up everything new to get rid of the multiple python version chaos I had on my old laptop.
Only thing I have installed atm is Anaconda. I created a new conda environment with python 3.9 and activated it in my zsh Terminal.
Still when I type "which python" it shows "/usr/bin/python" containing the MacBook standard Python2.7 version.
How can I make environments use their own dedicated version?
Edit for Code:
conda activate myenvname
which python
Trying to access the folder where the anaconda python should be leads to
cd: no such file or directory: /Users/marcus/anaconda/bin
When you install anaconda through the terminal it provides an option to prepend anaconda to the system path. make sure to choose yes. If you don't, you'll need to provide the full path to your anaconda installation when activating an environment, as in:
source <path to conda>/bin/activate
conda init
You'll need to do this in each shell session. Alternatively, you can use the anaconda terminal.
To fix this, Anaconda does not recommend fixing your path manually. I think this is because there are a number of things anaconda does when setting up your shell if you choose "yes". Instead, the recommended fix is to uninstall and re-install anaconda (and pick yes this time ;)).
See the Anaconda docs for more information.

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.

How to get reticulate to recognize my miniconda python and my environments?

I am relatively new to python and would like to install it the "right" way (of which, of course, there are many) to use both natively and with R through reticulate.
Here's what I have done so far:
I reinstalled MacOS Catalina from scratch and installed Miniconda with homebrew.
Through miniconda, I have updated to python 3.8.5.
Then, I installed reticulate in R (R version 4.0.2., RStudio version 1.3.1056). When reticulate asked me whether I wanted to install miniconda, I declined (since it was already installed.
I aliased python3 with python in my zsh terminal.
This is where the trouble started. I couldn't (and can't) get reticulate to recognize my python installation or, if I can get reticulate to recognize it, I can't get it to recognize my python environment.
As advised elsewhere, I changed my RETICULATE_PYTHON to /usr/local/bin/python3, which actually matches one of my python installations. Now I get the error Error: could not find a Python environment for /usr/local/bin/python3
I also tried setting my path to my miniconda python, which is located somewhere in /usr/local/Caskroom/miniconda/base/. Or more specifically, as obtained by type -a python python3, in /usr/local/Caskroom/miniconda/base/bin/python3. Unfortunately, once I changed the reticulate directory to the miniconda version, type no longer returns /usr/local/Caskroom/miniconda/base/bin/python3, for reasons that I don't understand.
When I now run type -a python python3, I receive the following output:
python is an alias for python3
python is /usr/bin/python
python3 is /usr/local/bin/python3
python3 is /usr/local/bin/python3
python3 is /usr/bin/python3
python3 is /usr/local/bin/python3
I don't know what happened to my miniconda installation (which still seems to work fine, when I run conda --version, I receive conda 4.8.3).
So to summarize the status quo:
Running python from the terminal works (both interactive and to execute a py file)
Reticulate recognizes the path I set in RETICULATE_PYTHON
My miniconda no longer appears when I run type -a python python3
Most importantly: reticulate does not recognize my environment even though I have created an environment with miniconda in the terminal and another environment in Rstudio using reticulate::conda_create() and I have also made sure to activate them.
So my question is, how can I get reticulate to
Recognize my miniconda python
Recognize the various environments that I create with conda (both inside and outside of R)

Python installation in Windows 10

I tried to install Python 3.7.6 in windows 10. All went well until when in the cmd prompt of the computer as soon as I entered python to check the cmd prompt took me to microsoft app store and asked me to download python 3.7.7. It is not recognizing the python 3.7.6 that I had downloaded. Can any one help me with this
it's just a case, i encountered the similar problem just download the app to get rid of the redirect to the store and it will be all ok.
Yeah i have experienced the same issue .
But i have found an alternative solution to this problem.
Download Anaconda and then type "conda install python 3.7.6" in the anaconda prompt or u can also create a custom environment by typing "conda create -n py376 python=3.7.6 anaconda" in the anaconda prompt and then u shall see the version of python installed on ur environment by typing "python --version"

On Windows machine, installed Python 3.7 but it seem like 3.6 is running

Yesterday I uninstalled my Python 3.6 and installed Python 3.7. I simply ran the executable and followed the prompts. Here is a screen shot of my Programs and Features in my Control Panel.
However, when I check the version in the command prompt, it seems like version 3.6 is still running!
If you have an Anaconda Python installation, you can either upgrade it to your chosen version of Python or create a new conda environment with the version you want.
To see what environments you have set up, do conda env list
To upgrade Python in an environment myenv, do activate myenv then conda update python (to get the latest version) or conda install python=x.y.z (to install version x.y.z, assuming it's available from your conda channels)
You probably didn't completely uninstall your old python version and windows is still pointing to the old installation. Edit your PATH and point your new python 3.7 directory.
Go to My Computer/This PC --> right click --> properties --> advanced system settings --> environment variables --> PATH
You should see a path directory that looks something like this:
C:\Users\Programs\Python\Python36\
Change that directory and point to your python 3.7 installation.
If you want you can keep the old installation of python 3.6 on your computer, it's not necessary to uninstall it and you can work on projects using older python versions when needed.
It looks like you have a Python executable in your PATH from a Anaconda installation (hence the Anaconda Inc at the end of your version number).
You have a few options here:
You can either find the Anaconda installation and remove it (echo %path% into the command prompt may help).
Edit your PATH to make sure that your Python 3.7.3 installation is called first before the Anaconda install.
Upgrade your Anaconda installation to the latest version that uses Python 3.7.
When you install anaconda, a box is automatically checked to make your computer see the version of python installed with conda as the primary version, you could probably uninstall conda or change you system env path taking conda off it.

Categories

Resources