Repository: conda/conda-build

Issue:
ImportError: cannot import name 'CondaValueError' conda-build 2.0.5
```

With conda-build 2.0.5:

$ conda build recipe/
Traceback (most recent call last):
  File "/opt/miniconda/bin/conda-build", line 4, in <module>
    import conda_build.cli.main_build
  File "/opt/miniconda/lib/python3.5/site-packages/conda_build/cli/main_build.py", line 16, in <module>
    import conda_build.api as api
  File "/opt/miniconda/lib/python3.5/site-packages/conda_build/api.py", line 22, in <module>
    from conda_build.config import Config, get_or_merge_config, DEFAULT_PREFIX_LENGTH as _prefix_length
  File "/opt/miniconda/lib/python3.5/site-packages/conda_build/config.py", line 14, in <module>
    from .conda_interface import string_types, binstar_upload
  File "/opt/miniconda/lib/python3.5/site-packages/conda_build/conda_interface.py", line 21, in <module>
    from conda.resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version, CondaValueError  # NOQA
ImportError: cannot import name 'CondaValueError'
```

That recipe works on 2.0.4 (and conda-build-1.21.14)

```
 $ conda list --export
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
Using Anaconda API: https://api.anaconda.org
cligj=0.4.0=py35_0
conda-build=2.0.5=py35_0
affine=2.0.0.post1=py35_0
anaconda-client=1.5.1=py35_0
backports.shutil_get_terminal_size=1.0.0=py35_0
basemap=1.0.8.dev0=np111py35_2
blas=1.1=openblas
cairo=1.12.18=8
cartopy=0.14.2=np111py35_1
click-plugins=1.0.3=py35_0
clyent=1.2.1=py35_0
conda=4.1.11=py35_1
conda-env=2.5.2=py35_0
curl=7.49.1=1
cycler=0.10.0=py35_0
decorator=4.0.10=py35_0
entrypoints=0.2.2=py35_0
expat=2.1.0=2
filelock=2.0.6=py35_0
fiona=1.7.0=np111py35_2
flake8=3.0.4=py35_1
flake8-quotes=0.8.1=py35_0
fontconfig=2.11.1=3
freetype=2.6.3=1
freexl=1.0.2=1
gdal=2.1.1=np111py35_2
geos=3.4.2=2
gettext=0.19.7=1
giflib=5.1.2=1
glib=2.48.0=4
harfbuzz=1.0.6=0
hdf4=4.2.12=0
hdf5=1.8.17=2
icu=56.1=4
invoke=0.13.0=py35_0
ipykernel=4.4.1=py35_1
ipython=5.1.0=py35_0
ipython_genutils=0.1.0=py35_0
ipywidgets=5.2.2=py35_0
jinja2=2.8=py35_1
jpeg=9b=0
json-c=0.12=0
jsonschema=2.5.1=py35_0
jupyter_client=4.4.0=py35_0
jupyter_console=5.0.0=py35_0
jupyter_core=4.1.1=py35_1
kealib=1.4.6=3
libdap4=3.18.0=2
libffi=3.2.1=2
libiconv=1.14=3
libnetcdf=4.4.1=0
libpng=1.6.24=0
libpq=9.5.3=1
libsodium=1.0.10=0
libspatialite=4.3.0a=9
libtiff=4.0.6=6
libuuid=1.0.3=1
libxml2=2.9.4=0
libxslt=1.1.29=0
lxml=3.6.2=py35_0
markupsafe=0.23=py35_0
matplotlib=1.5.3=np111py35_2
mccabe=0.5.0=py35_0
mistune=0.7.3=py35_0
mock=2.0.0=py35_0
munch=2.0.4=py35_0
nbconvert=4.2.0=py35_0
nbformat=4.1.0=py35_0
ncurses=5.9=8
netcdf4=1.2.4=np111py35_2
nose=1.3.7=py35_2
notebook=4.2.2=py35_0
numpy=1.11.2=py35_blas_openblas_200
openblas=0.2.18=4
openjpeg=2.1.0=6
owslib=0.11.2=py35_0
pandas=0.19.0=np111py35_0
pango=1.40.1=0
patchelf=0.9=1
pbr=1.10.0=py35_0
pcre=8.38=1
pep8=1.7.0=py35_0
pexpect=4.2.0=py35_1
pickleshare=0.7.3=py35_0
pillow=3.3.0=py35_0
pixman=0.32.6=0
pkginfo=1.2.1=py35_0
proj.4=4.9.2=0
prompt_toolkit=1.0.6=py35_0
ptyprocess=0.5.1=py35_0
pycodestyle=2.0.0=py35_0
pyepsg=0.3.1=py35_0
pyflakes=1.2.3=py35_0
pygments=2.1.3=py35_1
pyparsing=2.1.7=py35_0
pyproj=1.9.5.1=py35_0
pyshp=1.2.3=py35_0
python=3.5.2=2
python-dateutil=2.5.3=py35_0
pytz=2016.6.1=py35_0
pyyaml=3.11=py35_0
pyzmq=15.4.0=py35_0
qt=4.8.7=0
qtconsole=4.2.1=py35_0
rasterio=0.36.0=np111py35_2
scipy=0.18.1=np111py35_blas_openblas_200
shapely=1.5.17=np111py35_0
simplegeneric=0.8.1=py35_0
sip=4.18=py35_0
six=1.10.0=py35_0
snuggs=1.4.0=py35_0
terminado=0.6=py35_0
tornado=4.4.1=py35_1
traitlets=4.2.2=py35_0
wcwidth=0.1.7=py35_0
widgetsnbextension=1.2.6=py35_3
xerces-c=3.1.4=2
zeromq=4.1.5=0
jupyter=1.0.0=py35_3
libgfortran=3.0.0=1
bumpversion=0.5.3=py35_0
click=5.1=py35_0
musher=0.1.1=py35_0
nose-exclude=0.4.1=py35_0
plotly=1.9.6=py35_0
openssl=1.0.2h=1
pip=8.1.2=py35_0
pycosat=0.6.1=py35_1
pycrypto=2.6.1=py35_4
pyqt=4.11.4=py35_4
readline=6.2=2
requests=2.10.0=py35_0
ruamel_yaml=0.11.14=py35_0
setuptools=23.0.0=py35_0
sqlite=3.13.0=0
tk=8.5.18=0
wheel=0.29.0=py35_0
xlrd=1.0.0=py35_0
xlsxwriter=0.9.3=py35_0
xz=5.2.2=0
yaml=0.1.6=0
zlib=1.2.8=3
vagrant@vmsnowoffpiste ~/projects/seaicedatastore/source (master=)
 $ 
```



