ResolvePackageNotFound: Create env using conda and yml file on MacOS

I want to create a virtual environment using conda and yml file.

Command:

conda env create -n ex3 -f env.yml 

Type ENTER it gives following message:

ResolvePackageNotFound: - gst-plugins-base==1.8.0=0 - dbus==1.10.20=0 - opencv3==3.2.0=np111py35_0 - qt==5.6.2=5 - libxcb==1.12=1 - libgcc==5.2.0=0 - gstreamer==1.8.0=0 

However, I do have those on my Mac. My MacOS: High Sierra 10.13.3

My env.yml file looks like this:

name: ex3 channels: - menpo - defaults dependencies: - cairo=1.14.8=0 - certifi=2016.2.28=py35_0 - cycler=0.10.0=py35_0 - dbus=1.10.20=0 - expat=2.1.0=0 - fontconfig=2.12.1=3 - freetype=2.5.5=2 - glib=2.50.2=1 - gst-plugins-base=1.8.0=0 - gstreamer=1.8.0=0 - harfbuzz=0.9.39=2 - hdf5=1.8.17=2 - icu=54.1=0 - jbig=2.1=0 - jpeg=9b=0 - libffi=3.2.1=1 - libgcc=5.2.0=0 - libgfortran=3.0.0=1 - libiconv=1.14=0 - libpng=1.6.30=1 - libtiff=4.0.6=3 - libxcb=1.12=1 - libxml2=2.9.4=0 - matplotlib=2.0.2=np111py35_0 - mkl=2017.0.3=0 - numpy=1.11.3=py35_0 - openssl=1.0.2l=0 - pandas=0.20.1=np111py35_0 - patsy=0.4.1=py35_0 - pcre=8.39=1 - pip=9.0.1=py35_1 - pixman=0.34.0=0 - pyparsing=2.2.0=py35_0 - pyqt=5.6.0=py35_2 - python=3.5.4=0 - python-dateutil=2.6.1=py35_0 - pytz=2017.2=py35_0 - qt=5.6.2=5 - readline=6.2=2 - scipy=0.19.0=np111py35_0 - seaborn=0.8=py35_0 - setuptools=36.4.0=py35_1 - sip=4.18=py35_0 - six=1.10.0=py35_0 - sqlite=3.13.0=0 - statsmodels=0.8.0=np111py35_0 - tk=8.5.18=0 - wheel=0.29.0=py35_0 - xz=5.2.3=0 - zlib=1.2.11=0 - opencv3=3.2.0=np111py35_0 - pip: - bleach==1.5.0 - enum34==1.1.6 - html5lib==0.9999999 - markdown==2.6.11 - protobuf==3.5.1 - tensorflow==1.4.1 - tensorflow-tensorboard==0.4.0 - werkzeug==0.14.1 

How to solve this problem?

Well....The stack overflow prompt me to say more details, but I think I describe things clearly, it is sad, stack overflow does not support to upload attachment....

2

7 Answers

I had same problem and found your question googling for it.

ResolvePackageNotFound error describes all packages not installed yet, but required.

To solve the problem, move them under pip section:

name: ex3 channels: - menpo - defaults dependencies: - cairo=1.14.8=0 - *** - another dependencies, except not found ones - pip: - gst-plugins-base==1.8.0 - bleach==1.5.0 - enum34==1.1.6 - html5lib==0.9999999 - markdown==2.6.11 - protobuf==3.5.1 - tensorflow==1.4.1 - tensorflow-tensorboard==0.4.0 - werkzeug==0.14.1 *** added *** - gst-plugins-base==1.8.0 - dbus==1.10.20 - opencv3==3.2.0 - qt==5.6.2 - libxcb==1.12 - libgcc==5.2.0 - gstreamer==1.8.0 
8

I got the same issue and found a GitHub issue related to this. In the comments, @kalefranz posted an ideal solution by using the --no-builds flag with conda env export.

conda env export --no-builds > environment.yml 

However, even remove build numbers, some packages may still have different version number at different OS. The best way I think is to create different env yml file for different OS.

Hope this helps.

2

tl;dr conda env export --from-history -n name_of_your_env -f environment.yml


conda env export command pins your dependencies to the exact version along with OS specific details.

Looks like this for Pandas on macOS for example, - pandas=1.0.5=py38h959d312_0. conda env create cannot use this to create the same environment on other OS, like Linux inside Docker for instance.

So export the packages without pinning, and the ones you specifically installed after creating the conda environment, from history, using conda env export --from-history.

1

There can be another reason for the 'ResolvePackageNotFound' error -- the version of the packages you require might be in an old version of the repository that is not searched by default.

The different paths to locations in the Anaconda repositories can be found at:

My yml file [NW_BI.yml] is as follows:

name: NW_BI channels: - ' # Remove this line and it fails!!! - conda-forge - defaults dependencies: - python=2.7.10 - pandas=0.16.2 - pyodbc=3.0.10 

Create using:

conda env create -f 'path to file'\NW_BI.yml 

I wanted to recreate an old environment!!!!

Note using:
Anaconda3 2019.10
Windows10

I had a similar issue and was able to work around it. My issue wasn't related to pip but rather because the export platform wasn't the same as the import platform (Ref: nehaljwani's November 2018 answer on ).

@Shixiang Wang's answer point towards a part of the solution. The no-build argument allows for more flexibility but there are some components which are specific to the platform or OS.

Using the no-build export, I was able to identify (from the error message at import time) which libraries were problematic and simply removed them from the YML file. This may not be flawless, but saves a lot of time compared to starting from scratch.

NOTE: I got a Pip subprocess error which interrupted the installation at a given library, which could be simply overcome via a conda install <library>. From there I could relaunch the import from the YML file.

Use --no-builds option to conda env export

If you are looking at this and feel too much chore to change Conda version packge=ver=py.* to pip style package==ver, I wrote this small script that delete the =py.* part from Conda style.

Note below code work on the presume that you already changed package=ver to package==ver.

#!/bin/bash COUNT=0 find_pip=0 while IFS= read -r line; do COUNT=$(( $COUNT + 1 )) # echo "$COUNT" # echo "read it" if echo ${line} | grep -q -- "- pip:" ; then # echo "find it" find_pip=1 indent=`awk -F- '{print length($1)}' <<< "$line"` pip_indent=$(( $indent + 2 )) # echo $indent # echo $pip_indent fi line_indent=`awk -F- '{print length($1)}' <<< "$line"` if [[ ${find_pip} ]] && [[ ${pip_indent} -eq ${line_indent} ]]; then # echo "$line" new_line=`echo ${line} | cut -d'=' -f-3` new_line=" $new_line" # echo "${new_line}" sed -e "${COUNT}s/.*/${new_line}/" -i '' $1 fi done < "$1" 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like