Conda InvalidSpecError: Invalid spec: =2.7 with conda-forge usaddress library

8931
8
08-09-2021 01:37 PM
PhilipOrlando
Occasional Contributor

I am trying to install the usaddress python library to my cloned arcgispro-py3 conda environment. I am entering the commands listed below to set up my environment and install this library, but I'm getting this error:

InvalidSpecError: Invalid spec: = 2.7

  1. Run Python Command Prompt as an Administrator
  2. conda create --clone arcgispro-py3 --name arcgispro-py3-clone
  3. activate arcgispro-py3-clone
  4. conda config --env --append channels conda-forge
  5. conda install usaddress --channel conda-forge -y

Here is what conda info is currently returning. Please let me know if you need any additional info to help troubleshoot. Thank you!

(arcgispro-py3-clone) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3>conda info
Current conda install:

platform : win-64
conda version : 4.3.27
conda is private : False
conda-env version : 4.3.27
conda-build version : 3.18.9
python version : 3.6.8.final.0
requests version : 2.22.0
root environment : C:\Program Files\ArcGIS\Pro\bin\Python (writable)
default environment : C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3-clone
envs directories : C:\Program Files\ArcGIS\Pro\bin\Python\envs
C:\Users\USERNAME\AppData\Local\ESRI\conda\envs
C:\Users\USERNAME\.conda\envs
package cache : C:\Users\USERNAME\AppData\Local\ESRI\conda\pkgs
C:\Program Files\ArcGIS\Pro\bin\Python\pkgs
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
https://conda.anaconda.org/esri/win-64
https://conda.anaconda.org/esri/noarch
config file : C:\Program Files\ArcGIS\Pro\bin\Python\.condarc
netrc file : None
offline mode : False
user-agent : conda/4.3.27 requests/2.22.0 CPython/3.6.8 Windows/10 Windows/10.0.18362
administrator : True

0 Kudos
8 Replies
DanPatterson
MVP Esteemed Contributor

If this is the source

Files :: Anaconda.org

a couple of issues... it is 3 years old and the latest version of python supported is 3.6, which isn't used by the current version of ArcGIS Pro (it uses 3.7) and the invalid spec thing suggests it was trying to load a python 2.7 version (? perhaps ?).  So what version of Pro are you using? and is the package you want only available on the conda-forge channel and not the main channel?


... sort of retired...
PhilipOrlando
Occasional Contributor

Thanks for providing the link to the Anaconda.org files. I can see that the latest supported version of python is 3.6. I am currently using ArcGIS Pro 2.7, which uses python 3.7. I think you're onto something with the invalid spec error being related to python 2.7, but I'm not sure how to get around this. I've tried specifying the package version when installing, but I'm still getting the same error.

conda install usaddress=0.5.10 --channel conda-forge -y

I have found this package available on conda-forge, ripl-org, and gwerbin, but not the main channel. While the latter two sources do provide a version for py37, they are unfortunately only for linux users. The original source code is available on github, but I'm really trying to avoid installing anything using git or pip. 

Do you think there is anything else I can try to get this working with my conda environment? Thanks again for your help with this!

0 Kudos
DanPatterson
MVP Esteemed Contributor

You should post on their github site.  if they aren't supporting python 3.7 or higher for windows, there must be a reason (lack of people to get involved, time, platform amongst a few).  

If it only supports 3.6, find a machine with an older Pro perhaps or produce a separate environment that doesn't involve Pro (and hence, arcpy) do the work there and bring the result into Pro as needed


... sort of retired...
PhilipOrlando
Occasional Contributor

Thanks for the suggestion. I have created an issue on the conda-forge usaddress repo here. Hopefully support for python 3.7 will be possible.

0 Kudos
ShaunWalbridge
Esri Regular Contributor

@PhilipOrlandoUnfortunately, a change in the packaging specifications used by conda-forge made Pro 2.7 and earlier unable to download packages from its channel. The new package specification requires conda 4.4 or newer. Pro 2.8 does include Conda 4.9.2 and can be used with conda-forge, or you can install a separate miniconda installation and activate your environment using it to add packages from conda-forge.

Cheers, Shaun

PhilipOrlando
Occasional Contributor

Thanks for the info. I am working on upgrading to Pro 2.8 and will try out conda-forge again. 

0 Kudos
PhilipOrlando
Occasional Contributor

@ShaunWalbridge  Alright, so after upgrading to Pro 2.8 I am now getting the following error when trying to install usaddress to my cloned conda environment: 

--------------------------------------------------------------------------------------------------------------------

conda create --clone arcgispro-py3 --name arcgispro-py3-clone
activate arcgispro-py3-clone
conda install usaddress=0.5.10 -c conda-forge -y

--------------------------------------------------------------------------------------------------------------------

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

- usaddress -> python[version='2.7.*|3.5.*|3.6.*|3.4.*']

Your python: esri/win-64::python==3.7.10=0

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

--------------------------------------------------------------------------------------------------------------------


 Any insight is appreciated, thanks!

0 Kudos
ShaunWalbridge
Esri Regular Contributor

It looks like this package was last updated four years ago, and so newer Python versions didn't yet exist at the time of its previous update. That said, it is a pure Python package, with a minor PR for conda-forge it could be converted to a noarch package which will run independent of Python version, or if you just want to use the package and stop mucking around with packages, I recommend running `pip install usaddress`.

Cheers,

Shaun