Discussion:
Sorry about this. I messed up the compatibility.

Short fix : update conda.

On Oct 13, 2016 4:20 PM, "Matt Savoie" notifications@github.com wrote:

> $ conda build recipe/
> Traceback (most recent call last):
>   File "/opt/miniconda/bin/conda-build", line 4, in <module>
>     import conda_build.cli.main_build
>   File "/opt/miniconda/lib/python3.5/site-packages/conda_build/cli/main_build.py", line 16, in <module>
>     import conda_build.api as api
>   File "/opt/miniconda/lib/python3.5/site-packages/conda_build/api.py", line 22, in <module>
>     from conda_build.config import Config, get_or_merge_config, DEFAULT_PREFIX_LENGTH as _prefix_length
>   File "/opt/miniconda/lib/python3.5/site-packages/conda_build/config.py", line 14, in <module>
>     from .conda_interface import string_types, binstar_upload
>   File "/opt/miniconda/lib/python3.5/site-packages/conda_build/conda_interface.py", line 21, in <module>
>     from conda.resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version, CondaValueError  # NOQA
> ImportError: cannot import name 'CondaValueError'
> 
> That recipe works on 2.0.4 (and conda-build-1.21.14)
> 
>  $ conda list --export
> 
> # This file may be used to create an environment using:
> 
> # $ conda create --name <env> --file <this file>
> 
> # platform: linux-64
> 
> Using Anaconda API: https://api.anaconda.org
> cligj=0.4.0=py35_0
> conda-build=2.0.5=py35_0
> affine=2.0.0.post1=py35_0
> anaconda-client=1.5.1=py35_0
> backports.shutil_get_terminal_size=1.0.0=py35_0
> basemap=1.0.8.dev0=np111py35_2
> blas=1.1=openblas
> cairo=1.12.18=8
> cartopy=0.14.2=np111py35_1
> click-plugins=1.0.3=py35_0
> clyent=1.2.1=py35_0
> conda=4.1.11=py35_1
> conda-env=2.5.2=py35_0
> curl=7.49.1=1
> cycler=0.10.0=py35_0
> decorator=4.0.10=py35_0
> entrypoints=0.2.2=py35_0
> expat=2.1.0=2
> filelock=2.0.6=py35_0
> fiona=1.7.0=np111py35_2
> flake8=3.0.4=py35_1
> flake8-quotes=0.8.1=py35_0
> fontconfig=2.11.1=3
> freetype=2.6.3=1
> freexl=1.0.2=1
> gdal=2.1.1=np111py35_2
> geos=3.4.2=2
> gettext=0.19.7=1
> giflib=5.1.2=1
> glib=2.48.0=4
> harfbuzz=1.0.6=0
> hdf4=4.2.12=0
> hdf5=1.8.17=2
> icu=56.1=4
> invoke=0.13.0=py35_0
> ipykernel=4.4.1=py35_1
> ipython=5.1.0=py35_0
> ipython_genutils=0.1.0=py35_0
> ipywidgets=5.2.2=py35_0
> jinja2=2.8=py35_1
> jpeg=9b=0
> json-c=0.12=0
> jsonschema=2.5.1=py35_0
> jupyter_client=4.4.0=py35_0
> jupyter_console=5.0.0=py35_0
> jupyter_core=4.1.1=py35_1
> kealib=1.4.6=3
> libdap4=3.18.0=2
> libffi=3.2.1=2
> libiconv=1.14=3
> libnetcdf=4.4.1=0
> libpng=1.6.24=0
> libpq=9.5.3=1
> libsodium=1.0.10=0
> libspatialite=4.3.0a=9
> libtiff=4.0.6=6
> libuuid=1.0.3=1
> libxml2=2.9.4=0
> libxslt=1.1.29=0
> lxml=3.6.2=py35_0
> markupsafe=0.23=py35_0
> matplotlib=1.5.3=np111py35_2
> mccabe=0.5.0=py35_0
> mistune=0.7.3=py35_0
> mock=2.0.0=py35_0
> munch=2.0.4=py35_0
> nbconvert=4.2.0=py35_0
> nbformat=4.1.0=py35_0
> ncurses=5.9=8
> netcdf4=1.2.4=np111py35_2
> nose=1.3.7=py35_2
> notebook=4.2.2=py35_0
> numpy=1.11.2=py35_blas_openblas_200
> openblas=0.2.18=4
> openjpeg=2.1.0=6
> owslib=0.11.2=py35_0
> pandas=0.19.0=np111py35_0
> pango=1.40.1=0
> patchelf=0.9=1
> pbr=1.10.0=py35_0
> pcre=8.38=1
> pep8=1.7.0=py35_0
> pexpect=4.2.0=py35_1
> pickleshare=0.7.3=py35_0
> pillow=3.3.0=py35_0
> pixman=0.32.6=0
> pkginfo=1.2.1=py35_0
> proj.4=4.9.2=0
> prompt_toolkit=1.0.6=py35_0
> ptyprocess=0.5.1=py35_0
> pycodestyle=2.0.0=py35_0
> pyepsg=0.3.1=py35_0
> pyflakes=1.2.3=py35_0
> pygments=2.1.3=py35_1
> pyparsing=2.1.7=py35_0
> pyproj=1.9.5.1=py35_0
> pyshp=1.2.3=py35_0
> python=3.5.2=2
> python-dateutil=2.5.3=py35_0
> pytz=2016.6.1=py35_0
> pyyaml=3.11=py35_0
> pyzmq=15.4.0=py35_0
> qt=4.8.7=0
> qtconsole=4.2.1=py35_0
> rasterio=0.36.0=np111py35_2
> scipy=0.18.1=np111py35_blas_openblas_200
> shapely=1.5.17=np111py35_0
> simplegeneric=0.8.1=py35_0
> sip=4.18=py35_0
> six=1.10.0=py35_0
> snuggs=1.4.0=py35_0
> terminado=0.6=py35_0
> tornado=4.4.1=py35_1
> traitlets=4.2.2=py35_0
> wcwidth=0.1.7=py35_0
> widgetsnbextension=1.2.6=py35_3
> xerces-c=3.1.4=2
> zeromq=4.1.5=0
> jupyter=1.0.0=py35_3
> libgfortran=3.0.0=1
> bumpversion=0.5.3=py35_0
> click=5.1=py35_0
> musher=0.1.1=py35_0
> nose-exclude=0.4.1=py35_0
> plotly=1.9.6=py35_0
> openssl=1.0.2h=1
> pip=8.1.2=py35_0
> pycosat=0.6.1=py35_1
> pycrypto=2.6.1=py35_4
> pyqt=4.11.4=py35_4
> readline=6.2=2
> requests=2.10.0=py35_0
> ruamel_yaml=0.11.14=py35_0
> setuptools=23.0.0=py35_0
> sqlite=3.13.0=0
> tk=8.5.18=0
> wheel=0.29.0=py35_0
> xlrd=1.0.0=py35_0
> xlsxwriter=0.9.3=py35_0
> xz=5.2.2=0
> yaml=0.1.6=0
> zlib=1.2.8=3
> vagrant@vmsnowoffpiste ~/projects/seaicedatastore/source (master=)
>  $
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> https://github.com/conda/conda-build/issues/1459, or mute the thread
> https://github.com/notifications/unsubscribe-auth/AACV-U5mgMfXRA8Nuy7UfngMh6C5wzgZks5qzqCTgaJpZM4KWYaY
> .

