pip install vs conda install [duplicate] - python

This question already has answers here:
What is the difference between pip and conda?
(14 answers)
Closed 2 years ago.
Since I am using Spider, I should use "conda install". But some packages can not be installed in "conda install" while they easily can be installed in "pip install". For example, I installed Keras in "pip install" but in Spider, Keras can not be imported (Keras is not known). Then, I again installed Keras in conda install form.
On the other hand, some packages which were installed in "conda install" could be used and imported in python IDE or Spyder and vice versa.

pip install installs python packages in any environment
conda install installs any package in conda environments
An example would be the tensorflow library, pip requires CUDA and other software requirements to be preinstalled, but conda installs all necessary and compatible dependencies automatically.
Also as rightly pointed out pip installs from PyPi and conda gets packages from its own anaconda repo.
pip on the other hand has advantages, that it can install packages that conda doesn't have and also it supports system wide installs for packages.
Check out: What is the difference between pip and conda?
Also: Understanding Conda and Pip

Related

Use Anaconda package manager in Winpython

I'm using Winpython to do a project but i'm struggling to install a package with pip. This package is easily installed using "conda install" in my Anaconda. I would like to know if there is some way to use the conda package manager in Winpython (i.e install package using conda install in Winpython)
No. Depending of what you miss:
download big binary packages from https://www.lfd.uci.edu/~gohlke/pythonlibs/ in a local directory "d:\toto"
"pip install --pre --no-index --trusted-host=None --find-links=d:\toto your_package"
or
"pip install d:\toto\your_package_wheel_exact_name"

If Anaconda comes with pip, why do instructions suggest installing it?

I have just installed Anaconda with Python3.7 on my Ubuntu 18.04. Ubuntu 18.04 comes with Python3.6 by default (but not pip).
After installing Anaconda and reading its documentation, I can see that Anaconda comes with both conda and pip. This is the case, as I can see:
$ which pip
# Output: /home/user-name/anaconda3/bin/pip
$ pip --version
# Output:
pip 10.0.1 from /home/user-name/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
However, I am confused when reading the instructions from this link:
https://conda.io/docs/user-guide/tasks/manage-pkgs.html#installing-non-conda-packages
On one hand it says: " Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately." => That's the pip I can see in my commands above.
But on the other hand it says: " It is possible to have pip installed outside a conda environment or inside a conda environment. To gain the benefits of conda integration, be sure to install pip inside the currently active conda environment, and then install packages with that instance of pip. The command conda list shows packages installed this way, with a label showing that they were installed with pip.
So I'm confused:
I clearly got a version of pip when installing Anaconda and I can see in /home/user-name/anaconda3/bin
But if I want to use pip to install a package, I need to install pip in my environment using $ conda install pip and then $ pip install package (all of this in my normal Ubuntu terminal).
I don't understand how this makes sense..
Many thanks!

What is the effect of using pip to install python packages on anaconda?

I have installed a fresh anaconda v4.4. I realized that python packages can be installed using both conda and pip. What is the effect of using pip to install python packages instead of conda when using anaconda? Will the pip-installed libraries cease to function? I am using python v3
EDIT: I don't think the question is a duplicate of What is the difference between pip and conda?
That question explains the difference between pip and conda but does not talk about the effect of using pip when conda can be used.
Everything might keep working if you use pip to install vs conda. However, Conda cannot manage dependencies that pip has installed - it cannot upgrade them, or remove them. More importantly, conda will install a package even if its already been installed with pip! Try this test:
conda create -n testenv python=3
conda activate testenv
pip install numpy
conda install scipy
You will see from the third command that conda will want to re-install NumPy, even though it has already been installed with pip. This can cause problems if there are C libraries whose linking is different, or something like that. In general, whenever possible, use conda to install packages into conda environments.

How to use conda to install Github package specutils?

I am using Anaconda python (2.7) on my Windows 7 machine. I want to install specutils which is a associated package for Astropy.
conda, as I understand, can installs binaries using conda install <package> command. My question is
where can I find the binary version of the specutils in the above cited repository.
How do I install specutils using conda?
You can install specutils with conda:
$ conda install -c astropy specutils
This installs specutils from the astropy anaconda channel (I'm almost certain that you can find the binaries there). If you want to install the development version you can also use:
$ pip install git+https://github.com/astropy/specutils.git#master
There are no stable releases of specutils yet, but you can install it by doing:
git clone https://github.com/astropy/specutils.git
cd specutils
python setup.py install
The specutils docs can be found here, and please report any issues here

PATH points to wrong version of pip

I have the anaconda distribution of python installed on my machine. Before installing anaconda, i had pip installed. Right now, my system uses the previous version of pip rather than the anaconda version. In particular
arjuns-mbp:~ Arjun$ which pip
/usr/local/bin/pip
arjuns-mbp:~ Arjun$ which easy_install
/Users/Arjun/anaconda/bin/easy_install
arjuns-mbp:~ Arjun$ which python
/Users/Arjun/anaconda/bin/python
The result is that if i call a pip install, it won't add it to my anaconda version of python. So far i haven't had an issue simply using easy_install to add packages to anaconda, but it would be nice to know what causes this discrepancy and how to fix it
EDIT
i tried using conda install pip, it doesn't work. When I do
conda list
pip showed up before and after a conda install
You probably need to conda install pip.
pip should already come with Anaconda automatically. How did you install Anaconda? No matter, though, you can just conda install pip to make sure you have a version of pip that is tied to the Anaconda distribution.
From there you can create environments as much as you like to install whatever new trial-run software tools using conda create -n env_name python pip

Categories