I have installed python 3.5 with the following commando:
conda create -n py35 python=3.5 anaconda
I also have a base Anaconda python27 installed. When I wish to update it I just write:
conda update conda
But how do I update my pyhon35?
I have tried this:
activate py35
[py35] C:\Users\trofl>cd C:\Users\trofl\Anaconda2\envs\py35
[py35] C:\Users\trofl\Anaconda2\envs\py35>conda install conda
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ....
Solving package specifications: .........
Error: 'conda' can only be installed into the root environment
It looks like you are trying to install when you have conda-env and conda-build in your current environment. You have to remove these first to update conda.
source activate my-env
conda remove conda-build
conda remove conda-env
conda update anaconda
Related
I'm trying to install python 3.9 in a conda enviroment. I tried creating a new conda env using the following command,
conda create --name myenv python=3.9
But I got an error saying package not found because python 3.9 is not yet released
So, I manually created a folder in envs folder and tried to list all envs. But I couldn't get the manually created new environment.
So, how do I install python 3.9 in a conda env with all functionalities like pip working?
To create python 3.11 conda environment use the following command
conda create -n py311 python=3.11
py311 - environment name
Update 3
To create python 3.10 conda environment use the following command
conda create -n py310 python=3.10
py310 - environment name
Update 2
You can now directly create python 3.9 environment using the following command
conda create -n py39 python=3.9
py39 - environment name
Update 1
Python 3.9 is now available in conda-forge.
To download the tar file - https://anaconda.org/conda-forge/python/3.9.0/download/linux-64/python-3.9.0-h852b56e_0_cpython.tar.bz2
Anaconda Page - https://anaconda.org/conda-forge/python
As pointed out in the comments, python 3.9 is not yet there on any channels. So, it cannot be install yet via conda.
Instead, you can download the python 3.9 executable and install it.
Once the installation is done, a new executable will be created for python 3.9 and pip 3.9 will be created.
Python:
python3.7
python3.7-config
python3.7m
python3.7m-config
python3.9
python3.9-config
pip
pip
pip3
pip3.7
pip3.8
pip3.9
pipreqs
In order to install ipython for python 3.9,
pip3.9 install ipython
On 6-Oct-2020, Python 3.9 was made available on conda-forge: https://anaconda.org/conda-forge/python. However, most of the other packages (including some of the essentials to create a basic environment) didn't explicitly support Python 3.9 yet.
However (as of 15-Oct-2020), the basic dependencies appear to have been fixed and the following command now works:
conda create -c conda-forge python=3.9 -n py39-demo
You can now simply just run
conda create --name myenv python=3.9
And it will create your python 3.9 virtual environment simply.
I created a conda environment with Python version 3.8, but it doesn't support matplotlib... So I am looking for something like this to change the Python version: conda env my_env update to python=3.6. Is this possible or do I need to recreate the environment?
I have miniconda installed.
Activate the relevant environment, then install your target python version.
conda activate my_env
conda install python=3.6
Adding to the answer above
conda activate my_env
conda uninstall python
conda install python=x.x
Rebuild a new environment, for example called "myenvi"
conda create --name myenvi python=3.6
And make sure the version by
python --version
After installing all packages, double-check with
conda list -n myenvi
If you already have existing python installation may be in other environment, you can simply use it as base.
Here's what you need to do:
conda activate base
conda install python=3.6
Note: This will activate root environment. and python 3.6 already installed, it will simply replace it.
OS - Ubuntu 16.04 LTS
I want to setup my machine so I have two virtual environments
For pip
For conda
I want to do this so in one virtual environment I can have all libraries that are installed using pip and in the other I can have all my anaconda work/libraries
For pip and conda both I want to a have Python3.6 as default
How can I do this ?
First, install Miniconda. You can then create an environment where you (try to) only use conda
> conda create -n conda_only python=3.6
> conda install -n conda_only numpy ...
And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,
> conda create -n pip_only python=3.6 pip
> source activate pip_only
> pip install numpy ...
I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.
Why I cannot update conda from a conda environment, but I can use it?
An example
I can update conda from root
[ravas#localhost ~]$ source activate
(base) [ravas#localhost ~]$ conda update conda
Solving environment: done
# All requested packages already installed.
I cannot update it from p36:
(base) [ravas#localhost ~]$ source activate p36
(p36) [ravas#localhost ~]$ conda update conda
PackageNotInstalledError: Package is not installed in prefix.
prefix: /home/ravas/miniconda3/envs/p36
package name: conda
This seems to occurs as conda is not installed in p36
(base) [ravas#localhost ~]$ conda list | grep conda
# packages in environment at /home/ravas/miniconda3:
anaconda-client 1.7.1 py37_0
anaconda-navigator 1.9.2 py37_0
conda 4.5.11 py37_0
conda-env 2.6.0 1
(p36) [ravas#localhost ~]$ conda list | grep conda
# packages in environment at /home/ravas/miniconda3/envs/p36:
anaconda 5.3.0 py36_0
anaconda-client 1.7.2 py36_0
anaconda-project 0.8.2 py36_0
pdfminer.six 20170720 py36_0 conda-forg
However, from p36 I can use conda
(p36) [ravas#localhost ~]$ conda update anaconda
Solving environment: done
# All requested packages already installed.
Why is that?
This is a consequence of how the shell (Bash, zsh, csh, fish, etc.) finds programs to execute. (The shell is the program that is running to process the commands you type in the terminal). The shell looks for executables in folders that are specified in the PATH environment variable. It searches these folders in the order that they're specified in that variable. If you look at the contents of the PATH with your environment activated, it should look something like
$ echo $PATH
/home/ravas/miniconda3/envs/p36/bin:/home/ravas/miniconda3/bin:...
When the shell tries to find the conda executable, it looks first in the environment directory; when it doesn't find it there, it looks in the base directory, where it does find it!
conda is not installed in the new environment. But you can get a conda in that derived environment like this:
activate the base environment
activate your other environment
run a conda install conda
Now you have a conda in that other environment, and work with that environment as usually.
I'm trying to downgrade python version of anaconda via conda install python=3.3, but have following error:
~/anaconda3/bin$ ./conda install python=3.3
Fetching package metadata .........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- gevent -> python 2.6*
- python 3.3*
Use "conda info <package>" to see the dependencies for each package.
How to resolve conflicts with the packages?
If you want to set specific version, use it like this:
WARNING: This command will overwrite the default python version system-wise
conda install python=3.6
To create environment with a specific version, you can do:
conda create -n $PYTHON36_ENV_NAME python=3.6 anaconda # set custom env name
The anaconda at the end allows the env to use all anaconda packages
For more information refere to Anaconda documentation
There are two ways to downgrade python in anaconda.
1. Downgrade python in the active environment
(This can lead to conflicts with installed packages for higher python versions)
conda activate nameOfYourEnvironment
conda install python=3.3
2. Create a new environment
(This is a more safer way, but you need to install all necessary packages again)
conda activate base
conda create --name env_name python=3.3
Hint: Use conda list before creating a new environment to get the names of all installed packages in the actual environment.
If you want to check your installed environments do:
conda env list
If you got problems in installing, make sure to run the shell as administrator (always recommended).
You can make environments with other versions of Python using this command:
conda create --name py33 python=3.3
source activate py33
Very firstly check the current version using command python --version. Then on anaconda prompt type the command conda search python which will list all the python versions available till date. Then from that list select your version and type conda install python=3.5.2 or any of your choice