I actually tried to update conda first....

```
 $ conda update conda
Using Anaconda API: https://api.anaconda.org
Fetching package metadata .............
Solving package specifications: ..........

# All requested packages already installed.
# packages in environment at /opt/miniconda:
#
conda                     4.1.11                   py35_1    conda-forge/channel/main
vagrant@vmsnowoffpiste ~/projects/seaicedatastore/source (master=)
```

Or is that not what you meant?

Unfortunately, you are picking up conda-forge conda, which is a bit behind.
Conda 4.2.9 is the current release.

I advise you to turn off conda auto update (please Google this, I'm on my
phone), remove conda forge from your channels, update conda, and then
re-add conda forge to your channels.

Sorry for the mess!

On Oct 13, 2016 4:27 PM, "Matt Savoie" notifications@github.com wrote:

> I actually tried to update conda first....
> 
>  $ conda update conda
> Using Anaconda API: https://api.anaconda.org
> Fetching package metadata .............
> Solving package specifications: ..........
> 
> # All requested packages already installed.
> 
> # packages in environment at /opt/miniconda:
> 
> #
> conda                     4.1.11                   py35_1    conda-forge/channel/main
> vagrant@vmsnowoffpiste ~/projects/seaicedatastore/source (master=)
> 
> Or is that not what you meant?
> 
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> https://github.com/conda/conda-build/issues/1459#issuecomment-253643931,
> or mute the thread
> https://github.com/notifications/unsubscribe-auth/AACV-btiSalM0vRDQKX8Z-mWIUOlNwrsks5qzqIzgaJpZM4KWYaY
> .

