Anaconda does not register previously initialized environments - terminal

I have created anaconda environments in my previous session but after creating a new session in my terminal it seems like anaconda forgot the names to my old environments... Can anyone tell me why this is?
I tried accessing my old environments by doing conda activate qts1, but it gave me this error:
EnvironmentNameNotFound: Could not find conda environment: qts1
You can list all discoverable environments with `conda info --envs`.
When I listed conda info --envs I get
So my previously defined environments exist, but their names have all been deleted? How do I fix this so I can use my old environments?

stupid question... forgot I installed miniconda and that was the problem... Specifically, previous environments were defined in anaconda, and not miniconda.
To access previously defined anaconda environments, just activate it through its path:conda activate /Users/usr/opt/anaconda3/envs/qts1 for example

Related

I have added conda and python path to the environment variable, but jupyter notebook is still not getting opened from cmd

I was trying to add conda and python to the environment variable using SETX Command from CMD but it was failing. I tried setting it using PowerShell and it worked. The path was added successfully but I still can't open Jupyter Notebook from my cmd.
Adding Python to the environment path is bad practice, see Anaconda FAQ. If you haven't installed Anaconda with it's default settings, you first need to:
Initialize your shells
conda init --all
After this you should have ../Anaconda3/condabin only in your path (more information via conda init --help).
But before you can run Jupyter, you also need to activate Anaconda:
C:\> conda activate
(base) C:\> jupyter notebook
The activation will add the following folders of the conda base environment to your PATH:
\Anaconda3;
\Anaconda3\Library\mingw-w64\bin;
\Anaconda3\Library\usr\bin;
\Anaconda3\Library\bin;
\Anaconda3\Scripts;
\Anaconda3\bin;
The python.exe resides in Anaconda3, jupyter.exe in Anaconda3\Scripts, so it's not enough to just add the first folder to your Path. And it's especially important to have the libraries on your Path when you want to run C-based packages like numpy.
But the very point behind the conda activate mechanism is that it allows you to configure and run different environments with different versions of python and 3rd party packages that would otherwise conflict, see Managing environmnts.
On top of that you can even install Python from python.org next to your Anaconda distribution, since conda will make sure that they won't interfere.

How to associate a conda enviroment with a project directory

I have been using miniconda for a while and have set up conda environments for each for each of my projects. What I can't figure out after looking through the documentation, is there a way to bond/associate my conda environment to my project folder for that conda environment? So that when I activate a specific conda environment it moves directly into the associated project directory. This virtualenvwrapper etc. can do for example. Is conda able to this?
As mentioned in Activating an environment, conda automatically executes "activation scripts" when an environment is activated. These scripts are typically provided by conda packages installed in the environment.
Just add a script of your own with a cd command. See here for details:
https://stackoverflow.com/a/43415167/11451509

running source activate <env> in Anacaonda Promt fails

There are already many posts describing how to solve 'source' is not recognized as an internal or external command," by adding anaconda to path.
Following the recommended approach is to not check the box to add Anaconda to your path.
How can i start my env from the Anaconda Promt?
conda 4.6.11
conda env list show my env's
conda activate environmentNameHere in the Anaconda terminal will do it. If you want to deactivate an environment you just type conda deactivate

conda info --envs doesn't list all my environments

When I run the code,
conda info --envs
it lists three environments, but I know I have more environments because when I activate other environments (that I remember creating), it works.
Is this an indication that something is wrong with my conda environments?
Is there a way to fix it?
I'm running a windows 10 system. python 3.5 installed
If the environments which are not being listed are in some non-standard location, you can always add them to the list of directories to be searched for:
conda config --append envs_dirs /path/to/directory/containing/other/environments

Spyder does not run in Anaconda virtual environment on Windows 10

This is my first post here. I tried to find an answer to this question but to no avail.
Just installed Anaconda2 (2.7.11 Python kernel) on my Win10 machine. I am trying to learn the conda command. Here is my problem.
I go to the Anaconda prompt window.
I create a virtual environmant with conda create -n myenv python=3.4 command.
I activate the environment with activate myenv.
When I list the environmants with conda env list it shows as active (star next to it).
When I start python from a command line it shows me that it is running 3.4.
The same with ipython.
When I type spyder it opens the spyder window but shows me 2.7.11. This is confirmed by running print(sys.version).
Am I doing anything wrong or is this just windows 10 problem.
Thanks in advance,
Andy
When you type spyder, the search for this command begins in the paths that the conda environment created. If it cannot find it there, it will go and search at other places. In your case in the paths of the default Anaconda install. So after you activate your environment:
activate myenv
you need to install sypder inside this environment:
(myenv) conda install spyder
where (myenv) indicates the active environment.
Change the Python interpreter in the Preference menu. See pic below.
you just have to write
conda create -n myenv python=3.4 spyder
conda activate myenv
spyder
and for deactivation later on ..
conda deactivate
Note: using Windows 10.
To use Spyder in a particular environment, there are at least two options:
conda install spyder into that environment - the problem, for me, is that it also wants to install a large number of other packages that I don't want or need in that environment.
I just want to use Spyder for interactive programming/investigation using the particular packages that I have chosen to install in a particular environment. The solution to this is option 2.
Note: I installed Anaconda initially and so have Spyder in the Anaconda environment.
Copy the relevant Spyder files from the Anaconda environment into the particular environment(s) you want to use Spyder in:
From: C:\Users\User\Anaconda\Lib\site-packages
Copy: spyderlib & spyderplugins Folders
To: C:\Users\User\Anaconda\envs\[Environment_Name]\Lib\site-packages
From: C:\Users\User\Anaconda\Scripts
Copy: spyder.exe, spyder.ico, spyder_light.ico & spyder-script.py Files
To: C:\Users\User\Anaconda\envs\[Environment_Name]\Scripts
To use Spyder in the desired environment:
Activate the environment
(Environment_Name) prompt> spyder
This works for me!

Resources