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
Related
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.
I want to create a fresh conda environment called new-gooey_env.
conda create --name new_gooey_env python=3.7
I get a notification that the following packages will be insatlled:
ca-certificates pkgs/main/win-64::ca-certificates-2020.6.24-0
certifi pkgs/main/win-64::certifi-2020.6.20-py37_0
openssl pkgs/main/win-64::openssl-1.1.1g-he774522_1
pip pkgs/main/win-64::pip-20.2.2-py37_0
python pkgs/main/win-64::python-3.7.7-h81c818b_4
setuptools pkgs/main/win-64::setuptools-49.4.0-py37_0
sqlite pkgs/main/win-64::sqlite-3.32.3-h2a8f88b_0
vc pkgs/main/win-64::vc-14.1-h0510ff6_4
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_3
wheel pkgs/main/win-64::wheel-0.34.2-py37_0
wincertstore pkgs/main/win-64::wincertstore-0.2-py37_0
zlib pkgs/main/win-64::zlib-1.2.11-h62dcd97_4
That's great. I install them and activate my new environment.
conda activate new_gooey_env
Now when I type pip freeze, I can see that basically every package on my computer has been installed into this new environment.
The output of pip freeeze in my new environment is about 100 packages.
How can I create a new environment with just the bare minimum packages?
I have already googled this problem and followed the instructions here, which doesn't work hence the question.
Note when I type conda list I only get the list of packages above.
So is pip freeze command correct? Is there also 100 packages in my new environment?
edit: On Windows.
Use pip freeze -l .
The l stands for local .
pip freeze otherwise acts on all your environments as your virtualenv has global access. That is my best guess.
And no , your new environment doesn't have 100's of packages!
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.
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
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.