No worries.  Thanks.  I can handle that.  Didn't even see that conda was coming from conda-forge.  Thanks for the work around.  I may just end up pinning conda-build to 2.0.4 for the time being since we're doing a lot of this with automation.  


Resolving patch:
diff --git a/conda_build/build.py b/conda_build/build.py
--- a/conda_build/build.py
+++ b/conda_build/build.py
@@ -36,12 +36,12 @@
 from .conda_interface import package_cache
 from .conda_interface import prefix_placeholder, linked, symlink_conda
 from .conda_interface import url_path
-from .conda_interface import (Resolve, MatchSpec, NoPackagesFound, Unsatisfiable,
-                              CondaValueError, NoPackagesFoundError)
+from .conda_interface import Resolve, MatchSpec, Unsatisfiable
 from .conda_interface import TemporaryDirectory
 from .conda_interface import get_rc_urls, get_local_urls
 from .conda_interface import VersionOrder
-from .conda_interface import PaddingError, LinkError
+from .conda_interface import (PaddingError, LinkError, CondaValueError,
+                              NoPackagesFoundError, NoPackagesFound)
 
 from conda_build import __version__
 from conda_build import environ, source, tarcheck
diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py
--- a/conda_build/conda_interface.py
+++ b/conda_build/conda_interface.py
@@ -18,7 +18,7 @@
                            rm_rf, symlink_conda, rm_fetched, package_cache)  # NOQA
 from conda.lock import Locked  # NOQA
 from conda.misc import untracked, walk_prefix  # NOQA
-from conda.resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version, CondaValueError  # NOQA
+from conda.resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version  # NOQA
 from conda.signature import KEYS, KEYS_DIR, hash_file, verify  # NOQA
 from conda.utils import human_bytes, hashsum_file, md5_file, memoized, unix_path_to_win, win_path_to_unix, url_path  # NOQA
 import conda.config as cc  # NOQA
@@ -53,6 +53,7 @@
     PaddingError = conda.exceptions.PaddingError
     LinkError = conda.exceptions.LinkError
     NoPackagesFoundError = conda.exceptions.NoPackagesFoundError
+    CondaValueError = conda.exceptions.CondaValueError
 
 else:
     from conda.config import get_default_urls, non_x86_linux_machines, load_condarc  # NOQA
@@ -82,6 +83,9 @@ class LinkError(Exception):
     class NoPackagesFoundError(Exception):
         pass
 
+    class CondaValueError(Exception):
+        pass
+
 
 class SignatureError(Exception):
     pass


Test patch: