Errors with conda commands on Windows 10 - python

I'm getting started on Python 2.7, using the Anaconda package and its Spyder IDE, but when I find out that something I want to do requires that I execute a command that starts with the word "conda", I have terrible trouble.
I first assumed that those were commands to type in the IPython console in Spyder, but instead of executing what I commanded, it told me NameError: name 'conda' is not defined.
I also tried the Windows Command Prompt (cmd.exe), but it told me conda is not recognized as an internal or external command. Some results when I googled that claimed that I had to add one of the Anaconda-related folders to Windows' Path, so I tried that, but still no good.
How can I carry out conda commands on Windows 10?

Just Run Command Prompt with Admin permission then it will install desired package and will work perfectly

First thing, you're right that those commands are not intended for the IPython console. Second, there is a good reason they are not working in the cmd.exe Command Prompt.
They are actually intended to be given to the Anaconda Prompt. On Windows, start typing "Anaconda Prompt" and, if you have Anaconda correctly installed, you should see an icon very similar to that of cmd.exe, except the "C:_" on the black background will be grey instead of white. That is where these commands are to be given.
If you are not sure which user/users Anaconda was installed for, it may take some extra time. If it was installed for all, or you're not sure, then you should go ahead and left-click the icon. If it was installed for you, everything should go fine, at least as far as permissions go.
If it was not installed for you, then it will at first seem to be obeying you when you command it to modify the software. It will fetch the metadata, tell you that these things will be installed or updated, and then ask you Proceed ([y]/n)? And then, after you type in y and hit Enter, it will tell you CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda3. Now you know, you need to open the Anaconda Prompt by right-clicking the icon and clicking "Run as administrator". Then you can type in your conda install... or conda update... command and see it carried out.
(This might only be possible if your Windows account is an administrator account; if that is true and you're not an administrator, you'll probably need to ask someone who has an administrator account for help.)
Credit to users on Google Groups for showing this solution.

Related

Command Prompt / Anaconda Command Prompt not opening in Windows 11

I am doing a research project that involves me running terminals in the Anaconda Command Prompt. I was able to install and work the current version of Anaconda (4.12) and get the command prompt running there, but I had to depreciate my version of Anaconda to 4.2 so I can work on my project using Python 3.5. That version of Anaconda could not open the Anaconda Command Prompt or the Anaconda Navigator on my machine, so I tried reinstalling the current version of Anaconda after uninstalling 4.2; however, now I have the problem where the Anaconda Command Prompt can't open (but I've been able to run Anaconda Navigator). I tried doing the following things to see if I could fix this issue:
Opening the Anaconda Command Prompt through the Windows Command Prompt; however, now I have the added problem of the Windows Command Prompt not opening (which I tried fixing in the steps below)
Running the command prompt in Windows Safe Boot Mode. This method did open the command prompt, but it opened it up under the wrong letter drive. On this mode, I get the directory:
X:\windows\system32
What confuses me is that I don't even have an X: drive on my machine.
Trying to use some of the commands I was going to use in the command prompt in Powershell; however, when I opened powershell, I got an error message regarding Execution Policies. I was able to get the error fixed by changing some of the Execution Policies. I changed the execution policy on CurrentUser and LocalMachine to Unrestricted. This solved the problem on Powershell, but didn't fix the problem with opening the command prompt.
Going back into the Safe Boot Mode Command Prompt and seeing if the letter drive had been fixed to the default C:. The letter drive is still X:.
I don't know what to do to fix this problem. I've tried many of the things I read online from windows and other forums, but so far they haven't worked.
I had the same issue, here is the solution (extracted from Microsoft Assistance Service):
The fix was to open Registry Editor by searching "regedit" in the start menu, then search for "autorun" in the Edit tab, and delete the "autorun" file from the system through right click.
The offending "autorun" element is located under the key:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
and contains an errorneous value if exists which prevented cmd.exe from starting properly.

Conda keep opening this Python Interpreter

I installed Anaconda 3. After Install I reboot the computer but, when I opened Anaconda Navigator, this keep happening, first this CMD window appears Conda.exe
and then this window appears gpython.exe
Before reboot, everything fine, I could open Anaconda Navigator. After reboot, (insert Billy Butcher from the Boys) BOOM, this happen.
This also happens everytime I type "conda" on the command prompt,with the python interpreter (second picture) keep appearing. So pretty much any solution on the internet that told me to use "conda" doesnt help.
Also this happens to every Anaconda Application (Anaconda Prompt, Anaconda Navigator).
I believe that whenever you launch anaconda conda.exe will run, at least it does for me.
Regarding gpython.exe, I could only find the following question referring to it
Django error: Command throws a python window when executing makemigrations command in a Python/Django project
This makes it seem like your anaconda may require a reinstall, I checked my anaconda files and couldn't find a gpython.exe in the path where yours appears, so this may be the case. Hope this helps.

Python jupyter notebook update bug

