Anaconda prompt and conda command not working - python

I was installing rdkit package from https://www.rdkit.org/docs/GettingStartedInPython.html with conda command.
However, there were some errors and it started to rollback. While doing so, I terminated the command.
After that, the conda command seemed to not work at all.
C:\Users\user>where conda
INFO: Could not find files for the given pattern(s).
C:\Users\user>conda --version
'conda' is not recognized as an internal or external command,
operable program or batch file.
This pic is my C:\Users\uesr\Anaconda3\Scripts
I've added anaconda and anaconda\scripts location to my path, so it's not a path problem.
I'm using windows10
Reinstalling anaconda would be the best solution?

If you can please do that, Few months back similar issue was faced by me too. I looked a lot for solutions of this issue, found many, some of them worked too but the problem reappeared after installing some other package. Best solution will be to reinstall anaconda. If not willing to do so, then do comment, I'll provide you with the solution, but I won't be able to assure you that it will solve the issue permanently.

first delete the path and uninstall anaconda
then again reinstall it
then again add path in system environment variable
then press ok in all windows

This generally happens as Path is not set.
My Anaconda is places here
My Path of Anaconda
You need to go to
Control Panel\System and Security\System\Advanced system settings & then ‘Environment Variables’ and add your Path of Ananconda
Pic2
Click on 'Environment Variables'
Pic3

Related

Cannot add conda environment to Pycharm - Conda executable path is empty even when it's not

I am pretty proficient in pycharm but it is the first time I stumble into this problem.
I created a conda environment
Finding the conda executable which for me is in /home/my_username/.miniconda3/envs/py39/bin/python
Adding it to pycharm results in:
I tried to search for this issue and error but the results didnt help.
I am using fedora 36 if it is relevant.
Edit: The output of which conda is:
/home/my_username/.miniconda3/condabin/conda
Then trying to add it as the interpreter as suggested in Pycharm: Conda executable path is empty:
Got it, thank you!
In the path you should define a path to the python.exe in the conda environment directory.
Here is an example:
I ended up re-installing the OS and now it works, I would not call it a solution but it is what it is - I couldnt waste more time on this as I have work to do.
You need to first tell PyCharm where conda executable is. This is not so obvious how, as there is no input field for that when adding existing conda environments. IMO it's a UX flaw in PyCharm.
I found this input field only available when creating a NEW conda environment from within a PyCharm. Enter a 'Conda executable' there. In your case: /home/????/.miniconda3/bin/conda
Then I also created a new dummy conda environment so the path is stored and PyCharm is happy. Afterwards, you shouldn't get that "Conda executable path is empty" anymore when adding new conda interpreter.
As the error mentions either you do not have a Conda installed on your system or the path is not recognized by the IDE. Creating a new project, double check if the bar conda executable: is correctly filled by the directory to the folder Conda is installed on your system.
Normally your IDE fill the conda executable automatically, if this is not the case and manually filling the empty bar did not help, I would recommend to delete and reinstall your conda.
Good Luck

Basic python commands no longer recognised in VS Code [duplicate]

