Can conda install be used to install source-distributions (i.e. non-archived import packages that have a setup.py)?
Yes and no. You can not conda install per se. However, as the Conda documentation says, Conda ships with pip, so you should be able to pip install -e . your package. You can also install with traditional python setup.py [install|develop].
Remember to activate your Conda environment before installation if you're using one instead of site packages.
As mentioned by vaiski, you can use pip and/or setup.py to build and install the package, but this method is not ideal because packages installed with pip and conda do not respect each other's dependencies.
Thus, if the source distribution includes a conda build recipe (meta.yaml), then you can created the anaconda archive on your own machine by using the conda-build tool:
$ conda build meta.yaml
Afterwards, you will have a local tar.gz of the build package with meta-data that conda can understand. This is what you download from the internet whenever you install a package using conda.
Finally, you can install the package you built locally using:
$ conda install --use-local
Related
I am looking for a way to download a wheel from a conda environment. Here is what I mean and what I would like to do.
I have this conda environment that I download using this command:
conda install -c bioconda mageck
I would like to have a wheel like mageck.whl in order to reinstall the conda environment offline in a next installation using pip install mageck.whl or any other extension that can let me install all the packages for future installation. The aim is to have a dockerfile that can be 100% reproducible at least from the library version and dependencies, installing the environment only using the package downloaded.
Here are some potential solutions if I understand your problem correctly.
Have you tried to create an isolated software environment?
conda create -c bioconda -n mageckenv mageck
after that, you can activate the environment:
source activate mageckenv
Here you have the link to install using Docker
https://bioconda.github.io/recipes/mageck/README.html
I need to install a python package from pypi
Which are the differences between installing it directly in the conda enviroment using conda pip install, and using conda skeleton to build a conda package from the pypi package, and then add install it to the conda enviroment.
The difference is similar to using Software installer to install packages and apt-get install to install packages in Ubuntu. conda pip transfers whole control to pip for installing the required package whereas, conda skeleton uses functionality of conda itself to do all the necessary work step by step.
If I have a directory with setup.py, in pip, I can pip install . in the directory to install the package.
What if I am using conda?
conda install . makes conda to find a package named dot.
conda packages are a different structure than standard python packaging. As a result, the official, recommended and best-practice approach is to use conda to install pip within an activated conda environment, and use that to install standard packages:
conda install pip
NOTE: You want to use conda packages whenever they're available, as they have more features within a conda environment than non-conda packages.
conda install pip will install pip within the currently activated conda environment, and will ensure that it is integrated with conda so that, for example, conda list, will include any packages installed with pip.
NOTE: Commands like conda update will ignore pip installed packages, as it only checks conda channels for available updates, so they still need to be updated using pip. See this Question/Answer discussion:
Does conda update packages from pypi installed using pip install?
NOTE: See #kalefranz comment below regarding conda 4.6 experimental handling of packages.
If you're interested in creating your own conda package(s), take a look at this question/1st answer for a great run-down:
How to install my own python module (package) via conda and watch its changes
If you simply wish to install non-conda packages, using pip is the correct, and expected, way to go.
You can use pip install from within conda environment.
Just activate your environment using:
$ conda activate myenvironment
and use pip install . to install your package in environment's directory.
EDIT: As pointed by Chris Larson in another answert, you should install pip inside the environment using
$ conda install pip
in order to register packages correctly.
If I have a whl file, I can use pip install xxx.whl to install it.
From the documentation, conda install from a local file is also available, but the file should be a tarball file, i.e. .tar.bz2 files.
conda install /package-path/package-filename.tar.bz2 works. And if I have multiple tarballs, I can tar them to get a .tar file, then conda install /packages-path/packages-filename.tar installs the packages in it.
I am trying to install celery using conda in my Miniconda python distribution. I am using PyCharm to manage my project and packages. I have set up the project to use python installed with miniconda as distribution. Trying to install celery from pycharm package manager gives me no results. As well as trying to install conda from command line. Is there a way to install celerey using conda? Is there a way to use both pip and conda in parallerl? Can this be done through PyCharm?I also have python 2.7.10 installed in my windows pc. So I have two python installments in my system one in
C:\Python27
and one in
C:\Miniconda2
conda install celery return the following
Fetching package metadata: ....
Error: No packages found in current win-64 channels matching: celery
You can search for this package on anaconda.org with
anaconda search -t conda celery
You may need to install the anaconda-client command line client with
conda install anaconda-client
You can check the URL.
https://anaconda.org/conda-forge/celery
conda install -c conda-forge celery=3.1.25
I don't think celery is available as a conda package. You can install with pip into a conda environment, yes. But if at all possible you want to try to stick to conda packages.
Can I install/upgrade packages from GitHub using conda?
For example, with pip I can do:
pip install git+git://github.com/scrappy/scrappy#master
to install scrappy directly from the master branch in GitHub. Can I do something equivalent with conda?
If this is not possible, would it make any sense to install pip with conda and manage such local installations with pip?
The answers are outdated. You simply have to conda install pip and git. Then you can use pip normally:
Activate your conda environment source activate myenv
conda install git pip
pip install git+git://github.com/scrappy/scrappy#master
There's better support for this now through conda-env. You can, for example, now do:
name: sample_env
channels:
dependencies:
- requests
- bokeh>=0.10.0
- pip:
- "--editable=git+https://github.com/pythonforfacebook/facebook-sdk.git#8c0d34291aaafec00e02eaa71cc2a242790a0fcc#egg=facebook_sdk-master"
It's still calling pip under the covers, but you can now unify your conda and pip package specifications in a single environment.yml file.
If you wanted to update your root environment with this file, you would need to save this to a file (for example, environment.yml), then run the command: conda env update -f environment.yml.
It's more likely that you would want to create a new environment:
conda env create -f environment.yml (changed as supposed in the comments)
conda doesn't support this directly because it installs from binaries, whereas git install would be from source. conda build does support recipes that are built from git. On the other hand, if all you want to do is keep up-to-date with the latest and greatest of a package, using pip inside of Anaconda is just fine, or alternately, use setup.py develop against a git clone.
I found a reference to this in condas issues. The following should now work.
name: sample_env
channels:
dependencies:
- requests
- bokeh>=0.10.0
- pip:
- git+https://github.com/pythonforfacebook/facebook-sdk.git