I've been using Juptyer Notebook for more than a year now with python3 and I recently saw through the Anaconda Navigator that an update to the 5.7.0 version was available. I installed it but the first Notebook that I tried to launch wouldn't work : I run the most simple expressions such as:
test = [1,2,3]
print(len(test))
It keeps buffering and nothing comes out of this. Additionally, when I try to define a function, the font doesn't become green and bold like always.
Then I tried to go back to the older version, and that didn't work too. Now I'm back with the up-to-date version but still doesn't work.
I'm on a Windows machine and I don't know very much about source code or precise things to look for in this case.
Could you please follow the below steps and share the feedback. It seems that new update installed in a different path.
Step 1:- Get an Anaconda command prompt and run jupyter notebook in it, It will probably won't work, but you could get a detail error message saying what's failing.
Step 2:- After your anaconda update, if that's left over from the older version of Anaconda. The shortcut properties might tell you what it's trying to call - there may be a wrong path to Anaconda or something wrong, so you can go to anaconda desktop shortcut, then right click on it and check the properties. And also run the %appdata% command in windows 'Run' and check the installed anaconda app data directory.
Stop 3:- If the shortcut was the issue. You can manually change the "Shortcut target" (in windows) to the following
Eg: C:\Users\'yourusername'\AppData\Local\Continuum\Anaconda2\Scripts\jupyter-notebook.exe

Idle and Anaconda

I use to have idle. Then I downloaded Anaconda and opened idle through there. I have not used idle for a while but just recently went to go open it up and use it again. However, it seems I no longer have idle on my computer, to my understanding I can still get to idle through Anaconda but I forgot how. Is there a way to open idle through Anaconda without re-downloading idle? If so what command can I use to pull Idle up?
Search for this folder "idlelib" in the Lib folder of the Anaconda version you have installed and you will find idle (check its file type: "compiled python file").
Pin it to your taskbar and run.
You are looking for C:\... <\> ...Anaconda3\Lib\idlelib\idle.bat
There is also C:\ ... <\> ...Anaconda3\Scripts\idle.exe which seems to run a little smoother, but there has to be a Command Prompt open in the background to run. ... ?
Navigate to your Anaconda3 installation folder. Yours could be anywhere, mine is at "C:\ProgramData\Anaconda3", but I installed for all users and you could have selected a random location on your drive. If you managed to add it to the environment variables you could easily find it by running the Command Prompt (not Powershell - has to be Command Prompt) and typing where conda or where anaconda and pressing enter. You should find a folder named Anaconda3 or something of that nature.
If you navigate to this folder, and within it find the "Anaconda3\Lib\idlelib\" folder, within it there is a file called "idle.bat". If you find this "Anaconda3\Lib\idlelib\idle.bat" file you can double click it to run IDLE, although it may be a little messy/outdated/glitchy/strange since you are updating all kinds of folders within Anaconda and some of them may have helped idle.bat run. Mine has a the spyder icon associated with it in the task bar and a blotted out IDLE icon in the top left corner for some reason. You could of course run the full path in command prompt as well if you already know where it is, for instance I would run...
C:\Users\Thomas>C:\ProgramData\Anaconda3\Lib\idlelib\idle.bat
~or~
C:\Users\Thomas>C:\ProgramData\Anaconda3\Scripts\idle.exe
--> It may be easier to just download a new version of Python side by side with Anaconda to run IDLE. I have been attempting to set a shortcut in the Start Menu that runs from anaconda properly for days and have failed. This way, there should be a right click>'run with IDLE' option for python files.
I believe the tilde slash (~/) was meant to imply your home directory since that is what it signifies on a linux machine, but seeing as you could have put it anywhere on the machine, even directly on the C:\ drive, maybe he meant 'unknown file path'.
If you are running MacOs (currently I am on Catalina - MacOs10.15) it is quite simple to run IDLE from Anaconda environment:
Launch Anaconda
Go to MacOs Terminal.
Type IDLE3
warning: if you type IDLE, the Python 2 IDLE will be opened ... but if you are using Python3 installed with Anaconda ... it doesn't work properly.

Python Launcher Mac

On my mac I am trying to make a Python script open by default in the Python Launcher.
I left click on the script and select "open with" and select the Launcher. Every-time I do this Terminal pops up, the Launcher window appears briefly. Then a messages pops up in a window: "Python Launcher can only run certain scripts try another."
Something along those line (the message has stop popping up since the first time I tried it but the script still doesn't run). I tried everything, GUIs, and basic scripts (like print "Hello World"). None work!
I tried doing the same thing on other computer and I get the same problem. What am I doing wrong ?
Does your script use a shebang line:
#!/path/to/executable/python2.6
And does it have execute permissions?
chmod +x path_to_file.py
It should run OK like this.
Assuming you're talking about Anaconda, Launcher is now deprecated, so your approach will have to change anyway. It has been replaced by Navigator.
Make sure you have updated Anaconda within terminal using
conda update conda
Then, you can install Navigator with
conda install anaconda-navigator
You will see a new icon show up that functions much the way Launcher used to. Your script will now have to be tied to it instead of launcher, assuming you figured that out with previous commenters' help.

Categories