I installed Anaconda3 4.4.0 (32 bit) on my Windows 7 Professional machine and imported NumPy and Pandas on Jupyter notebook so I assume Python was installed correctly. But when I type conda list and conda --version in command prompt, it says conda is not recognized as internal or external command.
I have set environment variable for Anaconda3; Variable Name: Path, Variable Value: C:\Users\dipanwita.neogy\Anaconda3
How do I make it work?
I was faced with the same issue in windows 10, Updating the environment variable following steps, it's working fine.
I know It is a lengthy answer for the simple environment setups, I thought it's may be useful for the new window 10 users.
1) Open Anaconda Prompt:
2) Check Conda Installed Location.
where conda
3) Open Advanced System Settings
4) Click on Environment Variables
5) Edit Path
6) Add New Path
C:\Users\RajaRama\Anaconda3\Scripts
C:\Users\RajaRama\Anaconda3
C:\Users\RajaRama\Anaconda3\Library\bin
7) Open Command Prompt and Check Versions
8) After 7th step type
conda install anaconda-navigator in cmd then press y
Although you were offered a good solution by others I think it is helpful to point out what is really happening. As per the Anaconda 4.4 changelog, https://docs.anaconda.com/anaconda/reference/release-notes/#what-s-new-in-anaconda-4-4:
On Windows, the PATH environment variable is no longer changed by default, as this can cause trouble with other software. The recommended approach is to instead use Anaconda Navigator or the Anaconda Command Prompt (located in the Start Menu under “Anaconda”) when you wish to use Anaconda software.
(Note: recent Win 10 does not assume you have privileges to install or update. If the command fails, right-click on the Anaconda Command Prompt, choose "More", chose "Run as administrator")
This is a change from previous installations. It is suggested to use Navigator or the Anaconda Prompt although you can always add it to your PATH as well. During the install the box to add Anaconda to the PATH is now unchecked but you can select it.
I found the solution.
Variable value should be C:\Users\dipanwita.neogy\Anaconda3\Scripts
When you install anaconda on windows now, it doesn't automatically add Python or Conda to your path.
While during the installation process you can check this box, you can also add python and/or python to your path manually (as you can see below the image)
If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt
where python
where conda
Next, you can add Python and Conda to your path by using the setx command in your command prompt (replace C:\Users\mgalarnyk\Anaconda2 with the results you got when running where python and where conda).
SETX PATH "%PATH%;C:\Users\mgalarnyk\Anaconda2\Scripts;C:\Users\mgalarnyk\Anaconda2"
Next close that command prompt and open a new one. Congrats you can now use conda and python
Source: https://medium.com/#GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444
Just to be clear, you need to go to the controlpanel\System\Advanced system settings\Environment Variables\Path,
then hit edit and add:
C:Users\user.user\Anaconda3\Scripts
to the end and restart the cmd line
In addition to adding C:\Users\yourusername\Anaconda3 and C:\Users\yourusername\Anaconda3\Scripts, as recommended by Raja (above), also add C:\Users\yourusername\Anaconda3\Library\bin to your path variable. This will prevent an SSL error that is bound to happen if you're performing this on a fresh install of Anaconda.
If you have a newer version of the Anaconda Navigator, open the Anaconda Prompt program that came in the install. Type all the usual conda update/conda install commands there.
I think the answers above explain this, but I could have used a very simple instruction like this. Perhaps it will help others.
Go To anaconda prompt(type "anaconda" in search box in your laptop). type following commands
where conda
add that location to your environment path variables. Close the cmd and open it again
This problem arose for me when I installed Anaconda multiple times. I was careful to do an uninstall but there are some things that the uninstall process doesn't undo.
In my case, I needed to remove a file Microsoft.PowerShell_profile.ps1 from ~\Documents\WindowsPowerShell\. I identified that this file was the culprit by opening it in a text editor. I saw that it referenced the old installation location C:\Anaconda3\.
For conda --version greater than 4.6, from the base of your Anaconda promt, run
conda update conda
conda init
This will update your conda root environment and setup the stuff you need to run it on both cwd and powershell.
After this, you can start any terminal and it will be conda ready.
If you don't want to add Anaconda to env. path and you are using Windows try this:
Open cmd;
Type path to your folder instalation. It's something like:
C:\Users\your_home folder\Anaconda3\Scripts
Test Anaconda, for exemple type conda --version.
Update Anaconda: conda update conda or conda update --all or conda update anaconda.
Update Spyder:
conda update qt pyqt
conda update spyder
I have Windows 10 64 bit, this worked for me,
This solution can work for both (Anaconda/MiniConda) distributions.
First of all try to uninstall anaconda/miniconda which is causing problem.
After that delete '.anaconda' and '.conda' folders from 'C:\Users\'
If you have any antivirus software installed then try to exclude all the folders,subfolders inside 'C:\ProgramData\Anaconda3\' from
Behaviour detection.
Virus detection.
DNA scan.
Suspicious files scan.
Any other virus protection mode.
*(Note: 'C:\ProgramData\Anaconda3' this folder is default installation folder, you can change it just replace your excluded path at installation destination prompt while installing Anaconda)*
Now install Anaconda with admin privileges.
Set the installation path as 'C:\ProgramData\Anaconda3' or you can specify your custom path just remember it should not contain any white space and it should be excluded from virus detection.
At Advanced Installation Options you can check "Add Anaconda to my PATH environment variable(optional)" and "Register Anaconda as my default Python 3.6"
Install it with further default settings. Click on finish after done.
Restart your computer.
Now open Command prompt or Anaconda prompt and check installation using following command
conda list
If you get any package list then the anaconda/miniconda is successfully installed.
I have just launched anaconda-navigator and run the conda commands from there.
For those who didn't check "Add Anaconda to my PATH environment variable". In Windows 10 it looks like that:
5 paths:
C:\Users\shtosh\anaconda3
C:\Users\shtosh\anaconda3\Library\mingw-w64\bin
C:\Users\shtosh\anaconda3\Library\usr\bin
C:\Users\shtosh\anaconda3\Library\bin
C:\Users\shtosh\anaconda3\Scripts
if you use chocolatey, conda is in C:\tools\Anaconda3\Scripts
I had this problem in windows. Most of the answers are not as recommended by anaconda, you should not add the path to the environment variables as it can break other things. Instead you should use anaconda prompt as mentioned in the top answer.
However, this may also break. In this case right click on the shortcut, go to shortcut tab, and the target value should read something like:
%windir%\System32\cmd.exe "/K" C:\Users\myUser\Anaconda3\Scripts\activate.bat C:\Users\myUser\Anaconda3

Why do I get a python37.dll error when starting jupyter notebook via conda

I just installed Anaconda3.7, 64 bit for windows. I used Anaconda Navigator to launch jupyter notebook. The notebook opened, but when I try to launch a kernel/notebook I get the following error:
The code execution cannot proceed because python37.dll was not found. Reinstalling the program may fix this problem.
I even tried launching jupyter from the command prompt and the anaconda prompt but it doesn't work. In those cases, jupyter tries to restart the kernel 5 times and just quits after no success.
I have the python37.dll file inside the Anaconda3 folder next to the python.exe and I tried adding python37 to PATH, but nothing helps.
Any clue what might be the problem?
I solved the issues by doing 2 things:
I uninstalled Anaconda and deleted all hidden files and folders that had to do with conda, anaconda, jupyter and python that were created recently.
I disabled the antivirus and firewall while installing (it appears that they were blocking some dll and Anaconda files from being installed correctly).
I reinstalled Anaconda
I had the same problem with the firewall after installing anaconda. I tried creating a virtual environment with "conda env create -f "environment.yml" but it never completed the creation until I disabled the firewall and antivirus.
I hope this helps others with similar issues.
Errors related to python37.dll can arise for a few different reasons. For instance, a faulty application, python37.dll has been deleted or misplaced, corrupted by malicious software present on your PC or a damaged Windows registry.
For anaconda its caused due to pip installing library into anaconda environment instead of using the conda package manager.
So you can download a python37.dll file online and move it to you anaconda directory which should solve the issue.
Check this anaconda issue might be related
https://github.com/ContinuumIO/anaconda-issues/issues/1394
Hope it helps.

Anaconda3 activate.bat is not recognized as an internal or external command

