I have a valid pip package that I am trying to put onto the Anaconda.org server. I created the meta.yaml file with conda skeleton, which includes the requirement for pint (no particular version selected, so it should default to the latest.) However, when I attempt to build the package with conda build, conda raises this error:
raise DependencyNeedsBuildingError(exc, subdir=subdir)
conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform osx-64: ['pint']
However, there is a pint that is built for osx-64... both in conda and in pip and on my machine - it's the one I use to run my pip package. What repository is conda hunting through to find that requirement and how can I specify the correct pint to use in meta.yaml?
Conda is hunting through the channels in your configuration, which you can view with the command
conda config --get channels
(or conda config --show). Conda build always installs packages from the repositories (which is to say it doesn't rely on packages you have installed locally) because that is what a general user will do when they install your package. In your case, you need to add a channel to pick up the pint package; you can find a suitable channel by searching on Anaconda.org, and in this case, the conda-forge channel (among others, but that's the one I'd recommend) has the pint package. You can add the channel to your configuration with
conda config --add channels conda-forge
or you can use it for this single build with the -c option to conda build:
conda build -c conda-forge your_package_name
See conda-build for more information.
Related
I just tried to install some packages into a fresh environment. I tend to specify channels for each install e.g. conda install -c <channel> <package>, rather than using conda config --add channels <channel name>; conda install <package>. However, I found that certain packages could only be installed when using multiple channels at once. How can this work?
I think I have a fundamental misunderstanding of how packages and channels work. How can a package install require multiple channels? It was my understanding that a particular channel hosted particular packages, e.g. conda-forge hosts x packages and they (and their dependencies) are installable using just conda-forge.
Thanks for any help.
It was my understanding that a particular channel hosted particular packages, e.g. conda-forge hosts x packages and they (and their dependencies) are installable using just conda-forge.
That is not necessarily true. If there is a package that lower-level package that is required as part of an install, but it is only hosted on, perhaps, the default channels, it is often easier to just list it as a requirement than to try to get the originated to post it to multiple channels.
You can always chain together multiple channels in a single conda command as well.
conda install <package> -c defaults -c conda-forge -c <other channel>
Seriously, I have no idea what is up. My minimal working example (Windows 10 Pro, with administrative access, updated as of 2019-11-06):
Fresh install of most recent MiniConda (I used "all users")
.condarc as per conda-forge:
channels:
- conda-forge
- defaults
channel_priority: strict
conda create --name TEST
conda activate TEST
conda install pillow
python -c "from PIL import Image"
ImportError: DLL load failed while importing _imaging: The specified
module could not be found.
I'm tearing my hair out here. Things I have tried/noticed:
Despite using conda-forge strict, the vc and vc2015 packages are installing from pkgs/main.
I have upgraded by base environment, which triggers a switch to conda-forge python. However, the base environment continues to use vc from pkgs/main. (for all I know, this is the correct behavior, but with DLL load failures and vc/vc2015 coming from a different repo than the package, I get suspiscious).
I have ensured that all paths involved, including base install and my environment install paths, have no spaces.
The hack of conda remove pillow --force then pip install pillow...works? It worries me, because I can't figure out why, and I don't know if there will be downstream C incompatibilities
If the above instructions are repeated, but without the switch to conda forge, no error occurs.
NOTE: conda remove pillow does NOT work with --force, because it takes ALL the dependent packages with them in a real environment, as well as any unused dependencies now that those packages are removed. The above method with --force allows a drop-in replacement of pillow in an otherwise well-formed environment.
I'm trying to create conda environment from a file environment.yml.
conda env create -f environment.yml
This works but I want to avoid installing the default packages.
I found flag --no-default-packages but this applies only to conda create and this command doesn't accept the environment.yml file.
Is there a way how to use environment.yml and NOT install default packages?
EDIT:
My ultimate goal is to create environment which could be packaged (or the site-packages of the environment) as lambda for AWS. But it seems conda is installing way too much with every package.
E.g.:
bash-4.2# conda create --name test
bash-4.2# source activate test
(test) bash-4.2# conda install networkx
Fetching package metadata .........
Solving package specifications: .
Package plan for installation in environment /root/miniconda3/envs/test:
The following NEW packages will be INSTALLED:
certifi: 2016.2.28-py36_0
decorator: 4.1.2-py36_0
networkx: 1.11-py36_0
openssl: 1.0.2l-0
pip: 9.0.1-py36_1
python: 3.6.2-0
readline: 6.2-2
setuptools: 36.4.0-py36_1
sqlite: 3.13.0-0
tk: 8.5.18-0
wheel: 0.29.0-py36_0
xz: 5.2.3-0
zlib: 1.2.11-0
Why is this command installing Python, pip and other packages? Are these real dependencies of networkx?
On the other hand if I do pip install -t . networkx it installs just the networkx just as expected.
Is there a way how to use environment.yml and NOT install default packages?
Only the conda create command uses the create_default_packages. The conda env create already ignores the create_default_packages configuration by design.
For example, I just checked adding git to default packages, then created an environment from a YAML with wget as only dependency, and it did not install git.
Why is this command installing Python, pip and other packages? Are these real dependencies of networkx?
Yes, those are the actual dependencies. They may be dependencies of dependencies (and so on), but they are what is needed to install and run networkx according to the package builders.
...if I do pip install -t . networkx it installs just the networkx
The comparison to pip install is misleading. The pip install CLI command itself is an entry point defined by the pip module. An equivalent command would be:
python -m pip install networkx
which makes explicit the fact that one cannot install networkx without already having python and pip.
Keep in mind that Conda was designed from the outset to provide broader support for non-Python dependencies and thus facilitate more independence from the hosts system-level libraries. Hence, you should expect there to be more dependencies, especially ones that would never appear in a system Python using PyPI only.
These packages are part of the Anaconda metapackage which defines the core Anaconda dependencies.
I want to install GSEApy on Anaconda (I use 64bit Windows 10).
https://bioconda.github.io/recipes/gseapy/README.html
https://anaconda.org/bioconda/gseapy
But I get this error:
C:\Windows\system32>conda install gseapy
Using Anaconda Cloud api site https:// api.anaconda.org
Fetching package metadata ...........
Solving package specifications: .
Error: Package missing in current win-64 channels:
- gseapy
You can search for packages on anaconda.org with
anaconda search -t conda gseapy
How can I solve this?
You need to use a channel that has a win-64 version. Use:
conda install -c bioninja gseapy
The option -c or --channel allows to specify a channel.
You can also add a channel permanently via:
conda config --add channels bioninja
This creates a file .condarc in your home directory (on Windows C:\Users\<username>):
channels:
- bioninja
- defaults
You can modify this file manually. The order of the channels determines
their precedence.
Note: Files with a leading . might not be displayed
by certain file browsers. You might need to change settings to display these
files accordingly.
You can find out if a package exits for your platform by searching on Anaconda. Just type gseapy in the search field and you should see the available packages. The column "Platforms" shows if a "win-64" version exists.
Now you could install lastest gseapy through bioconda, too
conda install -c bioconda gseapy
Check the latest version of Keras from the Anaconda Cloud website
https://anaconda.org/search?q=keras
Use command:
conda install -c conda-forge keras=<version>
Maybe it need you to specify a detalied version,so you can just find a version support your environment in Anaconda Clound,just a line of command like "conda install -c dhirschfeld protobuf=3.0.0a3.post418+g0cb84ee ",I select this and it works.
I am trying to install python-qutip to run on IPython notebook, which I have configured to run using the conda path variables . Qutip is an extremely popular (and useful) open-source package to simulate open quantum suystems.
With
conda install python-qutip
or
pip-install python-qutip
I get Error: No packages found matching: python-qutip (as expected). Same thing with
pip install python-qutip
As a quick 'n dirty solution, Is there some way to add the jrjohansson/qutip-releases repository to my conda library?
Alternatively, is it possible to install manually as in: sudo python setup.py install and add the installation directory to the conda path?
I figure you've probably solved this at this point but for any wandering search-engine travelers:
In addition to specifying a channel for a singular install, anaconda's docs give this method for adding a channel to your user's conda config(with conda>=4.1):
conda config --add channels new_channel
You can also see the channels you currently have added in ~/.condarc or by running conda config --show
For this particular case, you might do something like:
conda config --add channels jrjohansson
conda install python-qutip
If you're installing packages from a particular channel frequently(e.g. from conda-forge), this can be pretty useful.
Hope it helps :)
If you search anaconda.com you find the following:
Using binstar api site https://api.anaconda.org
Name: qutip
Summary: QuTiP: The Quantum Toolbox in Python
Access: public
Package Types: conda
Versions:
+ 3.0.1
+ 3.0.0
+ 3.1.0
To install this package with conda run:
conda install --channel https://conda.anaconda.org/jrjohansson qutip
The last line works for me (OpenSuse 13.1, miniconda).
I think the easiest way to install qutip is the following
pip install qutip
This worked for me.
(It could be pip3 install qutip instead.)
Assuming you have conda-build installed, you can try building the conda recipe (currently on a fork):
git clone https://github.com/jrjohansson/conda-recipes.git
cd conda-recipes
conda build qutip
conda install --use-local qutip
Didn't work for my env (ubuntu saucy) but I didn't try too hard. Maybe it will work for you!