I use Anaconda frequently to manage python packages on a Windows machine. But I'm having trouble understanding how it works on a Ubuntu, probably because I'm new to Linux in general.
I downloaded the Anaconda Linux installer (python 3) and run bash ~/Downloads/Anaconda3-5.2.0-Linux-x86_64.sh to install. After installation, I was able to type anaconda-navigator in terminal to start the GUI, where I created a new python 3.6 environment called tensorflow_env. But I couldn't activate it in the terminal. I followed the error message and typed
echo ". /home/chris/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
in the terminal, which solved the problem.
To validate, here is how it looks like now in my terminal:
Being a frequent Anaconda user in Windows, what I don't understand is when I clicked open terminal from the green triangle in the GUI (see screenshot below),
The opened conda terminal still says bash: activate: No such file or directory. And if I test Python, as you can see it's not even python 3.
What's going on with the navigator? It still can't activate environments.
Related
In general I am new to python so keep it easy. I have started my coding in Spyder since it was easy to install libraries with Anaconda.
Now we want to switch to VS Code for version control. I have switched interpreter and python path to Anaconda folder, but if I open python files I have created in Spyder I can't use in VS code, issue always is with importing libraries.
Screenshot
The first rule with Anaconda is to not manually mess around with the paths. Anaconda has a different philosophy: Before you can use Python, you need to activate a conda environment.
c:\> conda activate
(Anaconda3) c:\> python
>>>
VSCode detects conda environments and you just have to select one for your project (Python: Select interpreter). Now open a new terminal and watch VSCode activating the environment for you (like shown above).
However, when you start your script for the first time, VSCode sometimes invokes the interpreter even before the conda activation has finialized. Then simply restart your script.
I am on a mac. the terminal window doesn't seem to be able to access my bin or bash folder anymore, I'm not sure.
In the terminal window I am typing 'conda --version' to determine which version of Anaconda I have installed but I get the message "-bash: conda: command not found" - Also when I am in Atom, and am using the python text editor and I'm trying to create a virtual environment, I type 'sudo conda create --name myDjangoEnv django' and I get the same message, 'sudo: conda: command not found'. I used sudo because otherwise it would not let me set up a virtual environment. I thought I had to enter a password to set up a virtual environment on a mac, and it worked yesterday. I think I edited the bash profile when I set up the virtual environment.
I was able to do all of this yesterday, when I typed 'conda --version' in my terminal I got the version of anaconda I installed, and I was able to update the version of anaconda. And in the python editor in Atom, when I typed ''sudo conda create --name myDjangoEnv django'-it set up a virtual environment. I was also able to update to the latest version of django.
Does anyone know what is going on? I'm pretty new to all of this stuff. Should I reinstall Atom, Anaconda, django, and Python? Perhaps, I didn't install it to the right location? Is it easier to run all these programs on windows 10? Thanks for any help.
atom is installed in: Macintosh HD/Users/myusername/Downloads
django: there's no .app for django so its hard to tell where its installed. some of the folders for django are installed here:
Macintosh HD /Users/myusername/newproject/newenv/lib/python3.7/site-packages
or another django folder's location is here:
Macintosh HD /Users/myusername/opt/anaconda3/lib/python3.8/site-packages/bokeh/server
python: there are so many python folders, 1 python 3.8 folder's location is:
Macintosh HD/Users/myusername/opt/anaconda3/pkgs/lxml-4.5.2-py38h63b7cb6_0/lib
Anaconda: Macintosh HD/Users/myusername/opt/anaconda3
I am on a Mac. The terminal window doesn't seem to be able to access my bin or bash folder anymore, I'm not sure.
In the terminal window I am typing conda --version to determine which version of Anaconda I have installed but I get the message -bash: conda: command not found. - Also when I am in Atom, and am using the Python text editor and I'm trying to create a virtual environment, I type sudo conda create --name myDjangoEnv django and I get the same message, sudo: conda: command not found.
I used sudo because otherwise it would not let me set up a virtual environment without entering a password.
I think I edited the bash profile when I set up the virtual environment.
The thing is, I was able to do all of this yesterday, when I typed conda --version in my terminal I got the version of anaconda I installed, and I was able to update the version of anaconda. And in the python editor in Atom, when I typed sudo conda create --name myDjangoEnv django it set up a virtual environment. I was also able to update to the latest version of django.
Additionally, I had a new problem. In Atom I couldn't install a package. if I hit install a package, nothing would happen. Yesterday I was able to install packages. However I restarted Atom and now I am able to install packages, but I'm still having the problem listed above.
Does anyone know what is going on? I'm pretty new to all of this stuff. Should I reinstall Atom, Anaconda, django, and Python? Perhaps, I didn't install it to the right location? Is it easier to run all these programs on windows 10?
Atom is installed in /Users/myusername/Downloads
django: there's no .app for django so its hard to tell where its installed. Some of the folders for django are installed here:
/Users/myusername/newproject/newenv/lib/python3.7/site-packages
or another django folder's location is here:
/Users/myusername/opt/anaconda3/lib/python3.8/site-packages/bokeh/server
python: there are so many python folders, 1 python 3.8 folder's location is:
/Users/myusername/opt/anaconda3/pkgs/lxml-4.5.2-py38h63b7cb6_0/lib
Anaconda: /Users/myusername/opt/anaconda3
echo "$PATH" produces
/Volumes/myExternalDrive/opt/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
conda is installed in: /Users/myUserName/opt/anaconda3/pkgs/conda-4.8.3-py38_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc –
Your PATH appears to have an incorrect component. Where you see
/Volumes/myExternalDrive/opt/anaconda3/bin
you should apparently have
/Users/myusername/opt/anaconda3/bin
At a terminal prompt, you can temporarily fix this with
PATH=/Users/myusername/opt/anaconda3/bin:$PATH
and at that point, you should be able to run conda --version and python3 in that terminal instance, until you terminate it.
The proper permanent fix is to find the place where this was incorrectly configured, and correct it there; probably your .bashrc needs a more thorough cleanup, but that's already far outside the scope of your original question.
(This assumes your home directory is /Users/myusername; the command echo "$HOME" should confirm this. That's where you'd look for .bashrc too.)
I have an Anaconda distribution installed on Mac OSX (10.14.2). With it, I installed VSCode which I'm to write python scripts. Recently, I've updated some environments in Anaconda and something happened with the configuration of the python path VSCode uses for its integrated terminal: when I run my code, an ImportError comes up for the joblib package that I now have installed in my conda environment (also happens for other packages), which doesn't happen when I run the same code in a regular terminal.
Using conda list in the integrated terminal gives me the correct list of packages for the environment I'm using, and conda env list indicates that indeed this specific environment should be active. However, I can see that that something is off, because in my normal terminal I get:
$ which python
python is /Users/Joris/anaconda3/envs/astro3/bin/python
python is /usr/bin/python
While in the VSCode terminal:
$ which python
python is /usr/bin/python
python is /Users/Joris/anaconda3/envs/astro3/bin/python
I've tried changing some of the VSCode settings, like manually pointing python.pythonPath and python.venvPath to my anaconda environment folders. (The setting python.terminal.activateEnvironment is set to true.) Also, reinstalling VSCode through the Anaconda distribution does not seem to help. So unfortunately, I can't seem to get VSCode to run python with my Anaconda environment which contains the packages I need.
Press (macOS): ⇧+⌘+P, (Linux/Windows: Ctrl+Shift+P) in VS Code.
Type: python select interpreter
Select /Users/Joris/anaconda3/envs/astro3/bin/python
Test if your lib is usable.
I have installed Anaconda for python2 as per official documentation. In the end I received message about successful installation. To check I typed ipython and its terminal is displayed successfully but on doing conda --version nothing comes. I have checked following:
which python : It gives /home/username/anaconda2/bin/python
sha of downloaded package: It is correct
Other Anaconda installed package (ipython): It's terminal comes up
which conda: /home/username/anaconda2/bin/conda
Closed terminal and again open it(mentioned in docs). Checked after shutdown also !
On doing anaconda-navigator following message comes:
Please activate the conda root enviroment properly before running the
anaconda-navigator command.
To activate the environment please open a terminal and run:
source /home/username/anaconda2/bin/activate root
For more information please see the documentation at:
https://docs.anaconda.com/anaconda/navigator/
On doing as suggested above, nothing happens and the problem persists. Since I am new to this, might be missing something tivial, please suggest?
I was facing the exact same issue on Ubuntu 17.04 x64. In my case it was the usage of a different shell than the default (bash).
I installed the program using my ZSH shell.
During installation it asks:
Do you wish the installer to prepend the Anaconda<2 or 3> install
location to PATH in your /home/user/.bashrc ?
That made me try to run the Anaconda Navigator using bash shell (just use the bash command to switch). And yes it worked.
If you look into the .bashrc you will notice that the installer appended something like:
export PATH="/home/user/anaconda2/bin:$PATH"
If you export the path to ZSH (or any other shell you use) then it will work with your shell as well. In the case of ZSH just copy the export PATH line to the end of .zshrc