I have downloaded Anaconda3 for windows 64-bit operating system. After the download and install completed, I opened the Anaconda prompt but it give me this nice error:
'C:\Anaconda3\Scripts\activate.bat' is not recognized as an internal or external command,operable program or batch file.
I just surfed the internet and found a solution to uninstall all previous packages of python but did not work. I have searched for activate.bat file in my system " found it in one folders of anaconda directory " and copy, paste it to the Scripts folder but it gives me errors with conda packages and dependencies. Any solutions please!!
I cannot run any either jupyter notebook or conda as well. Actually, I do not know how to find them in those bunch of Anaconda files and packages.
Thanks in advance,,,.
This is a known Anaconda bug:
From their Github:
" I have fixed the underlying bug here but we will not release new Anaconda installers for a while.
The fix is in the latest Miniconda installers:
64-bit:
https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe
https://repo.continuum.io/miniconda/Miniconda2-latest-Windows-x86_64.exe
32-bit:
https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86.exe
https://repo.continuum.io/miniconda/Miniconda2-latest-Windows-x86.exe
Install those, then run the Anaconda Prompt and install whatever packages you need. If you want the latest full Anaconda release then use:
conda install anaconda=5.0.1"
Check this github thread for the full answer: https://github.com/conda/conda/issues/6053
When you installing Anaconda3 on Windows 10 and the Anaconda Navigator menu item does not install, and running the Anaconda Prompt gives the activate.bat error.
Delete all instances of the previous python IDEs
Reveal hidden files within the control menu
Go to -> C:\Users[Username] in windows explorer
Delete the files .conda and .anaconda. Possibly others if you had other IDEs.
Go to -> C:\Users[Username]\AppData\Local
Delete all python related files conda, python, ect.. any instances other python IDEs
Go to -> C:\Users[Username]\AppData\Roaming
Delete all python related files conda, python, ect.. any instances other python IDEs
Run the Anaconda installer as Admin and install in a directory such as C:\anaconda3
Sit back and wonder why an install took 4 hours out of my life and start drinking.
At some point I felt like this was a test for the uninitiated... can I start coding now?
I think the problem will be solved by clearing all dependencies. I initially had python installed, 2.7 and 3.6. I just get rid of all of them. The problem is not solved yet.
I discovered that My MySQL server is running. I just closed it but it did not work. I just uninstalled it completely and The problem is solved. Anaconda needs to listen to , I think 8888 port, which might be used also by MySQL server as well.
I hope this will help.
I had the same issue and solved it like this:
Open a command prompt (cmd.exe)
Execute these commands to reset two environment variables:
set PYTHONPATH=
set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
Start the installer (from within the same command prompt).
Now the installation will succeed!
Tip: if 'Anaconda Prompt' in the start menu isn't working afterwards, use this workaround:
C:\Users\<username>\AppData\Local\Continuum\anaconda3\Scripts\activate.bat C:\Users\<username>\AppData\Local\Continuum\anaconda3
I solved it
If you install other python directories or install anaconda on your drive. remove them all
and visit to C:\Users\<username> and you can find this babies
.anaconda
.conda
Kill them all, reinstall anaconda.
Now it works well.
I uninstalled any previous versions.Restarted system and installed Anaconda again at path C:\Users\xyzuser\Anaconda.It is working now
I solved it with:
0. Rename/delete previous Anaconda3 directory (at c:\ProgramData\Anac...) (show/check hidden items at File Manager to delete it)
1. Re-install Anaconda
2. At Advanced Installation Options, I check both:
2.1. [check] Add Anaconda to my PATH environment variable
2.2. [check] Register Anaconda as my default Python 3.6
3. then click Install button
4. Done
my OS: windows 10, 64bit
I have met exactly the same problem when I was using anaconda 5.3.1 on windows10.
Well, the solution is to uninstall your anaconda and re-install it.
And when you install anaconda, you can't close the exe command window manually which would show up at the end of installing. You should let it run and exit by itself. Only by this way your anaconda would be installed correctly.
The Fix is simple. Here's what you need to do.
Go to--
C:\Users\USERNAME\AppData\Local\Continuum\anaconda3\Scripts\
*Replace USERNAME with your own***
If you are not able to access this location, then directly search in your C drive for Continuum, and from there you can write the rest of the URL
Search for "Activate.bat"
If you are able to find this file, then go to ANACONDA PROMPT and
Change your directory by typing:
cd C:\Users\USERNAME\AppData\Local\Continuum\anaconda3\Scripts\
*Replace USERNAME with your own***
Your directory is now projecting to this new location.
Now type:
activate.bat
Hit enter
Now you activated your Anaconda.
Now, you can check if it is working or not by typing
Conda list

Why Anaconda does not recognize conda command?

