Install Anaconda on Ubuntu with preexisting Python - python

I have Ubuntu 16.04 LTS with Python 2.7 and 3.5. I've set up virtual environments to access both 2.7 and 3.5 separately and everything works fine.
Now, I need to install Anaconda to access some libraries for a class I am taking. Whats the best way to do this without disrupting the virtual environments I have already set up.

Install Miniconda, a mini version of Anaconda that includes just conda, its dependencies and Python.
https://conda.io/docs/user-guide/install/index.html#installing-conda-on-a-system-that-has-other-python-installations-or-packages
You do not need to uninstall other Python installations or packages in order to use conda. Even if you already have a system Python, another Python installation from a source such as the macOS Homebrew package manager and globally installed packages from pip such as pandas and NumPy, you do not need to uninstall, remove, or change any of them before using conda.

Try using documentation of anaconda as most of the dependencies are untouched while installing it

Related

Can't upgrade Anaconda base to Python 3.8

I want to upgrade my base environment to Python 3.8. According to the official documentation, I should just run conda install -c anaconda python. This, however, only upgrades Python 3.7, so, in the end:
(base) C:\Users\bob>conda install -c anaconda python
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
(base) C:\Users\bob>python --version
Python 3.7.6
conda update -c anaconda python only updated a number of packages, but not Python itself.
And if I specify a version, like explained here, after two hours analyzing dependencies, the upgrade fails because of conflicts.
I managed to set up a 3.8 environment, but I'd rather upgrade my base environment as it's the one my system path for use outside of Anaconda.
Any suggestion?
It doesn't appear to be possible to update the base version of anaconda to 3.8 yet because of the conflicts you mention. I assume once all the standard packages are updated to support 3.8+ (and updated versions of all dependencies), then the anaconda release will include 3.8.x as the default. This might take a while.
The problem here is version conflicts in the packages that anaconda installs by default. The reason you can install 3.8 in a clean environment is because no other packages are installed in that environment, so no conflicts.
This does now present a solution, although it requires reinstalling everything from scratch...
disclaimer: I don't use windows, so adapt my instructions accordingly to your OS.
Remove your existing anaconda install from the path and delete
anything in your bashrc (or windows equivalent) that points to it.
You can just delete/uninstall anaconda, but it's good to have a backup just incase, so leaving it there and removing links to it is a good option.
Download and install miniconda, and put it in your path as you had before.
Install python 3.8 in the base environment conda install python=3.8
Install all the packages that you need to do whatever you do.
Depending on what you install, at some point you may run into the same conflicts that prevent a standard anaconda install from updating at the moment, but that hasn't happened for me.
The latest stable version of anaconda is version 3.7
Please see here:
https://www.anaconda.com/distribution/
There isn't an option to get python 3.8, this is due to anaconda sometimes running a version behind the release of python.
I had the same issue and found there is a 2020-07 release of Anaconda with Python 3.8 https://www.anaconda.com/products/individual

Anaconda upgraded to Python3.8 and now is not working

I had Anaconda linked to python3.5, but after the pip upgrade (with conda) the version of Anaconda was also upgraded to python3.8. I need to go back to the python3.5, because I have lots of libraries already installed and configured on python3.5
Conda was also updated and it was not working, but I found how to have miniconda3 working in order to test some commands.
I don't know what to do in order to recover Anaconda linked to python3.5.
Any suggestion will be more than welcome.

Does Anaconda reinstall all the packages like(numpy, pandas, pycuda etc) even if I had installed them earlier separately with python in Ubuntu 18.04?

As I already have quite a lot of packages installed without installing Anaconda will I have to reinstall them again separately? Or are they accessible in Anaconda environment because I have them preinstalled? There is a similar question which has the answer suggesting installing only miniconda but in my case Anaconda is necessary.
No, anaconda uses completely different environments and whatever downgrading it does, it does it within it's own environments. So, if you are using anaconda environments within your applications, you don't need to reinstall anything but if you are using another environment (like pip only) you need to make sure you have installed all the necessary packages there as well.
Also, if a package is installed using pip and not installed in conda, it will automatically switch to pip so there is no problem there.

Installing tensorflow gpu in anaconda 5.3

I have recently installed anaconda 5.3 and it came with python 3.7 preinstalled. Now when I checked tensorflow website it's says tensorflow does not support 3.7 only 3.6.
Tensorflow Requires Python 3.4, 3.5, or 3.6
What can I do now to have tensorflow gpu for my pc. Any help is appreciated. Is there any workaround?
Thanks.
You should create a new conda virtual environment with python 3.6, then install tensorflow into that.
At the creation of the new env you can freely choose the python version you want to use.
This is one of the essence of conda and virtual envs in general.
A bit more details:
Inside of the anaconda-navigator you can choose Environments, then choose create. Here you can give the new environment name and the packages basis i.e. Python or R and the versions you want to use it for the environment. Then you have to install your custom packages beside of the default ones. Here you can install tensorflow-gpu too.
For installing packages you can choose Anaconda navigator GUI or inside of the Anaconda command shell with conda conda install <package> or in the Anaconda command shell pip install <package>.
In general you should prefer Anaconda package management i.e. GUI or conda to the package versions be consistent, what conda manages well. In some cases -choose always the package developer's suggestion- however, you may choose pip install.

pip installation on different python version

I encounter a problem with pip installation on linux. I've python 2.7 and 3.4, also Django in 1.7 installed. Currently I'm working on a project which uses different versions and I'm unable to install packages trough pip on python 2.7. Everything goes to directory of 3.4.
Is there any way to "force" pip to install packages in concrete version of python?
The usual, and recommended by most users, way of working with Django is to use a separate, virtual environment per project.
Use virtualenv to set up your Python 2.x environment and venv for Python 3.x. Both will install their own, local version of pip. Google lists lots of tutorials if you need help beyond the documentation.

Categories

Resources