conda: command not found even though Anaconda is in path (WSL) - anaconda

I've tried/checked related posts but I can't find what's stopping my Windows Subsystem for Linux from running conda.
These paths (I have verified that they are correct and exist) are in my PATH.
/mnt/c/Users/user/Anaconda3:
/mnt/c/Users/user/Anaconda3/Library/mingw-w64/bin:
/mnt/c/Users/user/Anaconda3/Library/usr/bin:
/mnt/c/Users/user/Anaconda3/Library/bin:
/mnt/c/Users/user/Anaconda3/Scripts
Note that I added the new lines so that it is more readable, the spaces aren't actually present in my PATH.
When I run conda --version on command prompt I get conda 4.7.12, but I get this error when I run the same thing on Linux: conda:command not found
Also, I tried closing and opening my terminal and shifting the paths to the front of PATH (not that it matters but I was desperate), both didn't help.
Already referred to:
How to run Conda?
conda command not found even though path is exported
Anyone has any idea?

Related

no packages are recognised by zsh

I have previously installed npm, homebrew, oh-my-zsh and other runtime environments and worked perfectly on my Mac M1, until recently, no packages or runtime environments are being recognised.
When I enter brew I get error as zsh: command not found: brew but I can see in my opt/ path that there's homebrew folder and its content present,
Similarly for npm it shows error zsh: command not found: npm
I might have done something with my PATH
Here's a screenshot
Edit: My .bash_profile is empty, should it be empty??
On the M1 Macs, homebrew files are installed by default in /opt/homebrew, and the executables are usually placed in or linked to /opt/homebrew/bin. That directory is not in your search PATH - instead, it looks like you have the PATH settings for an Intel Mac.
As you noted, updating the PATH should fix the issue, but first you need to determine which shell you are using (the question is tagged both zsh and bash). It's probably zsh, since that's the default on newer versions of macOS, and it would explain why the .bash_profile is empty. You can double-check this with the command echo $0.
There are several ways to update the path, and many are described in other posts here at SO, such as this one. This will also work for zsh:
print 'PATH=$PATH:/opt/homebrew/bin' >> ~/.zshrc

Can't access conda after changing name of mac user account

When I first got my Macbook Pro, I set it up where my home folder was named
/Users/monicaheddneck/
I installed all the software I needed, like python, etc, and went about my business.
Last night, I decided to change the name of my folder to simply
/Users/monica/
and did it this way.
Fine.
Today, I decided to run jupyter notebook for the millionth time, and realized I may have borked all paths for all the libraries I have...and who knows what else.
For example,
conda --version
tells me I don't even have conda installed:
-bash: conda: command not found
My question: is there any way to fix the broken path to conda?
I am using Mac High Sierra, version 10.13.3
When using the conda installer, it asks if you want to add and export line with the path to conda in your bashrc file. My guess is that it wasn't updated when you changed the name of your account.
Have a look at your bashrc (hidden file) which should be in your home and update it as necessary ! The line should look like this:
export PATH="/Users/monicaheddneck/xxxconda/bin:$PATH"
and should be fixed appropriatly:
export PATH="/Users/monica/xxxconda/bin:$PATH"
You will then have to source your new bashrc file or restart a terminal.

unable to run 'aws' from cygwin

I'm using cygwin installed on Windows 10 and trying to access awscli from it.
I used pip install awscli to install awscli. This installed awscli. I then tried to run only aws to see if it is installed and I get the following error:
-bash: /cygdrive/c/Program Files/Anaconda2/Scripts/aws: C:\Program: bad interpreter: No such file or directory
I'm not sure why this is happening. Any help in this regard would be highly apreciated.
This is still an issue even with the latest version of AWS cli. So after some trial and error I found a pretty good workaround that will not make you switch your favorite shell.
First, make sure python is on your PATH. That is from anywhere in the system you can just run python and it work.
Find the aws script and open it for editing (for me it was located in c:\Program Files\Python36\Scripts\aws) and change the hashbang (that would be the first line in the script) to #!python.exe. For me it was set to #!c:\Program Files\Python36\python.exe. That space in the middle of Program Files caused the issue when that path got converted to Linux like path. Changing it to #!python.exe sidesteps the issue.
When you update AWS cli, repeat the workaround.
PS. You could also avoid this issue by installing python somewhere in a folder without spaces in path. That requires to reconfigure your system, so I did not do that myself.
I would install the standard python and ensure it is coming up first in your path with which python and which pip. Path issues like this are due to mixing and matching executables targeting different platforms in my experience. Certain commands do not implement functionality to convert paths from Windows to Linux and back (it appears your specific commands are failing on spaces).
Since you say you are on Windows 10, if you have the anniversary edition, I would recommend Windows Subsystem for Linux over cygwin. You will likely see less Windows issues on WSL since it uses the exact same ubuntu packages you would use on Linux instead of the cygwin port and maps them low level to the NT Kernel.
The Problem comes from "Program Files" having a space. This is something that is related to cygwin (I encountered the same error with git bash on windows). In a script I had something like this:
#!/c/Program Files/some_program/executable.exe
Escaping the space with a backslash or using quotes didn't work.
The solution is to use the DOS' short filename:
Progra~1 for "Program Files"
Progra~2 for "Program Files (x86)"
So my line would turn into:
#!/c/Progra~1/some_program/executable.exe
In Windows:
cd .. to go to home directory which shows pwd as /.
Now, cd to /cygdrive/c/Program\ Files/Anaconda2/Scripts
Now, run: python aws configure
Example:
user#user /cygdrive/c/Program Files/Anaconda2/Scripts
$python aws configure

Issues with Bash and NPM paths

(bash newbie alert)
I'm having a hell of a time getting my dev machine up and running post clean install of 10.10.
I first attempted to install everything via homebrew. After installing Yeoman I was still getting "Yo" command not found errors. I followed these instructions http://d.pr/1hjAi on the Yeoman FAQ however I'm still getting the errors. I then realized I didn't have a .bash_profile, .bashrc or a .profile file in my home directory. I've tried adding just about every path variable I've found on line and nothing seems to fix it. On top of that, adding a path to any of the files mentioned above doesn't seem to update the path.
echo $PATH gives me
/usr/local/share/npm/bin:/usr/local/git/bin:/opt/X11/bin:/usr/local/bin:/sbin:/usr/local/share/npm/bin:/usr/sbin:/usr/local/bin/npm:/bin:/usr/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:~/bin:/usr/local/sbin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/share/npm/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Any help would be great.

Using virtualenvwrapper-win in msysgit (sh.exe": mkvirtualenv: command not found), works in normal cmd

I have trouble setting up my virtualenv to work correctly in windows.
I'm using the latest (1.9) msysgit console to do my normal work and installed virtualenv, virtualenvwrapper and virtualenvwrapper-win via pip. It works correctly in the normal cmd, but msysgit just displays
sh.exe": mkvirtualenv: command not found
I can use the normal virtualenv, but it's cumbersome and additionally ignores my set variables of %WORKON_HOME% and %PROJECT_HOME% to seperate my envs and projects folder. Both works in cmd.exe.
Any idea?
The problem is that msysgit is not a full MSYS install. It only contains what is necessary for git to work. You have a few options: (1) Install the full, real MSYS/MINGW32 environment (not recommended why have two copies installed) or (2) install the missing piece(s).
Depending on which version of msysgit you have installed the missing pieces seem to vary, but at the very least you need to download a copy of mktemp.exe. Some users have reported also needing fmt.exe.
You may need to create a "MSYSTEM" environment variable and set it to the string "MINGW32" (which should tell virtualenvwrapper to configure paths for windows even though being run from a unix shell -- i.e.: Scripts dir instead of bin dir). And "MSYS_HOME" should be set to where msysgit is installed (perhaps add the line export MSYS_HOME = /c/Program\ Files\ \(x86\)/Git to .bashrc). I don't recall offhand if the msysgit installer sets these correctly (or at all).

Resources