I installed the latest version of Anaconda.
Now I want to install OpenCV within it. When I type:
conda install -c https://conda.binstar.org/anaconda opencv
I get this message error: "conda is not recognized as internal command ..." (sorry, I try to translate from French because my OS is in French)
The problem is that conda comes with Anaconda, so I wonder why lauching Anaconda and type the above command does not work ?
For Windows
Go to Control Panel\System and Security\System\Advanced System Settings then look for Environment Variables.
Your user variables should contain Path=Path\to\Anaconda3\Scripts.
You need to figure where your Anaconda3 folder is (i.e. the path to this folder) . Mine was in C:\Users.
For Linux
You need to add conda to PATH. To do so, type:
export PATH=/path/to/anaconda3/bin:$PATH.
Same thing, you need to figure the path to anaconda3 folder (Usually, the path is stored in $HOME)
If you don't want to do this everytime you start a session, you can also add conda to PATH in your .bashrc file:
echo 'export PATH=/path/to/anaconda3/bin:$PATH' >> ~/.bashrc
I had a similar problem. I searched conda.exe and I found it on Scripts folder. So, In Anaconda3 you need to add two variables to PATH. The first is Anaconda_folder_path and the second is Anaconda_folder_path\Scripts
When you install anaconda on windows now, it doesn't automatically add Python or Conda to your path so you have to add it yourself.
If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt
Next, you can add Python and Conda to your path by using the setx command in your command prompt.
Next close that command prompt and open a new one. Congrats you can now use conda and python
Source: https://medium.com/#GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444
I had a similar problem and I did something like the below mentioned steps with my Path environment variable to fix the problem
Located where my Anaconda3 was installed. I run Windows 7. Mine is located at C:\ProgramData\Anaconda3.
Open Control Panel - System - Advanced System Settings, under Advanced tab click on Environment Variables.
Under System Variables, located "Path" add the following: C:\ProgramData\Anaconda3\Scripts;C:\ProgramData\Anaconda3\;
Save and open new terminal.
type in "conda". It worked for me.
Hope these steps help
You probably need to update your PATH variable to include where you have installed Anaconda.
See https://github.com/ContinuumIO/anaconda-issues/issues/41 for a similar issue.
I suspect you forget to export PATH, anaconda/bin must be added in your $PATH. (Linux, OSX common problem). On Windows make sure you run install and commands as administrator.
Same problem with Anaconda running on Ubuntu 15.10. I closed the terminal and opened a new window and it worked fine.
Faced the same problem running on Windows 10 and using the Windows cmd.
Solved it by running the following command in the Anaconda Prompt which comes with Anaconda3 (as administrator):
conda install -c menpo opencv3=3.1.0
Command found on the official website: https://anaconda.org/menpo/opencv3
Try setting the file path using (for anaconda3)...
export PATH=~/anaconda3/bin:$PATH
Then check whether it worked with...
conda --version
This worked for me when 'conda' was returning 'command not found'.
Try restarting the terminal, I had the same issue, worked after restarting the terminal.
If this problem persists, you may want to check all path values in the PATH variable (under Control Panel\System and Security\System\Advanced System Settings). It might be that some other path is invalid or contains an illegal character.
Today, I had the same problem and found a double quote in a different path value in the PATH variable. All paths after that (including a fresly installed conda) were not usable. Removing the double quote solved the problem.
In Windows 10, I went to the folder where Anaconda is stored. In my case it is in \Anaconda3 folder as a shortcut to open a command prompt window, called "Anaconda Prompt". Open that and execute the command there.
Got same issue and it turns out that besides setting PATH variable, I also should not close some cmd window poped up during installation. Re-installation would work
It's not recommended to add conda.exe path directly into the System Environment Variables at stated by anaconda installer :
For Windows Users, Open Conda Prompt Shortcut and change the Target into the Correct Address :
As other users said, the best way for Windows users is to set the global environment variable.
I install the Miniconda3 for MXNet.
Before I do something, only Anaconda Prompt works for conda.
After setting the global environment variable, The CMD and Git Bash work.
But in some IDEs like RStudio, the nested Git Bash doesn't work.
After restarting my computer, the Git Bash in the RStudio works for conda.
I hope these tests helps for you.
On Windows 11 x64, default is
"C:\ProgramData\Anaconda3\Scripts\conda.exe"
CMD, run, systempropertiesadvanced , add to PATH variable.

Categories